gold: Add sparc IFUNC support to Gold.
[external/binutils.git] / gold / ChangeLog
1 2012-04-16  David S. Miller  <davem@davemloft.net>
2
3         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4         (Target_sparc::Target_sparc): Initialize new field.
5         (Target_sparc::do_plt_section_for_global): New function.
6         (Target_sparc::do_plt_section_for_local): New function.
7         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
8         (Target_sparc::make_plt_section): New function, broken out of
9         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
10         (Target_sparc::make_plt_entry): Call make_plt_section.
11         (Target_sparc::make_local_ifunc_plt_entry): New function.
12         (Target_sparc::rela_ifunc_section): New function.
13         (Target_sparc::plt_section): Remove const.
14         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
15         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
16         and ifunc_count_ fields.
17         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
18         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
19         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
20         (Output_data_plt_sparc::rela_ifunc): New function.
21         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
22         (Output_data_plt_sparc::has_ifunc_section): New function.
23         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
24         (Output_data_plt_sparc::address_for_global): New function.
25         (Output_data_plt_sparc::address_for_local): New function.
26         (Output_data_plt_sparc::plt_index_to_offset): New function.
27         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
28         and entry_count.
29         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
30         entry_count.
31         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
32         R_SPARC_JMP_IREL to switch.
33         (Target_sparc::Scan::check_non_pic): Likewise.
34         (Target_sparc::Scan::local): Handle IFUNC symbols.
35         (Target_sparc::Scan::local): Likewise.
36         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
37         and plt_address_for_local.
38         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
39         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
40
41         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
42         (class Output_data_reloc): Adjust calls to Output_reloc_type.
43         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
44         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
45         global relocs too.
46         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
47         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
48         calls.
49         * sparc.cc (Target_sparc::Scan::global): Likewise.
50         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
51
52 2012-04-16  Cary Coutant  <ccoutant@google.com>
53
54         * archive.cc (Library_base::should_include_member): Check for
55         --export-dynamic-symbol.
56         * options.h (class General_options): Add --export-dynamic-symbol.
57         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
58         --export-dynamic-symbol.
59         (Symbol_table::gc_mark_undef_symbols): Likewise.
60         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
61
62 2012-04-12  David S. Miller  <davem@davemloft.net>
63
64         * sparc.cc (Reloc::wdisp10): New relocation method.
65         (Reloc::h34): Likewise.
66         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
67         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
68         R_SPARC_WDISP10.
69         (Target_sparc::Scan::local): Likewise.
70         (Target_sparc::Scan::global): Likewise.
71         (Target_sparc::Relocate::relocate): Likewise.
72
73 2012-04-09  Cary Coutant  <ccoutant@google.com>
74
75         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
76         low_pc == 0.
77
78 2012-04-06  Ian Lance Taylor  <iant@google.com>
79
80         * timer.cc: #include <unistd.h>.
81
82 2012-04-06  Roland McGrath  <mcgrathr@google.com>
83
84         * configure.in (AC_CHECK_HEADERS): Add locale.h.
85         * config.in: Regenerate.
86         * configure: Regenerate.
87
88 2012-04-05  Nick Clifton  <nickc@redhat.com>
89
90         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
91         (AM_LC_MESSAGES): Add.
92         * aclocal.m4: Regenerate.
93         * config.in: Regenerate.
94         * configure: Regenerate.
95
96 2012-03-21  Cary Coutant  <ccoutant@google.com>
97
98         * Makefile.am: Add gdb-index.cc, gdb-index.h.
99         * Makefile.in: Regenerate.
100         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
101         (Sized_elf_reloc_mapper::symbol_section): New function.
102         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
103         (make_elf_reloc_mapper): New function.
104         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
105         (Dwarf_abbrev_table::do_read_abbrevs): New function.
106         (Dwarf_abbrev_table::do_get_abbrev): New function.
107         (Dwarf_ranges_table::read_ranges_table): New function.
108         (Dwarf_ranges_table::read_range_list): New function.
109         (Dwarf_pubnames_table::read_section): New function.
110         (Dwarf_pubnames_table::read_header): New function.
111         (Dwarf_pubnames_table::next_name): New function.
112         (Dwarf_die::Dwarf_die): New function.
113         (Dwarf_die::read_attributes): New function.
114         (Dwarf_die::skip_attributes): New function.
115         (Dwarf_die::set_name): New function.
116         (Dwarf_die::set_linkage_name): New function.
117         (Dwarf_die::attribute): New function.
118         (Dwarf_die::string_attribute): New function.
119         (Dwarf_die::int_attribute): New function.
120         (Dwarf_die::uint_attribute): New function.
121         (Dwarf_die::ref_attribute): New function.
122         (Dwarf_die::child_offset): New function.
123         (Dwarf_die::sibling_offset): New function.
124         (Dwarf_info_reader::check_buffer): New function.
125         (Dwarf_info_reader::parse): New function.
126         (Dwarf_info_reader::do_parse): New function.
127         (Dwarf_info_reader::do_read_string_table): New function.
128         (Dwarf_info_reader::lookup_reloc): New function.
129         (Dwarf_info_reader::get_string): New function.
130         (Dwarf_info_reader::visit_compilation_unit): New function.
131         (Dwarf_info_reader::visit_type_unit): New function.
132         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
133         Sized_elf_reloc_mapper.
134         (Sized_dwarf_line_info::symbol_section): Remove function.
135         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
136         (Sized_dwarf_line_info::read_line_mappings): Remove object
137         parameter, adjust callers.
138         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
139         * dwarf_reader.h: Include <sys/types.h>.
140         (class Track_relocs): Remove forward declaration.
141         (class Elf_reloc_mapper): New class.
142         (class Sized_elf_reloc_mapper): New class.
143         (class Dwarf_abbrev_table): New class.
144         (class Dwarf_range_list): New class.
145         (class Dwarf_ranges_table): New class.
146         (class Dwarf_pubnames_table): New class.
147         (class Dwarf_die): New class.
148         (class Dwarf_info_reader): New class.
149         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
150         (Sized_dwarf_line_info::symbol_section): Remove member function.
151         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
152         base class.
153         * gdb-index.cc: New source file.
154         * gdb-index.h: New source file.
155         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
156         and .debug_types sections, call Layout::add_to_gdb_index.
157         (Sized_relobj_incr::do_section_name): Implement.
158         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
159         return type; Implement.
160         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
161         return type.
162         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
163         parameter list and return type.
164         (Sized_incr_dynobj::do_section_contents): Likewise.
165         * layout.cc: Include gdb-index.h.
166         (Layout::Layout): Initialize gdb_index_data_.
167         (Layout::init_fixed_output_section): Check for .gdb_index section.
168         (Layout::add_to_gdb_index): New function. Instantiate.
169         * layout.h: Add forward declaration for class Gdb_index.
170         (Layout::add_to_gdb_index): New member function.
171         (Layout::gdb_index_data_): New data member.
172         * main.cc: Include gdb-index.h.
173         (main): Print statistics for gdb index.
174         * object.cc (Object::section_contents): Move code into
175         do_section_contents.
176         (need_decompressed_section): Check for sections needed when building
177         gdb index.
178         (build_compressed_section_map): Likewise.
179         (Sized_relobj_file::do_read_symbols): Need local symbols when building
180         gdb index.
181         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
182         sections; call Layout::add_to_gdb_index.
183         (Sized_relobj_file::do_decompressed_section_contents): Call
184         do_section_contents directly.
185         * object.h (Object::do_section_contents): Adjust parameter list and
186         return type.
187         (Object::do_decompressed_section_contents): Call do_section_contents
188         directly.
189         (Sized_relobj_file::do_section_contents): Adjust parameter list and
190         return type.
191         * options.h (class General_options): Add --gdb-index option.
192         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
193         list and return type.
194         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
195         * reloc.h (Track_relocs::checkpoint): New function.
196         (Track_relocs::reset): New function.
197
198         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
199         New test cases.
200         * testsuite/Makefile.in: Regenerate.
201         * testsuite/gdb_index_test.cc: New test source file.
202         * testsuite/gdb_index_test_1.sh: New test source file.
203         * testsuite/gdb_index_test_2.sh: New test source file.
204
205 2012-03-19  Doug Kwan  <dougkwan@google.com>
206
207         * arm.cc (Target_arm::do_define_standard_symbols): New method.
208         (Target_arm::do_finalize_sections): Remove code which defines
209         __exidx_start and __exidx_end.  Make symbol table parameter
210         anonymous as it is not used.
211         * gold.cc (queue_middle_tasks): Call target hook to define any
212         target-specific symbols.
213         * target.h (Target::define_standard_symbols): New method.
214         (Target::do_define_standard_symbols): Same.
215         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
216         * testsuite/Makefile.in: Regenerate.
217         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
218         and __exidx_end.
219         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
220         relocations are generated for __exidx_start and __exidx_end.
221
222 2012-03-16  Doug Kwan  <dougkwan@google.com>
223
224         * testsuite/Makefile.am: Disable test initpri3b.
225         * testsuite/Makefile.in: Regenerate.
226
227 2012-03-15  Doug Kwan  <dougkwan@google.com>
228
229         * arm.cc (Target_arm::got_section): Make .got section read-only
230         if -z now is given.
231
232 2012-03-15  Ian Lance Taylor  <iant@google.com>
233
234         PR gold/13850
235         * layout.cc (Layout::make_output_section): Correctly mark
236         SHT_INIT_ARRAY, et. al., as relro.
237
238 2012-03-14  Doug Kwan  <dougkwan@google.com>
239
240         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
241         dynamic relocations for protected symbols in shared objects.
242
243 2012-03-13  Ian Lance Taylor  <iant@google.com>
244
245         * resolve.cc (Symbol_table::resolve): When merging common symbols,
246         keep the larger alignment.
247
248 2012-03-12  Cary Coutant  <ccoutant@google.com>
249
250         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
251         handling of DW_LNE_define_file.
252
253 2012-03-12  Cary Coutant  <ccoutant@google.com>
254
255         * reduced_debug_output.cc
256         (Output_reduced_debug_info_section::get_die_end): Add new FORM
257         codes to switch.
258
259 2012-02-29  Cary Coutant  <ccoutant@google.com>
260
261         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
262
263 2012-02-29  Cary Coutant  <ccoutant@google.com>
264
265         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
266         Call Object::decompressed_section_contents.
267         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
268         New dtor.
269         (Sized_dwarf_line_info::buffer_start_): New data member.
270         * merge.cc (Output_merge_data::do_add_input_section): Call
271         Object::decompressed_section_contents.
272         (Output_merge_string::do_add_input_section): Likewise.
273         * object.cc (need_decompressed_section): New function.
274         (build_compressed_section_map): Decompress sections needed later.
275         (Sized_relobj_file::do_decompressed_section_contents): New function.
276         (Sized_relobj_file::do_discard_decompressed_sections): New function.
277         * object.h (Object::decompressed_section_contents): New function.
278         (Object::discard_decompressed_sections): New function.
279         (Object::do_decompressed_section_contents): New function.
280         (Object::do_discard_decompressed_sections): New function.
281         (Compressed_section_info): New type.
282         (Compressed_section_map): Include decompressed section contents.
283         (Sized_relobj_file::do_decompressed_section_contents): New function.
284         (Sized_relobj_file::do_discard_decompressed_sections): New function.
285
286 2012-02-16  Cary Coutant  <ccoutant@google.com>
287
288         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
289         * testsuite/Makefile.in: Regenerate.
290
291 2012-02-14  Cary Coutant  <ccoutant@google.com>
292
293         * options.cc (General_options::finalize): Disallow -pie and -static.
294
295 2012-02-03  Doug Kwan  <dougkwan@google.com>
296
297         * arm.cc (Arm_relocate_functions::abs8,
298         Arm_relocate_functions::abs16): Use
299         Bits::has_signed_unsigned_overflow32.
300         (Arm_relocate_functions::thm_abs8): Correct range of
301         overflow check.
302         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
303         in assertions.
304
305 2012-02-02  Doug Kwan  <dougkwan@google.com>
306
307         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
308         position independent outputs, not just shared objects.
309
310 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
311
312         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
313         * configure: Regenerated.
314
315 2012-01-27  Ian Lance Taylor  <iant@google.com>
316
317         * reloc.h (Bits): New class with static functions, copied from
318         namespace utils in arm.cc.
319         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
320         instead.
321
322 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
323
324         * incremental.cc (write_info_blocks): Correct relocation offset.
325
326 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
327
328         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
329         (Relocate::tls_gd_to_le): Likewise.
330
331 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
332
333         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
334
335 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
336
337         * configure.ac: Check if -mcmodel=medium works.
338         * configure: Regenerated.
339
340 2012-01-24  Cary Coutant  <ccoutant@google.com>
341
342         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
343         definition and ...
344         (read_unsigned_LEB_128_x): ... this new function.
345         (read_signed_LEB_128): Replaced with inline definition and ...
346         (read_signed_LEB_128_x): ... this new function.
347         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
348         (read_unsigned_LEB_128): Add inline definition.
349         (read_signed_LEB_128_x): New function.
350         (read_signed_LEB_128): Add inline definition.
351         * testsuite/Makefile.am (leb128_unittest): New unit test.
352         * testsuite/Makefile.in: Regenerate.
353         * testsuite/leb128_unittest.cc: New unit test.
354
355 2012-01-23  Ian Lance Taylor  <iant@google.com>
356
357         PR gold/13617
358         * i386.cc (Target_i386::do_code_fill): When using a jmp
359         instruction, pad with nop instructions.
360         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
361
362 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
363
364         * x86_64.cc (gc_process_relocs): Add typename on types used in
365         template.
366         (scan_relocs): Likewise.
367         (relocate_section): Likewise.
368         (apply_relocation): Likewise.
369
370 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
371
372         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
373         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
374         under x32.
375
376 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
377
378         * x86_64.cc: Initial support for x32.
379
380 2012-01-03  Cary Coutant  <ccoutant@google.com>
381
382         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
383         Use abstract base class for GOT.
384         * gold/output.h (class Output_data_got_base): New abstract base class.
385         (class Output_data_got): Derive from new base class, adjust ctors.
386         (Output_data_got::reserve_slot): Make virtual; rename to
387         do_reserve_slot; Adjust callers.
388         * gold/target.h (Sized_target::init_got_plt_for_update): Return
389         pointer to abstract base class.
390         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
391
392 2011-12-18  Ian Lance Taylor  <iant@google.com>
393
394         * object.h (Relobj::local_symbol_value): New function.
395         (Relobj::local_plt_offset): New function.
396         (Relobj::local_has_got_offset): New function.
397         (Relobj::local_got_offset): New function.
398         (Relobj::set_local_got_offset): New function.
399         (Relobj::do_local_symbol_value): New pure virtual function.
400         (Relobj::do_local_plt_offset): Likewise.
401         (Relobj::do_local_has_got_offset): Likewise.
402         (Relobj::do_local_got_offset): Likewise.
403         (Relobj::do_set_local_got_offset): Likewise.
404         (Sized_relobj::do_local_has_got_offset): Rename from
405         local_has_got_offset.
406         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
407         (Sized_relobj::do_set_local_got_offset): Rename from
408         set_local_got_offset.
409         (Sized_relobj_file::do_local_plt_offset): Rename from
410         local_plt_offset.
411         (Sized_relobj_file::do_local_symbol_value): New function.
412         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
413         local_plt_offset.
414         * output.cc (Output_data_got::Got_entry::write): Change object to
415         Relobj.  Use local_symbol_value.
416         (Output_data_got::add_global_with_rel): Change rel_dyn to
417         Output_data_reloc_generic*.  Use add_global_generic.
418         (Output_data_got::add_global_with_rela): Remove.  Change all
419         callers to use add_global_with_rel.
420         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
421         Output_data_reloc_generic*.  Use add_global_generic.
422         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
423         callers to use add_global_pair_with_rel.
424         (Output_data_got::add_local): Change object to Relobj*.
425         (Output_data_got::add_local_plt): Likewise.
426         (Output_data_got::add_local_with_rel): Change object to Relobj*,
427         change rel_dyn to Output_data_reloc_generic*.  Use
428         add_local_generic.
429         (Output_data_got::add_local_with_rela): Remove.  Change all
430         callers to use all_local_with_rel.
431         (Output_data_got::add_local_pair_with_rel): Change object to
432         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
433         add_output_section_generic.
434         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
435         callers to use add_local_pair_with_rel.
436         (Output_data_got::reserve_local): Change object to Relobj*.
437         * output.h: (class Output_data_reloc_generic): Add pure virtual
438         declarations for add_global_generic, add_local_generic,
439         add_output_section_generic.
440         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
441         functions for Output_data_reloc_generic.  Update declarations for
442         changes listed in output.cc.
443         (class Output_data_got): Change template parameter to got_size.
444         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
445         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
446         function.
447         (Sized_relobj_incr::do_local_plt_offset): New function.
448         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
449         add_global_generic.
450
451 2011-12-17  Cary Coutant  <ccoutant@google.com>
452
453         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
454         * resolve.cc (Symbol_table::resolve): Likewise.
455         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
456         arrays.
457         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
458
459 2011-12-16  Ian Lance Taylor  <iant@google.com>
460
461         * output.h (Output_data_reloc_generic::add): Only call
462         add_dynamic_reloc if this is a dynamic reloc section.
463
464 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
465
466         PR gold/13505
467         * target-reloc.h (apply_relocation): Replace <64, false> with
468         <size, big_endian>.
469
470 2011-11-25  Nick Clifton  <nickc@redhat.com>
471
472         * po/it.po: New Italian translation.
473
474 2011-11-17  Sterling Augustine  <saugustine@google.com>
475
476         * script.cc (script_include_directive): Implement.
477         (read_script_file): New local variables name and search_path. Update
478         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
479         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
480         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
481
482 2011-11-11  Sterling Augustine  <saugustine@google.com>
483
484         * yyscript.y (section_cmd): Add support for INCLUDE directive.
485         (file_or_sections_cmd): Likewise.
486
487 2011-11-11  Doug Kwan  <dougkwan@google.com>
488
489         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
490         if --just-symbols is given.
491
492 2011-11-10  Doug Kwan  <dougkwan@google.com>
493
494         PR gold/13362
495         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
496         when processing data relocs.
497         * reloc.h (Relocate_functions::rel_unaligned): New method.
498         (Relocate_functions::pcrel_unaligned): Ditto.
499         (Relocate_functions::rel32_unaligned): Ditto.
500         (Relocate_functions::pcrel32_unaligned): Ditto.
501
502 2011-11-09  Doug Kwan  <dougkwan@google.com>
503
504         PR gold/13362
505         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
506         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
507         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
508         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
509         (Relocate_functions::rel_unaligned): New.
510         (Relocate_functions::rel32_unaligned): New.
511         * target-reloc.h (relocate_for_relocatable): Add code to handle
512         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
513         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
514         arm_unaligned_reloc_r): New targets.
515         * testsuite/Makefile.in: Regenerate.
516         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
517         linking.
518
519 2011-11-02  Ian Lance Taylor  <iant@google.com>
520
521         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
522         NATIVE_LINKER.
523         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
524         * options.cc (General_options::finalize): Use library search path
525         from configure script if specified.  If not native and no sysroot,
526         only search TOOLLIBDIR.
527         * options.h (Search_directory::Search_directory): Change name to
528         const std::string&.
529         (General_options::add_to_library_path_with_sysroot): Change arg to
530         const std::string&.
531         * configure, Makefile.in, config.in: Rebuild.
532
533 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
534
535         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
536         we are working around the ARM1176 Erratum.
537         * options.h (General_options::fix_arm1176): Add option.
538         * testsuite/Makefile.am: Add testcases, and keep current ones
539         working.
540         * testsuite/Makefile.in: Regenerate.
541         * testsuite/arm_fix_1176.s: New file.
542         * testsuite/arm_fix_1176.sh: Likewise.
543
544 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
545
546         * arm.cc (Target_arm::Target_arm): Remove initialisation of
547         may_use_blx_.
548         (Target_arm::may_use_blx): Remove method.
549         (Target_arm::set_may_use_blx): Likewise.
550         (Target_arm::may_use_v4t_interworking): New method.
551         (Target_arm::may_use_v5t_interworking): Likewise.
552         (Target_arm::may_use_blx_): Remove member variable.
553         (Arm_relocate_functions::arm_branch_common): Check for v5T
554         interworking.
555         (Arm_relocate_functions::thumb_branch_common): Likewise.
556         (Reloc_stub::stub_type_for_reloc): Likewise.
557         (Target_arm::do_finalize_sections): Correct interworking checks.
558         * testsuite/Makefile.am: Add new tests.
559         * testsuite/Makefile.in: Regenerate.
560         * testsuite/arm_farcall_arm_arm.s: New test.
561         * testsuite/arm_farcall_arm_arm.sh: Likewise.
562         * testsuite/arm_farcall_arm_thumb.s: Likewise.
563         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
564         * testsuite/arm_farcall_thumb_arm.s: Likewise.
565         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
566         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
567         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
568
569 2011-10-31  Cary Coutant  <ccoutant@google.com>
570
571         PR gold/13023
572         * expression.cc (Expression::eval_with_dot): Add
573         is_section_dot_assignment parameter.
574         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
575         absolute and assigning to dot within a section.
576         * script-sections.cc
577         (Output_section_element_assignment::set_section_addresses): Pass
578         dot_section to set_if_absolute.
579         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
580         as is_section_dot_assignment flag to eval_with_dot.
581         (Output_section_element_dot_assignment::set_section_addresses):
582         Likewise.
583         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
584         parameter.  Also set value if relative to dot_section; set the
585         symbol's output_section.
586         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
587         parameter.  Adjust all callers.
588         (Expression::eval_maybe_dot): Likewise.
589         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
590         Adjust all callers.
591         * testsuite/script_test_2.t: Test assignment of an absolute value
592         to dot within an output section element.
593
594 2011-10-31  Cary Coutant  <ccoutant@google.com>
595
596         * options.h (class General_options): Add --[no-]gnu-unique options.
597         * symtab.cc (Symbol_table::sized_write_globals): Convert
598         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
599
600 2011-10-31  Cary Coutant  <ccoutant@google.com>
601
602         PR gold/13359
603         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
604         unnecessary assertion.
605         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
606
607 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
608
609         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
610         gc_mark_symbol.
611         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
612         gc_mark_symbol.
613         Change to just keep the section associated with symbol.
614         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
615         they are externally visible and --export-dynamic is turned on.
616         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
617
618 2011-10-19  Ian Lance Taylor  <iant@google.com>
619
620         PR gold/13163
621         * script-sections.cc
622         (Output_section_element_dot_assignment::needs_output_section): New
623         function.
624
625 2011-10-19  Ian Lance Taylor  <iant@google.com>
626
627         PR gold/13204
628         * layout.cc (Layout::segment_precedes): Don't assert failure if a
629         --section-start option was seen.
630         * options.h (General_options::any_section_start): New function.
631
632 2011-10-18  David S. Miller  <davem@davemloft.net>
633
634         PR binutils/13301
635         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
636         member to track relocation locations that have moved during TLS
637         reloc optimizations.
638         (Target_sparc::Relocate::Relocate): Initialize to NULL.
639         (Target_sparc::Relocate::relocate): Adjust view down by 4
640         bytes if it matches reloc_adjust_addr_.
641         (Target_sparc::Relocate::relocate_tls): Always move the
642         __tls_get_addr call delay slot instruction forward 4 bytes when
643         performing relaxation.
644
645 2011-10-18  Cary Coutant  <ccoutant@google.com>
646
647         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
648         (Output_file::map_no_anonymous): Check for non-zero
649         return code from posix_fallocate.
650
651 2011-10-17  Cary Coutant  <ccoutant@google.com>
652
653         PR gold/13245
654         * plugin.cc (is_visible_from_outside): Check for symbols
655         referenced from dynamic objects.
656         * resolve.cc (Symbol_table::resolve): Don't count references
657         from dynamic objects as references from real ELF files.
658         * testsuite/plugin_test_2.sh: Adjust expected result.
659
660 2011-10-17  Cary Coutant  <ccoutant@google.com>
661
662         * gold.cc: Include timer.h.
663         (queue_middle_tasks): Stamp time.
664         (queue_final_tasks): Likewise.
665         * main.cc (main): Store timer in parameters.  Print timers
666         for each pass.
667         * parameters.cc (Parameters::Parameters): Initialize timer_.
668         (Parameters::set_timer): New function.
669         (set_parameters_timer): New function.
670         * parameters.h (Parameters::set_timer): New function.
671         (Parameters::timer): New function.
672         (Parameters::timer_): New data member.
673         (set_parameters_timer): New function.
674         * timer.cc (Timer::stamp): New function.
675         (Timer::get_pass_time): New function.
676         * timer.h (Timer::stamp): New function.
677         (Timer::get_pass_time): New function.
678         (Timer::pass_times_): New data member.
679
680 2011-10-17  Cary Coutant  <ccoutant@google.com>
681
682         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
683         task for members of lib groups.
684
685 2011-10-17  Cary Coutant  <ccoutant@google.com>
686
687         PR gold/13288
688         * fileread.cc (File_read::find_view): Add assert.
689         (File_read::make_view): Move bounds check (replace with assert)...
690         (File_read::find_or_make_view): ... to here.
691
692 2011-10-12  Cary Coutant  <ccoutant@google.com>
693
694         * output.cc (Output_file::open_base_file): Handle case where
695         ::read returns less than requested size.
696
697 2011-10-10  Cary Coutant  <ccoutant@google.com>
698
699         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
700         Initialize defined_count_.
701         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
702         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
703         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
704         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
705         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
706         * incremental.h (Sized_relobj_incr::defined_count_): New data
707         member.
708         (Sized_incr_dynobj::defined_count_): New data member.
709         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
710         Return zeroes instead of internal error.
711
712 2011-10-10  Cary Coutant  <ccoutant@google.com>
713
714         PR gold/13249
715         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
716         (Output_reloc::symbol_value): Return PLT offset if flag is set.
717         * output.h (class Output_reloc): Add use_plt_offset flag.
718         (Output_reloc::type_): Adjust size of bit field.
719         (Output_reloc::use_plt_offset_): New bit field.
720         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
721         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
722         flag.  Adjust all callers.
723         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
724         creating RELATIVE relocations.
725
726 2011-10-10  Nick Clifton  <nickc@redhat.com>
727
728         * po/es.po: Updated Spanish translation.
729         * po/fi.po: Updated Finnish translation.
730
731 2011-10-03   Diego Novillo  <dnovillo@google.com>
732
733         * options.cc (parse_uint): Fix dereference of RETVAL.
734
735 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
736
737         * layout.h (section_order_map_): New member.
738         (get_section_order_map): New member function.
739         * output.cc (Output_section::add_input_section): Check for patterns
740         only when --section-ordering-file is specified.
741         * gold.cc (queue_middle_tasks): Delay updating order of sections till
742         output_sections have been formed.
743         * layout.cc (Layout_Layout): Initialize section_order_map_.
744         * plugin.cc (update_section_order): Store order in order_map. Do not
745         update the order.
746         * testsuite/Makefile.am: Add test case for plugin_final_layout.
747         * testsuite/Makefile.in: Regenerate.
748         * testsuite/plugin_section_order.c: New file.
749         * testsuite/plugin_final_layout.cc: New file.
750         * testsuite/plugin_final_layout.sh: New file.
751
752 2011-09-29  Cary Coutant  <ccoutant@google.com>
753
754         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
755         Check for NULL.
756         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
757         symbols during incremental update.
758         (Symbol_table::add_from_dynobj): Likewise.
759
760 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
761             Ian Lance Taylor  <iant@google.com>
762
763         * symtab.cc (Symbol_table::define_special_symbol): Always
764         canonicalize version string.
765
766 2011-09-26  Cary Coutant  <ccoutant@google.com>
767
768         * gold.cc (queue_initial_tasks): Move option checks ...
769         * options.cc (General_options::finalize): ... to here. Disable
770         some options; make others fatal.
771
772 2011-09-26  Cary Coutant  <ccoutant@google.com>
773
774         gcc PR lto/47247
775         * plugin.cc (get_symbols_v2): New function.
776         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
777         (is_referenced_from_outside): New function.
778         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
779         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
780         (get_symbols): Pass version parameter.
781         (get_symbols_v2): New function.
782         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
783         parameter.
784         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
785         (onload): Add LDPT_GET_SYMBOLS_V2.
786         (all_symbols_read_hook): Use get_symbols_v2; check for
787         LDPR_PREVAILING_DEF_IRONLY_EXP.
788         * testsuite/plugin_test_3.sh: Update expected results.
789
790 2011-09-23  Simon Baldwin  <simonb@google.com>
791
792         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
793         configuration options.
794         * configure: Regenerate.
795         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
796         * Makefile.in: Regenerate.
797         * testsuite/Makefile.in: Regenerate.
798
799 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
800
801         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
802
803 2011-09-19  Cary Coutant  <ccoutant@google.com>
804
805         * incremental.cc (can_incremental_update): Fix typo in comment.
806         * incremental.h (can_incremental_update): Likewise.
807
808 2011-09-18  Cary Coutant  <ccoutant@google.com>
809
810         * incremental.cc (can_incremental_update): New function.
811         * incremental.h (can_incremental_update): New function.
812         * layout.cc (Layout::init_fixed_output_section): Call it.
813         (Layout::make_output_section): Don't allow patch space in .eh_frame.
814         * object.cc (Sized_relobj_file::do_layout): Call
815         can_incremental_update.
816
817 2011-09-13  Cary Coutant  <ccoutant@google.com>
818
819         * configure.ac: Check for glibc support for gnu_indirect_function
820         support with static linking, setting automake conditional
821         IFUNC_STATIC.
822         * Makefile.in: Regenerate.
823         * configure: Regenerate.
824
825         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
826         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
827         for IFUNC_STATIC.
828         * testsuite/Makefile.in: Regenerate.
829
830 2011-09-13  Cary Coutant  <ccoutant@google.com>
831
832         * incremental.cc (Sized_relobj_incr::do_layout): Call
833         report_comdat_group for kept comdat sections.
834         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
835         * testsuite/Makefile.in: Regenerate.
836         * testsuite/incr_comdat_test_1.cc: New source file.
837         * testsuite/incr_comdat_test_2_v1.cc: New source file.
838         * testsuite/incr_comdat_test_2_v2.cc: New source file.
839         * testsuite/incr_comdat_test_2_v3.cc: New source file.
840
841 2011-09-13  Ian Lance Taylor  <iant@google.com>
842
843         * object.cc (Sized_relobj_file::do_layout): Remove unused local
844         variable external_symbols_offset.
845
846 2011-09-12  Ian Lance Taylor  <iant@google.com>
847
848         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
849         triggered if object has no symbols.
850
851 2011-09-09  David S. Miller  <davem@davemloft.net>
852
853         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
854         (Output_fill_debug_line::do_write): Likewise.
855
856 2011-08-29  Cary Coutant  <ccoutant@google.com>
857
858         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
859         casts to match formatting specs.
860         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
861
862 2011-08-26  Cary Coutant  <ccoutant@google.com>
863
864         * layout.cc (Free_list::allocate): Provide guarantee of minimum
865         remaining hole size when allocating.
866         (Layout::make_output_section): Set fill methods for debug sections.
867         * layout.h (Free_list::Free_list_node): Move from private to
868         public.
869         (Free_list::set_min_hole_size): New function.
870         (Free_list::begin, Free_list::end): New functions.
871         (Free_list::min_hole_): New data member.
872         * output.cc: Include dwarf.h.
873         (Output_fill_debug_info::do_minimum_hole_size): New function.
874         (Output_fill_debug_info::do_write): New function.
875         (Output_fill_debug_line::do_minimum_hole_size): New function.
876         (Output_fill_debug_line::do_write): New function.
877         (Output_section::Output_section): Initialize new data member.
878         (Output_section::set_final_data_size): Ensure patch space is larger
879         than minimum hole size.
880         (Output_section::do_write): Fill holes in debug sections.
881         * output.h (Output_fill): New class.
882         (Output_fill_debug_info): New class.
883         (Output_fill_debug_line): New class.
884         (Output_section::set_free_space_fill): New function.
885         (Output_section::free_space_fill_): New data member.
886         * testsuite/Makefile.am (incremental_test_3): Add
887         --incremental-patch option.
888         (incremental_test_4): Likewise.
889         (incremental_test_5): Likewise.
890         (incremental_test_6): Likewise.
891         (incremental_copy_test): Likewise.
892         (incremental_common_test_1): Likewise.
893         * testsuite/Makefile.in: Regenerate.
894
895 2011-08-26  Nick Clifton  <nickc@redhat.com>
896
897         * po/es.po: Updated Spanish translation.
898
899 2011-08-01  Cary Coutant  <ccoutant@google.com>
900
901         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
902         * gold/testsuite/Makefile.in: Regenerate.
903         * gold/testsuite/justsyms_exec.c: New source file.
904         * gold/testsuite/justsyms_lib.c: New source file.
905
906 2011-08-01  Cary Coutant  <ccoutant@google.com>
907
908         * layout.cc (Layout::set_segment_offsets): Don't realign text
909         segment if -Ttext was specified.
910         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
911         file type.
912         * object.h (Sized_relobj_file::e_type): New function.
913         (Sized_relobj_file::e_type_): New data member.
914         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
915         base address for ET_EXEC files.
916         * target.cc (Target::do_make_elf_object_implementation): Allow
917         ET_EXEC files with --just-symbols option.
918
919 2011-07-28  Cary Coutant  <ccoutant@google.com>
920
921         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
922         Add thread_number parameter.
923         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
924         * workqueue-threads.cc
925         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
926         current thread if its thread number is greater than desired thread
927         count.
928         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
929         Add thread_number parameter.
930         (Workqueue::should_cancel_thread): Likewise.
931         (Workqueue::find_runnable_or_wait): Pass thread_number to
932         should_cancel_thread.
933         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
934         parameter.
935
936 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
937
938         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
939         only after checking if it cannot be forced local.
940         * symtab.h (is_externally_visible): Check if the symbol is not forced
941         local.
942
943 2011-07-15  Ian Lance Taylor  <iant@google.com>
944
945         * options.h (class General_options): Add --print-output-format.
946         Move -EL next to -EB, for  better --help output.
947         * target-select.cc: Include <cstdio>, "options.h", and
948         "parameters.h".
949         (Target_selector::do_target_bfd_name): New function.
950         (print_output_format): New function.
951         * target-select.h (class Target_selector): Update declarations.
952         (Target_selector::target_bfd_name): New function.
953         (print_output_format): Declare.
954         * main.cc: Include "target-select.h".
955         (main): Handle --print-output-format.
956         * gold.cc: Include "target-select.h".
957         (queue_initial_tasks): Handle --print-output-format when there are
958         no input files.
959         * parameters.cc (parameters_force_valid_target): Give a better
960         error message if -EB/-EL does not match target.
961         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
962         function.
963
964 2011-07-15  Ian Lance Taylor  <iant@google.com>
965
966         * i386.cc (class Output_data_plt_i386): Add layout_ field.
967         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
968         (Output_data_plt_i386::do_write): Write address of .dynamic
969         section to first entry in .got.plt section.
970         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
971         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
972         Initialize layout_.
973         (Output_data_plt_x86_64::do_write): Write address of .dynamic
974         section to first entry in .got.plt section.
975         * layout.h (Layout::dynamic_section): New function.
976
977 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
978
979         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
980         to claim_file call.
981         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
982         input_section_position_, and input_section_glob_.
983         (read_layout_from_file): Call function section_ordering_specified.
984         * layout.h (is_section_ordering_specified): New function.
985         (section_ordering_specified): New function.
986         (section_ordering_specified_): New boolean member.
987         * main.cc(main): Call load_plugins after layout object is defined.
988         * output.cc (Output_section::add_input_section): Use
989         function section_ordering_specified to check if section ordering is
990         needed.
991         * output.cc (Output_section::add_relaxed_input_section): Use
992         function section_ordering_specified to check if section ordering is
993         needed.
994         (Output_section::update_section_layout): New function.
995         (Output_section::sort_attached_input_sections): Check if input section
996         must be reordered.
997         * output.h (Output_section::update_section_layout): New function.
998         * plugin.cc (get_section_count): New function.
999         (get_section_type): New function.
1000         (get_section_name): New function.
1001         (get_section_contents): New function.
1002         (update_section_order): New function.
1003         (allow_section_ordering): New function.
1004         (Plugin::load): Add the new interfaces to the transfer vector.
1005         (Plugin_manager::load_plugins): New parameter.
1006         (Plugin_manager::all_symbols_read): New parameter.
1007         (Plugin_manager::claim_file): New parameter. Save the elf object for
1008         unclaimed objects.
1009         (Plugin_manager::get_elf_object): New function.
1010         (Plugin_manager::get_view): Change to directly use the bool to check
1011         if get_view is called from claim_file_hook.
1012         * plugin.h (input_objects): New function
1013         (Plugin__manager::load_plugins): New parameter.
1014         (Plugin_manager::claim_file): New parameter.
1015         (Plugin_manager::get_elf_object): New function.
1016         (Plugin_manager::in_claim_file_handler): New function.
1017         (Plugin_manager::in_claim_file_handler_): New member.
1018         (layout): New function.
1019         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1020         handler with an extra parameter. Make the elf object before calling
1021         claim_file handler.
1022         * testsuite/plugin_test.c (get_section_count): New function pointer.
1023         (get_section_type): New function pointer.
1024         (get_section_name): New function pointer.
1025         (get_section_contents): New function pointer.
1026         (update_section_order): New function pointer.
1027         (allow_section_ordering): New function pointer.
1028         (onload): Check if the new interfaces exist.
1029
1030 2011-07-13  Ian Lance Taylor  <iant@google.com>
1031
1032         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1033         relro section.
1034         * x86_64.cc (Target_x86_64::got_section): Likewise.
1035         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1036         (relro_now_test_SOURCES): New variable.
1037         (relro_now_test_DEPENDENCIES): New variable.
1038         (relro_now_test_LDFLAGS): New variable.
1039         (relro_now_test_LDADD): New variable.
1040         (relro_now_test.so): New target.
1041         * testsuite/Makefile.in: Rebuild.
1042
1043 2011-07-12  Ian Lance Taylor  <iant@google.com>
1044
1045         PR gold/12980
1046         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1047         GLOB_DAT relocation rather than a RELATIVE relocation for a
1048         protected symbol when creating a shared library.
1049         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1050         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1051         * testsuite/protected_main_1.cc (main): Test that protected
1052         function has same address.
1053
1054 2011-07-11  Ian Lance Taylor  <iant@google.com>
1055
1056         PR gold/12979
1057         * options.h (class General_options): Add -Bgroup.
1058         * options.cc (General_options::finalize): If -Bgroup is set,
1059         default to --unresolved-symbols=report-all.
1060         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1061         * target-reloc.h (issue_undefined_symbol_error): Handle
1062         --unresolved-symbols=report-all.
1063
1064 2011-07-08  Ian Lance Taylor  <iant@google.com>
1065
1066         PR gold/11985
1067         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1068         if linker script discards key sections.
1069         (Layout::create_dynamic_symtab): Likewise.
1070         (Layout::assign_local_dynsym_offsets): Likewise.
1071         (Layout::sized_create_version_sections): Likewise.
1072         (Layout::create_interp): Likewise.
1073         (Layout::finish_dynamic_section): Likewise.
1074         (Layout::set_dynamic_symbol_size): Likewise.
1075
1076 2011-07-08  Ian Lance Taylor  <iant@google.com>
1077
1078         PR gold/12386
1079         * options.h (class General_options): Add --unresolved-symbols.
1080         * target-reloc.h (issue_undefined_symbol_error): Check
1081         --unresolved-symbols.  Add comments.
1082
1083 2011-07-08  Ian Lance Taylor  <iant@google.com>
1084
1085         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1086         expression more complex.
1087
1088 2011-07-08  Ian Lance Taylor  <iant@google.com>
1089
1090         PR gold/11317
1091         * target-reloc.h (issue_undefined_symbol_error): New inline
1092         function, broken out of relocate_section.
1093         (relocate_section): Call issue_undefined_symbol_error.
1094         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1095         there is no TLS segment if we are about to issue an undefined
1096         symbol error.
1097         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1098
1099 2011-07-08  Ian Lance Taylor  <iant@google.com>
1100
1101         PR gold/12279
1102         * resolve.cc (Symbol_table::should_override): Add fromtype
1103         parameter.  Change all callers.  Give error when linking together
1104         TLS and non-TLS symbol.
1105         (Symbol_table::should_override_with_special): Add fromtype
1106         parameter.  Change all callers.
1107         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1108         there is no TLS segment if we have reported some errors.
1109         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1110
1111 2011-07-08  Ian Lance Taylor  <iant@google.com>
1112
1113         PR gold/12372
1114         * target.h (Target::plt_address_for_global): New function.
1115         (Target::plt_address_for_local): New function.
1116         (Target::plt_section_for_global): Remove.
1117         (Target::plt_section_for_local): Remove.
1118         (Target::do_plt_address_for_global): New virtual function.
1119         (Target::do_plt_address_for_local): New virtual function.
1120         (Target::do_plt_section_for_global): Remove.
1121         (Target::do_plt_section_for_local): Remove.
1122         (Target::register_global_plt_entry): Add Symbol_table and Layout
1123         parameters.
1124         * output.cc (Output_data_got::Got_entry::write): Use
1125         plt_address_for_global and plt_address_for_local.
1126         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1127         address of output section.
1128         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1129         got_irelative_, and irelative_count_ fields.  Update
1130         declarations.
1131         (Output_data_plt_i386::has_irelative_section): New function.
1132         (Output_data_plt_i386::entry_count): Add irelative_count_.
1133         (Output_data_plt_i386::set_final_data_size): Likewise.
1134         (class Target_i386): Add got_irelative_ and rel_irelative_
1135         fields.  Update declarations.
1136         (Target_i386::Target_i386): Initialize new fields.
1137         (Target_i386::do_plt_address_for_global): New function replacing
1138         do_plt_section_for_global.
1139         (Target_i386::do_plt_address_for_local): New function replacing
1140         do_plt_section_for_local.
1141         (Target_i386::got_section): Create got_irelative_.
1142         (Target_i386::rel_irelative_section): New function.
1143         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1144         fields.  Don't define __rel_iplt_{start,end}.
1145         (Output_data_plt_i386::add_entry): Add symtab and layout
1146         parameters.  Change all callers.  Use different PLT and GOT for
1147         IFUNC symbols.
1148         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1149         layout parameters.  Change all callers.  Use different PLT and
1150         GOT.
1151         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1152         (Output_data_plt_i386::rel_irelative): New function.
1153         (Output_data_plt_i386::address_for_global): New function.
1154         (Output_data_plt_i386::address_for_local): New function.
1155         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1156         IRELATIVE GOT when changing IFUNC GOT entries.
1157         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1158         reloc.
1159         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1160         if we didn't create an IRELATIVE GOT.
1161         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1162         plt_address_for_local.
1163         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1164         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1165         got_irelative_, and irelative_count_ fields.  Update
1166         declarations.
1167         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1168         Initialize new fields.  Remove symtab parameter.  Change all
1169         callers.
1170         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1171         irelative_count_.
1172         (Output_data_plt_x86_64::has_irelative_section): New function.
1173         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1174         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1175         fields.  Update declarations.
1176         (Target_x86_64::Target_x86_64): Initialize new fields.
1177         (Target_x86_64::do_plt_address_for_global): New function replacing
1178         do_plt_section_for_global.
1179         (Target_x86_64::do_plt_address_for_local): New function replacing
1180         do_plt_section_for_local.
1181         (Target_x86_64::got_section): Create got_irelative_.
1182         (Target_x86_64::rela_irelative_section): New function.
1183         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1184         all callers.  Don't create __rel_iplt_{start,end}.
1185         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1186         parameters.  Change all callers.  Use different PLT and GOT for
1187         IFUNC symbols.
1188         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1189         layout parameters.  Change all callers.  Use different PLT and
1190         GOT.
1191         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1192         parameters.  Change all callers.  Use different PLT and GOT for
1193         IFUNC symbols.
1194         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1195         (Output_data_plt_x86_64::rela_irelative): New function.
1196         (Output_data_plt_x86_64::address_for_global): New function.
1197         (Output_data_plt_x86_64::address_for_local): New function.
1198         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1199         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1200         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1201         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1202         parameters.
1203         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1204         reloc.
1205         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1206         symbols if we didn't create an IRELATIVE GOT.
1207         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1208         plt_address_for_local.
1209         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1210         * testsuite/ifuncvar1.c: New test file.
1211         * testsuite/ifuncvar2.c: New test file.
1212         * testsuite/ifuncvar3.c: New test file.
1213         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1214         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1215         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1216         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1217         * testsuite/Makefile.in: Rebuild.
1218
1219 2011-07-07  Cary Coutant  <ccoutant@google.com>
1220
1221         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1222         (two_file_test_1_ndebug.o): Likewise.
1223         (two_file_test_1b_ndebug.o): Likewise.
1224         (two_file_test_2_ndebug.o): Likewise.
1225         (two_file_test_main_ndebug.o): Likewise.
1226         (incremental_test_2): Link with no-debug versions.
1227
1228 2011-07-06  Cary Coutant  <ccoutant@google.com>
1229
1230         * gold/incremental.cc
1231         (Output_section_incremental_inputs::write_info_blocks): Check for
1232         hidden and internal symbols.
1233
1234 2011-07-06  Cary Coutant  <ccoutant@google.com>
1235
1236         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1237         Check disposition for startup file.
1238         (Incremental_inputs::report_command_line): Ignore
1239         --incremental-startup-unchanged option.
1240         * options.cc (General_options::parse_incremental_startup_unchanged):
1241         New function.
1242         (General_options::General_options): Initialize new data member.
1243         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1244         (General_options): Add --incremental-startup-unchanged option.
1245         (General_options::incremental_startup_disposition): New function.
1246         (General_options::incremental_startup_disposition_): New data member.
1247
1248 2011-07-06  Cary Coutant  <ccoutant@google.com>
1249
1250         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1251         input file index to Script_info ctor.
1252         (Sized_incremental_binary::do_file_has_changed): Find the
1253         command-line argument for files named in scripts.
1254         * incremental.h (Script_info::Script_info): New ctor
1255         with input file index.
1256         (Script_info::input_file_index): New function.
1257         (Script_info::input_file_index_): New data member.
1258         (Incremental_binary::get_library): Add const.
1259         (Incremental_binary::get_script_info): Add const.
1260         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1261         * testsuite/Makefile.am (incremental_test_5): New test case.
1262         (incremental_test_6): New test case.
1263         * testsuite/Makefile.in: Regenerate.
1264
1265 2011-07-06  Cary Coutant  <ccoutant@google.com>
1266
1267         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1268         debug output when command lines differ.
1269
1270 2011-07-06  Cary Coutant  <ccoutant@google.com>
1271
1272         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1273         --incremental-patch option.
1274         * layout.cc (Free_list::allocate): Extend allocation beyond original
1275         end if enabled.
1276         (Layout::make_output_section): Mark sections that should get
1277         patch space.
1278         * options.cc (parse_percent): New function.
1279         * options.h (parse_percent): New function.
1280         (DEFINE_percent): New macro.
1281         (General_options): Add --incremental-patch option.
1282         * output.cc (Output_section::Output_section): Initialize new data
1283         members.
1284         (Output_section::add_input_section): Print section name when out
1285         of patch space.
1286         (Output_section::add_output_section_data): Likewise.
1287         (Output_section::set_final_data_size): Add patch space when
1288         doing --incremental-full.
1289         (Output_section::do_reset_address_and_file_offset): Remove patch
1290         space.
1291         (Output_segment::set_section_list_addresses): Print debug output
1292         only if --incremental-update.
1293         * output.h (Output_section::set_is_patch_space_allowed): New function.
1294         (Output_section::is_patch_space_allowed_): New data member.
1295         (Output_section::patch_space_): New data member.
1296         * parameters.cc (Parameters::incremental_full): New function.
1297         * parameters.h (Parameters::incremental_full): New function
1298         * testsuite/Makefile.am (incremental_test_2): Add test for
1299         --incremental-patch option.
1300         * testsuite/Makefile.in: Regenerate.
1301         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1302         (t18): Remove function body.
1303
1304 2011-07-05  Doug Kwan  <dougkwan@google.com>
1305
1306         PR gold/12771
1307         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1308         Arm_Address type for relocation result.
1309         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1310         overflow check.
1311         (Arm_relocate_functions::abs32): Use unaligned access.
1312         (Arm_relocate_functions::rel32): Ditto.
1313         (Arm_relocate_functions::prel31): Ditto.
1314         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1315         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1316         static data relocations.
1317         * testsuite/Makefile.in: Regnerate.
1318         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1319
1320 2011-07-05  Ian Lance Taylor  <iant@google.com>
1321
1322         PR gold/12392
1323         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1324         symbols if necessary.
1325         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1326
1327 2011-07-05  Ian Lance Taylor  <iant@google.com>
1328
1329         PR gold/12952
1330         * resolve.cc (Symbol::override_base_with_special): Simply override
1331         version with special symbol version, ignoring previous version.
1332
1333 2011-07-05  Ian Lance Taylor  <iant@google.com>
1334
1335         * object.cc (Sized_relobj_file::include_section_group): Add
1336         information to comment about signature location.
1337
1338 2011-07-02  Ian Lance Taylor  <iant@google.com>
1339
1340         PR gold/12957
1341         * options.h (class General_options): Add -f and -F.
1342         * options.cc (General_options::finalize): Fatal error if -f/-F
1343         are used without -shared.
1344         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1345
1346 2011-07-02  Ian Lance Taylor  <iant@google.com>
1347
1348         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1349
1350 2011-07-01  Ian Lance Taylor  <iant@google.com>
1351
1352         PR gold/12525
1353         PR gold/12952
1354         * resolve.cc (Symbol::override_base_with_special): Don't override
1355         the version if the overriding symbol has a different name.
1356         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1357         all callers.  If we give an error about an undefined version,
1358         define the base version if necessary.
1359         * dynobj.h (class Versions): Update declaration.
1360         * testsuite/weak_alias_test_5.cc: New file.
1361         * testsuite/weak_alias_test.script: New file.
1362         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1363         and versioned_alias have the right value, and call t2.
1364         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1365         weak_alias_test_5.so.
1366         (weak_alias_test_LDADD): Likewise.
1367         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1368         * testsuite/Makefile.in: Rebuild.
1369
1370 2011-07-01  Ian Lance Taylor  <iant@google.com>
1371
1372         PR gold/12525
1373         * options.h (class General_options): Support -z notext.
1374         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1375         -Wl,-z,notext.
1376         (two_file_shared_nonpic.so): Likewise.
1377         (two_file_shared_mixed.so): Likewise.
1378         (two_file_shared_mixed_1.so): Likewise.
1379         (weak_undef_lib_nonpic.so): Likewise.
1380         (alt/weak_undef_lib_nonpic.so): Likewise.
1381         (tls_test_shared_nonpic.so): Likewise.
1382         * testsuite/Makefile.in: Rebuild.
1383
1384 2011-07-01  Ian Lance Taylor  <iant@google.com>
1385
1386         PR gold/12525
1387         * configure.ac: Test whether static linking works, setting
1388         the automake conditional HAVE_STATIC.
1389         * testsuite/Makefile.am: Disable tests using -static if
1390         HAVE_STATIC is not true.
1391         * configure, testsuite/Makefile.in: Rebuild.
1392
1393 2011-07-01  Ian Lance Taylor  <iant@google.com>
1394
1395         PR gold/12525
1396         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1397         Assert if we see DW_EH_PE_indirect.
1398         * target.h (Target::ehframe_datarel_base): New function.
1399         (Target::do_ehframe_datarel_base): New target function.
1400         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1401         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1402         function.
1403
1404 2011-07-01  Ian Lance Taylor  <iant@google.com>
1405
1406         PR gold/12571
1407         * options.h (class General_options): Add
1408         --ld-generated-unwind-info.
1409         * ehframe.cc (Fde::write): Add address parameter.  Change all
1410         callers.  If associated with PLT, fill in address and size.
1411         (Cie::set_output_offset): Only add merge mapping if there is an
1412         object.
1413         (Cie::write): Add address parameter.  Change all callers.
1414         (Eh_frame::add_ehframe_for_plt): New function.
1415         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1416         input_offset_ fields into union u_, with new plt field.
1417         (Fde::Fde): Adjust for new union field.
1418         (Fde::Fde) [Output_data version]: New constructor.
1419         (Fde::add_mapping): Only add merge mapping if there is an object.
1420         (class Cie): Update declarations.
1421         (class Eh_frame): Declare add_ehframe_for_plt.
1422         * layout.cc (Layout::layout_eh_frame): Break out code into
1423         make_eh_frame_section, and call it.
1424         (Layout::make_eh_frame_section): New function.
1425         (Layout::add_eh_frame_for_plt): New function.
1426         * layout.h (class Layout): Update declarations.
1427         * merge.cc (Merge_map::add_mapping): Add assertion.
1428         * i386.cc: Include "dwarf.h".
1429         (class Output_data_plt_i386): Make first_plt_entry,
1430         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1431         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1432         and plt_eh_frame_fde.
1433         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1434         boundary.  Call add_eh_frame_for_plt if appropriate.
1435         * x86_64.cc: Include "dwarf.h".
1436         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1437         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1438         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1439         and plt_eh_frame_fde.
1440         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1441         appropriate.
1442
1443 2011-06-29  Ian Lance Taylor  <iant@google.com>
1444
1445         PR gold/12629
1446         * object.cc (Sized_relobj_file::layout_section): Change shdr
1447         parameter to be const.
1448         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1449         out of do_layout.
1450         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1451         appropriate.  Call layout_eh_frame_section.
1452         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1453         sections.
1454         * object.h (class Sized_relobj_file): Update declarations.
1455
1456 2011-06-29  Ian Lance Taylor  <iant@google.com>
1457
1458         PR gold/12652
1459         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1460         modifier.
1461         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1462
1463 2011-06-29  Ian Lance Taylor  <iant@google.com>
1464
1465         PR gold/12675
1466         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1467         SHT_X86_64_UNWIND.
1468         * layout.cc (Layout::layout_eh_frame): Likewise.
1469
1470 2011-06-29  Ian Lance Taylor  <iant@google.com>
1471
1472         PR gold/12695
1473         * layout.cc (Layout::symtab_section_shndx): New function.
1474         * layout.h (class Layout): Declare symtab_section_shndx.
1475         * output.cc (Output_section::write_header): Call it.
1476
1477 2011-06-29  Ian Lance Taylor  <iant@google.com>
1478
1479         PR gold/12818
1480         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1481         symbols which are not used in a relocation.
1482
1483 2011-06-28  Ian Lance Taylor  <iant@google.com>
1484
1485         PR gold/12898
1486         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1487         script create indistinguishable segments.
1488         (Layout::set_segment_offsets): Use stable_sort when sorting
1489         segments.  Pass this to Compare_segments constructor.
1490         * layout.h (class Layout): Make segment_precedes non-static.
1491         (class Compare_segments): Change from struct to class.  Add
1492         layout_ field.  Add constructor.
1493         * script-sections.cc
1494         (Script_sections::attach_sections_using_phdrs_clause): Rename
1495         local orphan to is_orphan.  Don't report failure to put empty
1496         section in segment.  On attachment failure, report name of
1497         section, and attach to first PT_LOAD segment.
1498
1499 2011-06-28  Ian Lance Taylor  <iant@google.com>
1500
1501         PR gold/12934
1502         * target-select.cc (Target_selector::Target_selector): Add
1503         emulation parameter.  Change all callers.
1504         (select_target_by_bfd_name): Rename from select_target_by_name.
1505         Change all callers.
1506         (select_target_by_emulation): New function.
1507         (supported_emulation_names): New function.
1508         * target-select.h (class Target_selector): Add emulation_ field.
1509         Update declarations.
1510         (Target_selector::recognize_by_bfd_name): Rename from
1511         recognize_by_name.  Change all callers.
1512         (Target_selector::supported_bfd_names): Rename from
1513         supported_names.  Change all callers.
1514         (Target_selector::recognize_by_emulation): New function.
1515         (Target_selector::supported_emulations): New function.
1516         (Target_selector::emulation): New function.
1517         (Target_selector::do_recognize_by_bfd_name): Rename from
1518         do_recognize_by_name.  Change all callers.
1519         (Target_selector::do_supported_bfd_names): Rename from
1520         do_supported_names.  Change all callers.
1521         (Target_selector::do_recognize_by_emulation): New function.
1522         (Target_selector::do_supported_emulations): New function.
1523         (select_target_by_bfd_name): Change name in declaration.
1524         (select_target_by_emulation): Declare.
1525         (supported_emulation_names): Declare.
1526         * parameters.cc (parameters_force_valid_target): Try to find
1527         target based on emulation from -m option.
1528         * options.h (class General_options): Change doc string for -m.
1529         * options.cc (help): Print emulations.
1530         (General_options::parse_V): Likewise.
1531         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1532         Add emulation parameter.  Change all callers.
1533
1534 2011-06-28  Ian Lance Taylor  <iant@google.com>
1535
1536         * target.h (class Target): Add osabi_ field.
1537         (Target::osabi): New function.
1538         (Target::set_osabi): New function.
1539         (Target::Target): Initialize osabi_.
1540         (Target::do_adjust_elf_header): Make pure virtual.
1541         (Sized_target::do_adjust_elf_header): Declare.
1542         * target.cc (Sized_target::do_adjust_elf_header): New function.
1543         (class Sized_target): Instantiate all versions.
1544         * freebsd.h (class Target_freebsd): Remove.
1545         (Target_selector_freebsd::do_recognize): Call set_osabi on
1546         Target.
1547         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1548         (Target_selector_freebsd::set_osabi): Remove.
1549         * i386.cc (class Target_i386): Inherit from Sized_target rather
1550         than Target_freebsd.
1551         * x86_64.cc (class Target_x86_64): Likewise.
1552
1553 2011-06-28  Ian Lance Taylor  <iant@google.com>
1554
1555         * target.h (Target::can_check_for_function_pointers): Rewrite.
1556         Make non-virtual.
1557         (Target::can_icf_inline_merge_sections): Likewise.
1558         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1559         (Target::Target_info): Add can_icf_inline_merge_sections field.
1560         (Target::do_can_check_for_function_pointers): New virtual
1561         function.
1562         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1563         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1564         from can_check_for_function_pointers, move in file.
1565         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1566         section_may_have_icf_unsafe_poineters, move in file.
1567         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1568         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1569         Rename from can_check_for_function_pointers, move in file.
1570         (Target_i386::can_icf_inline_merge_sections): Remove.
1571         (Target_i386::i386_info): Initialize
1572         can_icf_inline_merge_sections.
1573         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1574         Initialize can_icf_inline_merge_sections.
1575         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1576         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1577         Rename from can_check_for_function_pointers, move in file.
1578         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1579         (Target_x86_64::x86_64_info): Initialize
1580         can_icf_inline_merge_sections.
1581         * testsuite/testfile.cc (Target_test::test_target_info):
1582         Likewise.
1583         * icf.cc (get_section_contents): Correct formatting.
1584
1585 2011-06-27  Ian Lance Taylor  <iant@google.com>
1586
1587         * symtab.cc (Symbol::versioned_name): New function.
1588         (Symbol_table::add_to_final_symtab): Use versioned_name when
1589         appropriate.
1590         (Symbol_table::sized_write_symbol): Likewise.
1591         * symtab.h (class Symbol): Declare versioned_name.
1592         * stringpool.h (class Stringpool_template): Add variant of add
1593         which takes a std::basic_string.
1594         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1595         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1596         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1597         (ver_test_12.o): New target.
1598         * testsuite/Makefile.in: Rebuild.
1599
1600 2011-06-27  Doug Kwan  <dougkwan@google.com>
1601
1602         * arm.cc (Arm_relocate_functions::thm_jump8,
1603         Arm_relocate_functions::thm_jump11): Use a wider signed
1604         type to compute offset.
1605         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1606         arm_thm_jump8.
1607         * testsuite/Makefile.in: Regenerate.
1608         * testsuite/arm_branch_in_range.sh: Check test results of
1609         arm_thm_jump11 and arm_thm_jump8.
1610         * testsuite/arm_thm_jump11.s: New test source file.
1611         * testsuite/arm_thm_jump11.t: New linker script.
1612         * testsuite/arm_thm_jump8.s: New test source file.
1613         * testsuite/arm_thm_jump8.t: New linker script.
1614
1615 2011-06-24  Ian Lance Taylor  <iant@google.com>
1616
1617         * layout.cc: Include "object.h".
1618         (ctors_sections_in_init_array): New static variable.
1619         (Layout::is_ctors_in_init_array): New function.
1620         (Layout::layout): Add entry to ctors_sections_in_init_array if
1621         appropriate.
1622         * layout.h (class Layout): Declare is_ctors_in_init_array.
1623         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1624         is_ctors_reverse_view is set.
1625         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1626         all callers.  Set is_ctors_reverse_view field of View_size.
1627         (Sized_relobj_file::reverse_words): New function.
1628         * object.h (Sized_relobj_file::View_size): Add
1629         is_ctors_reverse_view field.
1630         (class Sized_relobj_file): Update declarations.
1631         * testsuite/initpri3.c: New test.
1632         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1633         initpri3b.
1634         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1635         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1636         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1637         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1638         * testsuite/Makefile.in: Rebuild.
1639
1640 2011-06-24  Cary Coutant  <ccoutant@google.com>
1641
1642         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1643         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1644         (debug_msg_cdebug.err): New targets.
1645         * testsuite/Makefile.in: Regenerate.
1646         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1647         Fix checks for link with shared library.
1648
1649 2011-06-24  Doug Kwan  <dougkwan@google.com>
1650
1651         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1652         skip empty text sections.
1653         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1654
1655 2011-06-22  Ian Lance Taylor  <iant@google.com>
1656
1657         PR gold/12910
1658         * options.h (class General_options): Add --ctors-in-init-array.
1659         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1660         friends as SHT_PROGBITS for merging sections.
1661         (Layout::layout): Remove special handling of .init_array and
1662         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1663         and .dtors if ctors_in_init_array.
1664         (Layout::make_output_section): Force correct section types for
1665         .init_array and friends.  Don't sort if doing relocatable link,
1666         Don't sort .ctors and .dtors if ctors_in_init_array.
1667         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1668         (Layout::output_section_name): Add relobj parameter.  Change all
1669         callers.  Handle .ctors. and .dtors. in code rather than table.
1670         Handle .ctors and .dtors if ctors_in_init_array.
1671         (Layout::match_file_name): New function, moved from output.cc.
1672         * layout.h (class Layout): Update declarations.
1673         * output.cc: Include "layout.h".
1674         (Input_section_sort_entry::get_priority): New function.
1675         (Input_section_sort_entry::match_file_name): Just call
1676         Layout::match_file_name.
1677         (Output_section::Input_section_sort_init_fini_compare::operator()):
1678         Handle .ctors and .dtors.  Sort by explicit priority rather than
1679         by name.
1680         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1681         * testsuite/initpri2.c: New test.
1682         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1683         (check_PROGRAMS): Add initpri2.
1684         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1685         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1686         * configure, testsuite/Makefile.in: Rebuild.
1687
1688 2011-06-19  Ian Lance Taylor  <iant@google.com>
1689
1690         PR gold/12880
1691         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1692         .interp section to a PT_INTERP segment even if we have seen a
1693         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1694         clause in a linker script.
1695         (Layout::finalize): Don't create a .interp section if we've
1696         already create a PT_INTERP segment.
1697         (Layout::create_interp): Always call choose_output_section (revert
1698         patch of 2011-06-17).  Don't create PT_INTERP segment.
1699         * script-sections.cc
1700         (Script_sections::create_note_and_tls_segments): Add a .interp
1701         section to a PT_INTERP segment even if we have seen a
1702         --dynamic-linker option.
1703
1704 2011-06-18  Ian Lance Taylor  <iant@google.com>
1705
1706         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1707         merely because a non-PT_LOAD segment has a dynamic reloc.
1708
1709 2011-06-18  Ian Lance Taylor  <iant@google.com>
1710
1711         * layout.cc (Layout::finish_dynamic_section): Don't create
1712         DT_FLAGS entry if not needed.
1713
1714 2011-06-18  Ian Lance Taylor  <iant@google.com>
1715
1716         PR gold/12745
1717         * layout.cc (Layout::layout_eh_frame): Correct handling of
1718         writable .eh_frame section.
1719
1720 2011-06-17  Ian Lance Taylor  <iant@google.com>
1721
1722         PR gold/12893
1723         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1724         symbol is redefined with the exact same object and value.
1725
1726 2011-06-17  Ian Lance Taylor  <iant@google.com>
1727
1728         PR gold/12880
1729         * layout.h (class Layout): Add interp_segment_ field.
1730         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1731         (Layout::attach_allocated_section_to_segment): If making shared
1732         library, put .interp section in PT_INTERP segment.
1733         (Layout::finalize): Also call create_interp if -dynamic-linker
1734         option was used.
1735         (Layout::create_interp): Assert that there is no PT_INTERP
1736         segment.  If not using a SECTIONS clause, use make_output_section.
1737         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1738         * script-sections.cc
1739         (Script_sections::create_note_and_tls_segments): If making shared
1740         library, put .interp section in PT_INTERP segment.
1741
1742 2011-06-17  Ian Lance Taylor  <iant@google.com>
1743
1744         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1745         when making a shared library.
1746
1747 2011-06-17  Ian Lance Taylor  <iant@google.com>
1748
1749         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1750         parameter.  Change all callers.  Don't issue warning about PC32
1751         against locally defined symbol.
1752
1753 2011-06-16  Ian Lance Taylor  <iant@google.com>
1754
1755         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1756         occurs in same object.
1757
1758 2011-06-14  Alan Modra  <amodra@gmail.com>
1759
1760         * po/POTFILES.in: Regenerate.
1761
1762 2011-06-09  Ian Lance Taylor  <iant@google.com>
1763
1764         * script-sections.cc
1765         (Orphan_output_section::set_section_addresses): For a relocatable
1766         link set address to 0.
1767
1768 2011-06-09  Cary Coutant  <ccoutant@google.com>
1769
1770         PR gold/12804
1771         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1772         used with --compress-debug-sections.
1773         * gold/object.cc (Sized_relobj_file::do_layout): Report
1774         uncompressed size of compressed input sections.
1775
1776 2011-06-08  Cary Coutant  <ccoutant@google.com>
1777
1778         PR gold/12804
1779         * testsuite/two_file_test_2_v1.cc: Change initialization of
1780         v2 to keep it in .data.
1781
1782 2011-06-07  Cary Coutant  <ccoutant@google.com>
1783
1784         * common.cc (Symbol_table::do_allocate_commons_list): Call
1785         gold_fallback.
1786         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1787         (Errors::fallback): New function.
1788         (gold_fallback): New function.
1789         * errors.h (Errors::fallback): New function.
1790         * gold.cc (gold_exit): Change status parameter to enum; adjust
1791         all callers.
1792         (queue_initial_tasks): Call gold_fallback.
1793         * gold.h: Include cstdlib.
1794         (Exit_status): New enum type.
1795         (gold_exit): Change status parameter to enum.
1796         (gold_fallback): New function.
1797         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1798         (Layout::create_symtab_sections): Likewise.
1799         (Layout::create_shdrs): Likewise.
1800         * main.cc (main): Adjust call to gold_exit.
1801         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1802         (Output_data_got::add_got_entry_pair): Likewise.
1803         (Output_section::add_input_section): Likewise.
1804         (Output_section::add_output_section_data): Likewise.
1805         (Output_segment::set_section_list_addresses): Likewise.
1806         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1807
1808 2011-06-07  Cary Coutant  <ccoutant@google.com>
1809
1810         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1811         for incremental links.
1812         * output.cc (Output_segment::set_section_list_addresses): Remove
1813         FIXME and test for TLS or BSS.
1814
1815 2011-06-07  Cary Coutant  <ccoutant@google.com>
1816
1817         * testsuite/Makefile.am: Add incremental_copy_test,
1818         incremental_common_test_1.
1819         * testsuite/Makefile.in: Regenerate.
1820         * testsuite/common_test_1_v1.c: New source file.
1821         * testsuite/common_test_1_v2.c: New source file.
1822         * testsuite/copy_test_v1.cc: New source file.
1823
1824 2011-06-07  Cary Coutant  <ccoutant@google.com>
1825
1826         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1827         update, allocate common from bss section's free list.
1828         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1829         linker-defined symbols.
1830         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1831         Skip GOT and PLT entries that are no longer referenced.
1832         (Output_section_incremental_inputs::write_info_blocks): Mark
1833         linker-defined symbols.
1834         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1835         * output.cc (Output_section::allocate): New function.
1836         * output.h (Output_section::allocate): New function.
1837         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1838         linker-defined symbols.
1839         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1840         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1841         (Symbol::init_base_output_data): Likewise.
1842         (Symbol::init_base_output_segment): Likewise.
1843         (Symbol::init_base_constant): Likewise.
1844         (Sized_symbol::init_output_data): Likewise.
1845         (Sized_symbol::init_output_segment): Likewise.
1846         (Sized_symbol::init_constant): Likewise.
1847         (Symbol_table::do_define_in_output_data): Likewise.
1848         (Symbol_table::do_define_in_output_segment): Likewise.
1849         (Symbol_table::do_define_as_constant): Likewise.
1850         * symtab.h (Symbol::is_predefined): New function.
1851         (Symbol::init_base_output_data): Add is_predefined parameter.
1852         (Symbol::init_base_output_segment): Likewise.
1853         (Symbol::init_base_constant): Likewise.
1854         (Symbol::is_predefined_): New data member.
1855         (Sized_symbol::init_output_data): Add is_predefined parameter.
1856         (Sized_symbol::init_output_segment): Likewise.
1857         (Sized_symbol::init_constant): Likewise.
1858         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1859
1860 2011-06-07  Cary Coutant  <ccoutant@google.com>
1861
1862         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1863         instead of emit_copy_reloc.
1864         (Copy_relocs::emit_copy_reloc): Refactor.
1865         (Copy_relocs::make_copy_reloc): New function.
1866         (Copy_relocs::add_copy_reloc): Remove.
1867         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1868         section.
1869         (Copy_relocs::make_copy_reloc): New function.
1870         (Copy_relocs::add_copy_reloc): Remove.
1871         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1872         unchanged input files.
1873         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1874         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1875         Reserve BSS space for COPY relocations.
1876         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1877         (Output_section_incremental_inputs::write_info_blocks): Record
1878         whether a symbol is copied from a shared object.
1879         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1880         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1881         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1882         (Incremental_input_entry_reader::get_output_symbol_index): Add
1883         is_copy parameter.
1884         (Incremental_binary::emit_copy_relocs): New function.
1885         (Incremental_binary::do_emit_copy_relocs): New function.
1886         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1887         new data member.
1888         (Sized_incremental_binary::add_copy_reloc): New function.
1889         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1890         (Sized_incremental_binary::Copy_reloc): New struct.
1891         (Sized_incremental_binary::Copy_relocs): New typedef.
1892         (Sized_incremental_binary::copy_relocs_): New data member.
1893         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1894         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1895         * target.h (Sized_target::emit_copy_reloc): New function.
1896         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1897
1898 2011-06-02  Cary Coutant  <ccoutant@google.com>
1899
1900         PR gold/12163
1901         * gold/archive.cc (Archive::Archive): Initialize new data member.
1902         (Archive::include_all_members): Return if archive has already been
1903         included.
1904         * gold/archive.h (Archive::include_all_members_): New data member.
1905
1906 2011-06-02  Nick Clifton  <nickc@redhat.com>
1907
1908         * dynobj.h: Fix spelling mistake in comment.
1909         * output.cc: Likewise.
1910
1911 2011-05-31  Doug Kwan  <dougkwan@google.com>
1912             Asier Llano
1913
1914         PR gold/12826
1915         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1916         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1917         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1918         redundant arm_exidx_test.so.
1919         * testsuite/Makefile.in: Regenerate.
1920         (check_SCRIPTS): Add pr12826.sh
1921         (check_DATA): Add pr12826.stdout
1922         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1923         * testsuite/pr12826.sh: New file.
1924         * testsuite/pr12826_1.s: Ditto.
1925         * testsuite/pr12826_1.s: Ditto.
1926
1927 2011-05-30  Ian Lance Taylor  <iant@google.com>
1928
1929         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1930         sections.
1931
1932 2011-05-29  Ian Lance Taylor  <iant@google.com>
1933
1934         PR gold/12804
1935         * testsuite/Makefile.am: Use different file name for two_file_test
1936         temporary file for each incremental test.
1937         * testsuite/Makefile.in: Rebuild.
1938
1939 2011-05-29  Ian Lance Taylor  <iant@google.com>
1940
1941         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1942         binary input file is empty.
1943
1944 2011-05-27  Ian Lance Taylor  <iant@google.com>
1945
1946         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1947         (ver_test_9.so): Likewise.
1948         * testsuite/Makefile.in: Rebuild.
1949
1950 2011-05-26 Cary Coutant  <ccoutant@google.com>
1951
1952         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1953         * incremental.cc (Incremental_inputs::report_input_section): Fix
1954         comment, indentation.
1955         (Incremental_inputs::report_comdat_group): New function.
1956         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1957         of data for incremental input file entry.
1958         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1959         group count, COMDAT group signatures.
1960         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1961         an unchanged input file.
1962         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1963         Initialize new data member.
1964         (Incremental_object_entry::add_comdat_group): New function.
1965         (Incremental_object_entry::get_comdat_group_count): New function.
1966         (Incremental_object_entry::get_comdat_signature_key): New function.
1967         (Incremental_object_entry::groups_): New data member.
1968         (Incremental_inputs::report_comdat_group): New function.
1969         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1970         data for incremental input file entry.
1971         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1972         (Incremental_input_entry_reader::get_input_section): Adjust size of
1973         data for incremental input file entry.
1974         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1975         (Incremental_input_entry_reader::get_comdat_group_signature): New
1976         function.
1977         * object.cc (Sized_relobj::include_section_group): Report kept
1978         COMDAT groups for incremental links.
1979
1980 2011-05-24  David Meyer  <pdox@google.com>
1981
1982         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1983         with name parameter.  Add found_name parameter.
1984         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1985         * dirsearch.h (class Dirsearch): Update declaration.
1986
1987 2011-05-24  Ian Lance Taylor  <iant@google.com>
1988
1989         * archive.cc (Library_base::should_include_member): Pull in object
1990         from archive if it defines the entry symbol.
1991         * parameters.cc (Parameters::entry): New function.
1992         * parameters.h (class Parameters): Declare entry.
1993         * output.h (class Output_file_header): Remove entry_ field.
1994         * output.cc (Output_file_header::Output_file_header): Remove entry
1995         parameter.  Change all callers.
1996         (Output_file_header::entry): Use parameters->entry.
1997         * gold.cc (queue_middle_tasks): Likewise.
1998         * plugin.cc (Plugin_hook::run): Likewise.
1999
2000 2011-05-24 Cary Coutant  <ccoutant@google.com>
2001
2002         * gold.cc (queue_initial_tasks): Pass incremental base filename
2003         to Output_file::open_base_file; don't print error message.
2004         * incremental-dump.cc (main): Adjust call to
2005         Output_file::open_for_modification.
2006         * incremental-dump.cc (main): Likewise.
2007         * incremental.cc (Incremental_inputs::report_command_line):
2008         Ignore --incremental-base option when comparing command lines.
2009         Ignore parameter when given as separate argument.
2010         * options.h (class General_options): Add --incremental-base.
2011         * output.cc (Output_file::Output_file):
2012         (Output_file::open_base_file): Add base_name and writable parameters;
2013         read base file into new file; print error message here.
2014         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2015         callers.
2016         * output.h (Output_file::open_for_modification): Rename to...
2017         (Output_file::open_base_file): ...this; add base_name and
2018         writable parameters; adjust all callers.
2019         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2020         callers.
2021         * testsuite/Makefile.am (incremental_test_4): Test
2022         --incremental-base.
2023         * testsuite/Makefile.in: Regenerate.
2024
2025 2011-05-24 Cary Coutant  <ccoutant@google.com>
2026
2027         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2028         incremental_test_4.
2029         * testsuite/Makefile.in: Regenerate.
2030         * testsuite/two_file_test_1_v1.cc: New test source file.
2031         * testsuite/two_file_test_1b_v1.cc: New test source file.
2032         * testsuite/two_file_test_2_v1.cc: New test source file.
2033
2034 2011-05-24 Cary Coutant  <ccoutant@google.com>
2035
2036         * dynobj.h (Dynobj::do_dynobj): New function.
2037         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2038         flag and soname for shared objects.
2039         * incremental.cc (Incremental_inputs::report_object): Make
2040         either Incremental_object_entry or Incremental_dynobj_entry; add
2041         soname to string table.
2042         (Incremental_inputs::report_input_section): Add assertion.
2043         (Output_section_incremental_inputs::set_final_data_size): Adjust
2044         type of input file entry for shared libraries; adjust size of
2045         shared library info entry.
2046         (Output_section_incremental_inputs::write_input_files): Write
2047         as_needed flag for shared libraries.
2048         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2049         of input file entry for shared libraries; write soname.
2050         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2051         soname from incremental info.
2052         * incremental.h (enum Incremental_input_flags): Add
2053         INCREMENTAL_INPUT_AS_NEEDED.
2054         (Incremental_input_entry::Incremental_input_entry): Initialize new
2055         data member.
2056         (Incremental_input_entry::set_as_needed): New function.
2057         (Incremental_input_entry::as_needed): New function.
2058         (Incremental_input_entry::do_dynobj_entry): New function.
2059         (Incremental_input_entry::as_needed_): New data member.
2060         (Incremental_object_entry::Incremental_object_entry): Don't check
2061         for shared library.
2062         (Incremental_object_entry::do_type): Likewise.
2063         (class Incremental_dynobj_entry): New class.
2064         (Incremental_input_entry_reader::as_needed): New function.
2065         (Incremental_input_entry_reader::get_soname): New function.
2066         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2067         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2068         size of shared library info entry.
2069         * layout.cc (Layout::finish_dynamic_section): Don't test for
2070         incremental link when adding DT_NEEDED entries.
2071         * object.h (Object::Object): Initialize new data member.
2072         (Object::dynobj): New function.
2073         (Object::set_as_needed): New function.
2074         (Object::as_needed): New function.
2075         (Object::do_dynobj): New function.
2076         (Object::as_needed_): New data member.
2077
2078 2011-05-24 Cary Coutant  <ccoutant@google.com>
2079
2080         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2081         info; adjust display of GOT entries.
2082         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2083         vector of input objects; remove file_status_.
2084         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2085         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2086         got_plt reader; call target hooks to reserve GOT entries.
2087         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2088         of input file info header and GOT info entry.
2089         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2090         relocation info.
2091         (Got_plt_view_info::got_descriptor): Remove.
2092         (Got_plt_view_info::sym_index): New data member.
2093         (Got_plt_view_info::input_index): New data member.
2094         (Local_got_offset_visitor::visit): Write input file index.
2095         (Global_got_offset_visitor::visit): Write 0 for input file index.
2096         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2097         with sym_index and input_index.
2098         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2099         incremental info GOT entry; replace got_descriptor with input_index.
2100         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2101         map from input file index to object.
2102         (Sized_relobj_incr::do_layout): Replace direct data member reference
2103         with accessor function.
2104         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2105         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2106         Adjust size of input file info header.
2107         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2108         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2109         (Incremental_input_entry_reader::get_input_section): Adjust size of
2110         input file info header.
2111         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2112         of incremental info GOT entry.
2113         (Incremental_got_plt_reader::get_got_desc): Remove.
2114         (Incremental_got_plt_reader::get_got_symndx): New function.
2115         (Incremental_got_plt_reader::get_got_input_index): New function.
2116         (Sized_incremental_binary::Sized_incremental_binary): Remove
2117         file_status_; add input_objects_.
2118         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2119         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2120         (Sized_incremental_binary::file_is_unchanged): Remove.
2121         (Sized_incremental_binary::set_input_object): New function.
2122         (Sized_incremental_binary::input_object): New function.
2123         (Sized_incremental_binary::file_status_): Remove.
2124         (Sized_incremental_binary::input_objects_): New data member.
2125         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2126         references.
2127         (Sized_relobj_incr::invalid_address): Move to base class.
2128         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2129         class.
2130         (Sized_relobj_incr::do_output_section_offset): Likewise.
2131         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2132         (Sized_relobj_incr::section_offsets_): Likewise.
2133         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2134         function.
2135         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2136         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2137         with accessor function.
2138         (Sized_relobj_file::do_layout): Likewise.
2139         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2140         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2141         (Sized_relobj_file::compute_final_local_value): Replace refs to
2142         section_offsets_ with accessor function.
2143         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2144         * object.h (Relobj::Relobj): Initialize new data members.
2145         (Relobj::add_dyn_reloc): New function.
2146         (Relobj::first_dyn_reloc): New function.
2147         (Relobj::dyn_reloc_count): New function.
2148         (Relobj::first_dyn_reloc_): New data member.
2149         (Relobj::dyn_reloc_count_): New data member.
2150         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2151         references.
2152         (Sized_relobj::Address): New typedef.
2153         (Sized_relobj::invalid_address): Move here from child class.
2154         (Sized_relobj::Sized_relobj): Initialize new data members.
2155         (Sized_relobj::sized_relobj): New function.
2156         (Sized_relobj::is_output_section_offset_invalid): Move here from
2157         child class.
2158         (Sized_relobj::get_output_section_offset): Likewise.
2159         (Sized_relobj::local_has_got_offset): Likewise.
2160         (Sized_relobj::local_got_offset): Likewise.
2161         (Sized_relobj::set_local_got_offset): Likewise.
2162         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2163         (Sized_relobj::clear_got_offsets): New function.
2164         (Sized_relobj::section_offsets): Move here from child class.
2165         (Sized_relobj::do_output_section_offset): Likewise.
2166         (Sized_relobj::do_set_section_offset): Likewise.
2167         (Sized_relobj::Local_got_offsets): Likewise.
2168         (Sized_relobj::local_got_offsets_): Likewise.
2169         (Sized_relobj::section_offsets_): Likewise.
2170         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2171         references.
2172         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2173         class.
2174         (Sized_relobj_file::sized_relobj): New function
2175         (Sized_relobj_file::local_has_got_offset): Move to base class.
2176         (Sized_relobj_file::local_got_offset): Likewise.
2177         (Sized_relobj_file::set_local_got_offset): Likewise.
2178         (Sized_relobj_file::get_output_section_offset): Likewise.
2179         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2180         (Sized_relobj_file::do_output_section_offset): Likewise.
2181         (Sized_relobj_file::do_set_section_offset): Likewise.
2182         (Sized_relobj_file::Local_got_offsets): Likewise.
2183         (Sized_relobj_file::local_got_offsets_): Likewise.
2184         (Sized_relobj_file::section_offsets_): Likewise.
2185         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2186         (all constructors).
2187         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2188         (Output_reloc::get_symbol_index): Likewise.
2189         (Output_reloc::local_section_offset): Likewise.
2190         (Output_reloc::get_address): Likewise.
2191         (Output_reloc::symbol_value): Likewise.
2192         (Output_data_got::reserve_slot): Move to class definition.
2193         (Output_data_got::reserve_local): New function.
2194         (Output_data_got::reserve_slot_for_global): Remove.
2195         (Output_data_got::reserve_global): New function.
2196         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2197         (all constructors, two instantiations).
2198         (Output_reloc::get_relobj): New function (two instantiations).
2199         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2200         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2201         (Output_data_reloc::add_global): Adjust type of relobj.
2202         (Output_data_reloc::add_global_relative): Likewise.
2203         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2204         (Output_data_reloc::add_local): Likewise.
2205         (Output_data_reloc::add_local_relative): Likewise.
2206         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2207         (Output_data_reloc::add_local_section): Likewise.
2208         (Output_data_reloc::add_output_section): Likewise.
2209         (Output_data_reloc::add_absolute): Likewise.
2210         (Output_data_reloc::add_target_specific): Likewise.
2211         (Output_data_got::reserve_slot): Move definition here.
2212         (Output_data_got::reserve_local): New function.
2213         (Output_data_got::reserve_global): New function.
2214         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2215         section_offsets_ with accessor function.
2216         (Sized_relobj_file::write_sections): Likewise.
2217         (Sized_relobj_file::do_relocate_sections): Likewise.
2218         * target.h (Sized_target::reserve_local_got_entry): New function.
2219         (Sized_target::reserve_global_got_entry): New function.
2220         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2221         (Target_x86_64::reserve_global_got_entry): New function.
2222         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2223
2224 2011-05-23 Cary Coutant  <ccoutant@google.com>
2225
2226         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2227         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2228         bit when checking got_type.
2229         * incremental.cc (Sized_incremental_binary::setup_readers):
2230         Store symbol table and string table locations; initialize bit vector
2231         of file status flags.
2232         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2233         unchanged files.
2234         (Sized_incremental_binary::do_process_got_plt): New function.
2235         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2236         (Output_section_incremental_inputs::set_final_data_size): Record
2237         file index for each input file.
2238         (Output_section_incremental_inputs::write_got_plt): Store file index
2239         instead of input entry offset for each GOT entry.
2240         * incremental.h
2241         (Incremental_input_entry::Incremental_input_entry): Initialize new
2242         data member.
2243         (Incremental_input_entry::set_offset): Store file index.
2244         (Incremental_input_entry::get_file_index): New function.
2245         (Incremental_input_entry::file_index_): New data member.
2246         (Incremental_binary::process_got_plt): New function.
2247         (Incremental_binary::do_process_got_plt): New function.
2248         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2249         data members.
2250         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2251         (Sized_incremental_binary::set_file_is_unchanged): New function.
2252         (Sized_incremental_binary::file_is_unchanged): New function.
2253         (Sized_incremental_binary::do_process_got_plt): New function.
2254         (Sized_incremental_binary::file_status_): New data member.
2255         (Sized_incremental_binary::main_symtab_loc_): New data member.
2256         (Sized_incremental_binary::main_strtab_loc_): New data member.
2257         * output.cc (Output_data_got::Got_entry::write): Add case
2258         RESERVED_CODE.
2259         (Output_data_got::add_global): Call add_got_entry.
2260         (Output_data_got::add_global_plt): Likewise.
2261         (Output_data_got::add_global_with_rel): Likewise.
2262         (Output_data_got::add_global_with_rela): Likewise.
2263         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2264         (Output_data_got::add_global_pair_with_rela): Likewise.
2265         (Output_data_got::add_local): Call add_got_entry.
2266         (Output_data_got::add_local_plt): Likewise.
2267         (Output_data_got::add_local_with_rel): Likewise.
2268         (Output_data_got::add_local_with_rela): Likewise.
2269         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2270         (Output_data_got::add_local_pair_with_rela): Likewise.
2271         (Output_data_got::reserve_slot): New function.
2272         (Output_data_got::reserve_slot_for_global): New function.
2273         (Output_data_got::add_got_entry): New function.
2274         (Output_data_got::add_got_entry_pair): New function.
2275         (Output_section::add_output_section_data): Edit FIXME.
2276         * output.h
2277         (Output_section_data_build::Output_section_data_build): New
2278         constructor with size parameter.
2279         (Output_data_space::Output_data_space): Likewise.
2280         (Output_data_got::Output_data_got): Initialize new data member; new
2281         constructor with size parameter.
2282         (Output_data_got::add_constant): Call add_got_entry.
2283         (Output_data_got::reserve_slot): New function.
2284         (Output_data_got::reserve_slot_for_global): New function.
2285         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2286         (Output_data_got::add_got_entry): New function.
2287         (Output_data_got::add_got_entry_pair): New function.
2288         (Output_data_got::free_list_): New data member.
2289         * target.h (Sized_target::init_got_plt_for_update): New function.
2290         (Sized_target::register_global_plt_entry): New function.
2291         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2292         Initialize new data member; call init; add constructor with PLT count.
2293         (Output_data_plt_x86_64::init): New function.
2294         (Output_data_plt_x86_64::add_relocation): New function.
2295         (Output_data_plt_x86_64::reserve_slot): New function.
2296         (Output_data_plt_x86_64::free_list_): New data member.
2297         (Target_x86_64::init_got_plt_for_update): New function.
2298         (Target_x86_64::register_global_plt_entry): New function.
2299         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2300         incremental updates.
2301         (Output_data_plt_x86_64::add_relocation): New function.
2302         * testsuite/object_unittest.cc (Object_test): Set default options.
2303
2304 2011-05-16  Ian Lance Taylor  <iant@google.com>
2305
2306         * options.h (class General_options): Make -i a synonym for -r.
2307
2308 2011-05-16  Ian Lance Taylor  <iant@google.com>
2309
2310         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2311
2312 2011-05-10 Cary Coutant  <ccoutant@google.com>
2313
2314         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2315         strip_all (-s).
2316
2317 2011-05-06  Ian Lance Taylor  <iant@google.com>
2318
2319         * layout.cc (Layout::layout): If the output section flags change,
2320         update the ordering.
2321
2322 2011-04-25 Cary Coutant  <ccoutant@google.com>
2323
2324         * incremental-dump.cc (dump_incremental_inputs): Print local
2325         symbol info for each input file.
2326         * incremental.cc
2327         (Output_section_incremental_inputs::set_final_data_size): Add local
2328         symbol info to input file entries in incremental info.
2329         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2330         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2331         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2332         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2333         implementation.
2334         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2335         (Sized_incr_relobj::do_relocate): Write the local symbols.
2336         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2337         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2338         Adjust size of input file header.
2339         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2340         (Incremental_inputs_reader::get_local_symbol_count): New function.
2341         (Incremental_inputs_reader::get_input_section): Adjust size of input
2342         file header.
2343         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2344         (Sized_incr_relobj::This): New typedef.
2345         (Sized_incr_relobj::sym_size): New const data member.
2346         (Sized_incr_relobj::Local_symbol): New struct.
2347         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2348         (Sized_incr_relobj::do_local_symbol_offset): New function.
2349         (Sized_incr_relobj::local_symbol_count_): New data member.
2350         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2351         (Sized_incr_relobj::local_symbol_index_): New data member.
2352         (Sized_incr_relobj::local_symbol_offset_): New data member.
2353         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2354         (Sized_incr_relobj::local_symbols_): New data member.
2355         * object.h (Relobj::output_local_symbol_count): New function.
2356         (Relobj::local_symbol_offset): New function.
2357         (Relobj::do_output_local_symbol_count): New function.
2358         (Relobj::do_local_symbol_offset): New function.
2359         (Sized_relobj::do_output_local_symbol_count): New function.
2360         (Sized_relobj::do_local_symbol_offset): New function.
2361
2362 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2363
2364         * descriptors.cc (set_close_on_exec): New function.
2365         (Descriptors::open): Use set_close_on_exec.
2366         * output.cc (S_ISLNK): Define if not defined.
2367
2368 2011-04-22 Cary Coutant  <ccoutant@google.com>
2369
2370         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2371         global symbol map.
2372         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2373         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2374         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2375         relocations.
2376         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2377         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2378         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2379         * incremental.h
2380         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2381         function.
2382         (Incremental_binary::apply_incremental_relocs): New function.
2383         (Incremental_binary::do_apply_incremental_relocs): New function.
2384         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2385         data member.
2386         (Sized_incremental_binary::add_global_symbol): New function.
2387         (Sized_incremental_binary::global_symbol): New function.
2388         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2389         (Sized_incremental_binary::symbol_map_): New data member.
2390         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2391         * target.h (Sized_target::apply_relocation): New function.
2392         * target-reloc.h (apply_relocation): New function.
2393         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2394
2395 2011-04-22  Doug Kwan  <dougkwan@google.com>
2396
2397         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2398         flag of a SHT_ARM_EXIDX section.
2399         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2400         * testsuite/Makefile.in: Regenerate.
2401         * testsuite/arm_exidx_test.s: New file.
2402         * testsuite/arm_exidx_test.sh: Same.
2403
2404 2011-04-20 Cary Coutant  <ccoutant@google.com>
2405
2406         PR gold/12689
2407         * archive.h (Incremental_archive_entry::Archive_member):
2408         Initialize arg_serial_ (second constructor).
2409
2410 2011-04-17  Ian Lance Taylor  <iant@google.com>
2411
2412         * object.cc (Relocate_info::location): Simplify location string.
2413         * errors.cc (Errors::error_at_location): Don't print program
2414         name.
2415         (Errors::warning_at_location): Likewise.
2416         (Errors::undefined_symbol): Likewise.
2417         * testsuite/debug_msg.sh: Update accordingly.
2418
2419 2011-04-14 Cary Coutant  <ccoutant@google.com>
2420
2421         * gold/layout.cc (Layout::symtab_section_offset): New function.
2422         * gold/layout.h (Layout::symtab_section_offset): New function.
2423         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2424
2425 2011-04-12  Ian Lance Taylor  <iant@google.com>
2426
2427         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2428         with MREMAP_MAYMOVE.
2429         * output.h (class Output_file): Add map_is_allocated_ field.
2430         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2431         not available, provide stubs.  If mremap is not available, #define
2432         it to gold_mremap.
2433         (MREMAP_MAYMOVE): Define if not defined.
2434         (Output_file::Output_file): Initialize map_is_allocated_.
2435         (Output_file::resize): Check map_is_allocated_.
2436         (Output_file::map_anonymous): If mmap fails, use malloc.
2437         (Output_file::unmap): Don't do anything for an anonymous map.
2438         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2439         is not available, provide stubs.
2440         (File_read::View::~View): Use free rather than delete[].
2441         (File_read::make_view): Use malloc rather than new[].  If mmap
2442         fails, use malloc.
2443         (File_read::find_or_make_view): Use malloc rather than new[].
2444         * gold.h: Remove HAVE_REMAP code.
2445         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2446         exists.  Rename mremap to gold_mremap.  If mmap is not available
2447         don't do anything.
2448         * configure, config.in: Rebuild.
2449
2450 2011-04-11  Ian Lance Taylor  <iant@google.com>
2451
2452         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2453         initialize local variable v.
2454
2455 2011-04-11  Cary Coutant  <ccoutant@google.com>
2456
2457         * archive.cc (Archive::include_member): Adjust call to
2458         report_object.
2459         (Add_archive_symbols::run): Track argument serial numbers.
2460         (Lib_group::include_member): Likewise.
2461         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2462         * archive.h (Incremental_archive_entry::Archive_member):
2463         Initialize arg_serial_.
2464         (Archive_member::arg_serial_): New data member.
2465         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2466         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2467         incremental link.
2468         (Sized_dynobj::do_for_all_local_got_entries): New function.
2469         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2470         function.
2471         * fileread.cc (get_mtime): New function.
2472         * fileread.h (get_mtime): New function.
2473         * gold.cc (queue_initial_tasks): Check for incremental update.
2474         (process_incremental_input): New function.
2475         (queue_middle_tasks): Don't force valid target for incremental
2476         update.
2477         * incremental-dump.cc (find_input_containing_global): Adjust
2478         size of symbol info entry.
2479         (dump_incremental_inputs): Dump argument serial number and
2480         in_system_directory flag; bias shndx by 1; print symbol names
2481         when dumping per-file symbol lists; use new symbol info readers.
2482         * incremental.cc
2483         (Output_section_incremental_inputs:update_data_size): New function.
2484         (Sized_incremental_binary::setup_readers): Setup input readers
2485         for each input file; build maps for files added from libraries
2486         and scripts.
2487         (Sized_incremental_binary::check_input_args): New function.
2488         (Sized_incremental_binary::do_check_inputs): Build map of argument
2489         serial numbers to input arguments.
2490         (Sized_incremental_binary::do_file_has_changed): Rename
2491         do_file_is_unchanged to this; compare file modification times.
2492         (Sized_incremental_binary::do_init_layout): New function.
2493         (Sized_incremental_binary::do_reserve_layout): New function.
2494         (Sized_incremental_binary::do_get_input_reader): Remove.
2495         (Sized_incremental_binary::get_symtab_view): New function.
2496         (Incremental_checker::can_incrementally_link_output_file): Remove.
2497         (Incremental_inputs::report_command_line): Exclude --debug options.
2498         (Incremental_inputs::report_archive_begin): Add parameter; track
2499         argument serial numbers; don't put input file entry for archive
2500         before archive members.
2501         (Incremental_inputs::report_archive_end): Put input file entry
2502         for archive after archive members.
2503         (Incremental_inputs::report_object): Add parameter; track argument
2504         serial numbers and in_system_directory flag.
2505         (Incremental_inputs::report_script): Add parameter; track argument
2506         serial numbers.
2507         (Output_section_incremental_inputs::set_final_data_size): Adjust
2508         size of symbol info entry; check for forwarding symbols.
2509         (Output_section_incremental_inputs::write_input_files): Write
2510         in_system_directory flag and argument serial number.
2511         (Output_section_incremental_inputs::write_info_blocks): Map section
2512         indices between incremental info and original input file; store
2513         input section index for each symbol.
2514         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2515         change operator() to visit().
2516         (class Global_got_offset_visitor): Likewise.
2517         (class Global_symbol_visitor_got_plt):
2518         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2519         classes.
2520         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2521         (Sized_incr_relobj::do_read_symbols): New function.
2522         (Sized_incr_relobj::do_layout): New function.
2523         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2524         (Sized_incr_relobj::do_add_symbols): New function.
2525         (Sized_incr_relobj::do_should_include_member): New function.
2526         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2527         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2528         (Sized_incr_relobj::do_section_size): New function.
2529         (Sized_incr_relobj::do_section_name): New function.
2530         (Sized_incr_relobj::do_section_contents): New function.
2531         (Sized_incr_relobj::do_section_flags): New function.
2532         (Sized_incr_relobj::do_section_entsize): New function.
2533         (Sized_incr_relobj::do_section_address): New function.
2534         (Sized_incr_relobj::do_section_type): New function.
2535         (Sized_incr_relobj::do_section_link): New function.
2536         (Sized_incr_relobj::do_section_info): New function.
2537         (Sized_incr_relobj::do_section_addralign): New function.
2538         (Sized_incr_relobj::do_initialize_xindex): New function.
2539         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2540         (Sized_incr_relobj::do_read_relocs): New function.
2541         (Sized_incr_relobj::do_gc_process_relocs): New function.
2542         (Sized_incr_relobj::do_scan_relocs): New function.
2543         (Sized_incr_relobj::do_count_local_symbols): New function.
2544         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2545         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2546         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2547         (Sized_incr_relobj::do_relocate): New function.
2548         (Sized_incr_relobj::do_set_section_offset): New function.
2549         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2550         (Sized_incr_dynobj::do_read_symbols): New function.
2551         (Sized_incr_dynobj::do_layout): New function.
2552         (Sized_incr_dynobj::do_add_symbols): New function.
2553         (Sized_incr_dynobj::do_should_include_member): New function.
2554         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2555         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2556         (Sized_incr_dynobj::do_section_size): New function.
2557         (Sized_incr_dynobj::do_section_name): New function.
2558         (Sized_incr_dynobj::do_section_contents): New function.
2559         (Sized_incr_dynobj::do_section_flags): New function.
2560         (Sized_incr_dynobj::do_section_entsize): New function.
2561         (Sized_incr_dynobj::do_section_address): New function.
2562         (Sized_incr_dynobj::do_section_type): New function.
2563         (Sized_incr_dynobj::do_section_link): New function.
2564         (Sized_incr_dynobj::do_section_info): New function.
2565         (Sized_incr_dynobj::do_section_addralign): New function.
2566         (Sized_incr_dynobj::do_initialize_xindex): New function.
2567         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2568         (make_sized_incremental_object): New function.
2569         (Incremental_library::copy_unused_symbols): New function.
2570         (Incremental_library::do_for_all_unused_symbols): New function.
2571         * incremental.h (enum Incremental_input_flags): New type.
2572         (class Incremental_checker): Remove.
2573         (Incremental_input_entry::Incremental_input_entry): Add argument
2574         serial number.
2575         (Incremental_input_entry::arg_serial): New function.
2576         (Incremental_input_entry::set_is_in_system_directory): New function.
2577         (Incremental_input_entry::is_in_system_directory): New function.
2578         (Incremental_input_entry::arg_serial_): New data member.
2579         (Incremental_input_entry::is_in_system_directory_): New data member.
2580         (class Script_info): Move here from script.h.
2581         (Script_info::Script_info): Add filename parameter.
2582         (Script_info::filename): New function.
2583         (Script_info::filename_): New data member.
2584         (Incremental_script_entry::Incremental_script_entry): Add argument
2585         serial number.
2586         (Incremental_object_entry::Incremental_object_entry): Likewise.
2587         (Incremental_object_entry::add_input_section): Build list of input
2588         sections with map to original shndx.
2589         (Incremental_object_entry::get_input_section_index): New function.
2590         (Incremental_object_entry::shndx_): New data member.
2591         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2592         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2593         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2594         serial number.
2595         (Incremental_inputs::report_archive_begin): Likewise.
2596         (Incremental_inputs::report_object): Likewise.
2597         (Incremental_inputs::report_script): Likewise.
2598         (class Incremental_global_symbol_reader): New class.
2599         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2600         and store flags and input file type.
2601         (Incremental_input_entry_reader::arg_serial): New function.
2602         (Incremental_input_entry_reader::type): Extract type from flags.
2603         (Incremental_input_entry_reader::is_in_system_directory): New function.
2604         (Incremental_input_entry_reader::get_input_section_count): Call
2605         accessor function for type.
2606         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2607         function for type; adjust size of global symbol entry.
2608         (Incremental_input_entry_reader::get_global_symbol_count): Call
2609         accessor function for type.
2610         (Incremental_input_entry_reader::get_object_count): Likewise.
2611         (Incremental_input_entry_reader::get_object_offset): Likewise.
2612         (Incremental_input_entry_reader::get_member_count): Likewise.
2613         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2614         (Incremental_input_entry_reader::get_member_offset): Likewise.
2615         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2616         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2617         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2618         (Incremental_input_entry_reader::get_global_symbol_reader): New
2619         function.
2620         (Incremental_input_entry_reader::get_output_symbol_index): New
2621         function.
2622         (Incremental_input_entry_reader::type_): Remove.
2623         (Incremental_input_entry_reader::flags_): New data member.
2624         (Incremental_inputs_reader::input_file_offset): New function.
2625         (Incremental_inputs_reader::input_file_index): New function.
2626         (Incremental_inputs_reader::input_file): Call input_file_offset.
2627         (Incremental_inputs_reader::input_file_at_offset): New function.
2628         (Incremental_relocs_reader::get_r_type): Reformat.
2629         (Incremental_relocs_reader::get_r_shndx): Reformat.
2630         (Incremental_relocs_reader::get_r_offset): Reformat.
2631         (Incremental_relocs_reader::data): New function.
2632         (Incremental_binary::Incremental_binary): Initialize new data members.
2633         (Incremental_binary::check_inputs): Add cmdline parameter.
2634         (Incremental_binary::file_is_unchanged): Remove.
2635         (Input_reader::arg_serial): New function.
2636         (Input_reader::get_unused_symbol_count): New function.
2637         (Input_reader::get_unused_symbol): New function.
2638         (Input_reader::do_arg_serial): New function.
2639         (Input_reader::do_get_unused_symbol_count): New function.
2640         (Input_reader::do_get_unused_symbol): New function.
2641         (Incremental_binary::input_file_count): New function.
2642         (Incremental_binary::get_input_reader): Change signature to use
2643         index instead of filename.
2644         (Incremental_binary::file_has_changed): New function.
2645         (Incremental_binary::get_input_argument): New function.
2646         (Incremental_binary::get_library): New function.
2647         (Incremental_binary::get_script_info): New function.
2648         (Incremental_binary::init_layout): New function.
2649         (Incremental_binary::reserve_layout): New function.
2650         (Incremental_binary::output_file): New function.
2651         (Incremental_binary::do_check_inputs): New function.
2652         (Incremental_binary::do_file_is_unchanged): Remove.
2653         (Incremental_binary::do_file_has_changed): New function.
2654         (Incremental_binary::do_init_layout): New function.
2655         (Incremental_binary::do_reserve_layout): New function.
2656         (Incremental_binary::do_input_file_count): New function.
2657         (Incremental_binary::do_get_input_reader): Change signature.
2658         (Incremental_binary::input_args_map_): New data member.
2659         (Incremental_binary::library_map_): New data member.
2660         (Incremental_binary::script_map_): New data member.
2661         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2662         new data members.
2663         (Sized_incremental_binary::output_section): New function.
2664         (Sized_incremental_binary::inputs_reader): Add const.
2665         (Sized_incremental_binary::symtab_reader): Add const.
2666         (Sized_incremental_binary::relocs_reader): Add const.
2667         (Sized_incremental_binary::got_plt_reader): Add const.
2668         (Sized_incremental_binary::get_symtab_view): New function.
2669         (Sized_incremental_binary::Inputs_reader): New typedef.
2670         (Sized_incremental_binary::Input_entry_reader): New typedef.
2671         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2672         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2673         (Sized_incremental_binary::do_file_has_changed): New function.
2674         (Sized_incremental_binary::do_init_layout): New function.
2675         (Sized_incremental_binary::do_reserve_layout): New function.
2676         (Sized_input_reader::Inputs_reader): Remove.
2677         (Sized_input_reader::Input_entry_reader): Remove.
2678         (Sized_input_reader::do_arg_serial): New function.
2679         (Sized_input_reader::do_get_unused_symbol_count): New function.
2680         (Sized_input_reader::do_get_unused_symbol): New function.
2681         (Sized_incremental_binary::do_input_file_count): New function.
2682         (Sized_incremental_binary::do_get_input_reader): Change signature;
2683         use index instead of filename.
2684         (Sized_incremental_binary::section_map_): New data member.
2685         (Sized_incremental_binary::input_entry_readers_): New data member.
2686         (class Sized_incr_relobj): New class.
2687         (class Sized_incr_dynobj): New class.
2688         (make_sized_incremental_object): New function.
2689         (class Incremental_library): New class.
2690         * layout.cc (Free_list::num_lists): New static data member.
2691         (Free_list::num_nodes): New static data member.
2692         (Free_list::num_removes): New static data member.
2693         (Free_list::num_remove_visits): New static data member.
2694         (Free_list::num_allocates): New static data member.
2695         (Free_list::num_allocate_visits): New static data member.
2696         (Free_list::init): New function.
2697         (Free_list::remove): New function.
2698         (Free_list::allocate): New function.
2699         (Free_list::dump): New function.
2700         (Free_list::print_stats): New function.
2701         (Layout_task_runner::run): Resize output file for incremental updates.
2702         (Layout::Layout): Initialize new data members.
2703         (Layout::set_incremental_base): New function.
2704         (Layout::init_fixed_output_section): New function.
2705         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2706         incremental updates.
2707         (Layout::create_gold_note): Do not create gold note section for
2708         incremental updates.
2709         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2710         for incremental updates.
2711         (Layout::set_section_offsets): For incremental updates, allocate space
2712         from free list.
2713         (Layout::create_symtab_sections): Layout with offsets relative to
2714         start of section; for incremental updates, allocate space from free
2715         list.
2716         (Layout::create_shdrs): For incremental updates, allocate space from
2717         free list.
2718         (Layout::finish_dynamic_section): For incremental updates, do not
2719         check --as-needed (fixed in subsequent patch).
2720         * layout.h (class Free_list): New class.
2721         (Layout::set_incremental_base): New function.
2722         (Layout::incremental_base): New function.
2723         (Layout::init_fixed_output_section): New function.
2724         (Layout::allocate): New function.
2725         (Layout::incremental_base_): New data member.
2726         (Layout::free_list_): New data member.
2727         * main.cc (main): Print Free_list statistics.
2728         * object.cc (Relobj::finalize_incremental_relocs): Add
2729         clear_counts parameter; clear counts only when clear_counts is set.
2730         (Sized_relobj::Sized_relobj): Initialize new base class.
2731         (Sized_relobj::do_layout): Don't report special sections.
2732         (Sized_relobj::do_for_all_local_got_entries): New function.
2733         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2734         symtab_off to all symbol table offsets.
2735         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2736         * object.h (class Got_offset_list): Move to top of file.
2737         (Object::Object): Allow case where input_file == NULL.
2738         (Object::~Object): Likewise.
2739         (Object::input_file): Assert that input_file != NULL.
2740         (Object::lock): Allow case where input_file == NULL.
2741         (Object::unlock): Likewise.
2742         (Object::is_locked): Likewise.
2743         (Object::token): Likewise.
2744         (Object::release): Likewise.
2745         (Object::is_incremental): New function.
2746         (Object::get_mtime): New function.
2747         (Object::for_all_local_got_entries): New function.
2748         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2749         (Object::set_is_in_system_directory): New function.
2750         (Object::is_in_system_directory): New function.
2751         (Object::do_is_incremental): New function.
2752         (Object::do_get_mtime): New function.
2753         (Object::do_for_all_local_got_entries): New function.
2754         (Object::is_in_system_directory_): New data member.
2755         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2756         (class Sized_relobj_base): New class.
2757         (class Sized_relobj): Derive from Sized_relobj_base.
2758         (class Sized_relobj::Symbols): Redeclare from base class.
2759         (class Sized_relobj::local_got_offset_list): Remove.
2760         (class Sized_relobj::Output_sections): Redeclare from base class.
2761         (class Sized_relobj::do_for_all_local_got_entries): New function.
2762         (class Sized_relobj::write_local_symbols): Add offset parameter.
2763         (class Sized_relobj::local_symbol_offset_): Update comment.
2764         (class Sized_relobj::local_dynsym_offset_): Update comment.
2765         * options.cc (Input_arguments::add_file): Remove const.
2766         * options.h (Input_file_argument::Input_file_argument):
2767         Initialize arg_serial_ (all constructors).
2768         (Input_file_argument::set_arg_serial): New function.
2769         (Input_file_argument::arg_serial): New function.
2770         (Input_file_argument::arg_serial_): New data member.
2771         (Input_arguments::Input_arguments): Initialize file_count_.
2772         (Input_arguments::add_file): Remove const.
2773         (Input_arguments::number_of_input_files): New function.
2774         (Input_arguments::file_count_): New data member.
2775         (Command_line::number_of_input_files): Call
2776         Input_arguments::number_of_input_files.
2777         * output.cc (Output_segment_headers::Output_segment_headers):
2778         Set current size.
2779         (Output_section::Input_section::current_data_size): New function.
2780         (Output_section::Output_section): Initialize new data members.
2781         (Output_section::add_input_section): Don't do merge sections for
2782         an incremental link; allocate space from free list for an
2783         incremental update.
2784         (Output_section::add_output_section_data): Allocate space from
2785         free list for an incremental update.
2786         (Output_section::update_data_size): New function.
2787         (Output_section::set_fixed_layout): New function.
2788         (Output_section::reserve): New function.
2789         (Output_segment::set_section_addresses): Remove const.
2790         (Output_segment::set_section_list_addresses): Remove const; allocate
2791         space from free list for an incremental update.
2792         (Output_segment::set_offset): Adjust size of RELRO segment for an
2793         incremental update.
2794         * output.h (Output_data::current_data_size): Move here from
2795         child classes.
2796         (Output_data::pre_finalize_data_size): New function.
2797         (Output_data::update_data_size): New function.
2798         (Output_section_headers::update_data_size): new function.
2799         (Output_section_data_build::current_data_size): Move to Output_data.
2800         (Output_data_strtab::update_data_size): New function.
2801         (Output_section::current_data_size): Move to Output_data.
2802         (Output_section::set_fixed_layout): New function.
2803         (Output_section::has_fixed_layout): New function.
2804         (Output_section::reserve): New function.
2805         (Output_section::update_data_size): New function.
2806         (Output_section::has_fixed_layout_): New data member.
2807         (Output_section::free_list_): New data member.
2808         (Output_segment::set_section_addresses): Remove const.
2809         (Output_segment::set_section_list_addresses): Remove const.
2810         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2811         New function.
2812         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2813         New function.
2814         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2815         parameter when calling Add_symbols constructor; store argument
2816         serial number for members of a lib group.
2817         (Add_symbols::locks): Allow case where token == NULL.
2818         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2819         (Read_member::~Read_member): New function.
2820         (Read_member::is_runnable): New function.
2821         (Read_member::locks): New function.
2822         (Read_member::run): New function.
2823         (Check_script::~Check_script): New function.
2824         (Check_script::is_runnable): New function.
2825         (Check_script::locks): New function.
2826         (Check_script::run): New function.
2827         (Check_library::~Check_library): New function.
2828         (Check_library::is_runnable): New function.
2829         (Check_library::locks): New function.
2830         (Check_library::run): New function.
2831         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2832         (Add_symbols::library_): New data member.
2833         (class Read_member): New class.
2834         (class Check_script): New class.
2835         (class Check_library): New class.
2836         * reloc.cc (Read_relocs::is_runnable): Allow case where
2837         token == NULL.
2838         (Read_relocs::locks): Likewise.
2839         (Scan_relocs::locks): Likewise.
2840         (Relocate_task::locks): Likewise.
2841         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2842         to clear counters.
2843         (Sized_relobj::incremental_relocs_scan): Fix comment.
2844         (Sized_relobj::do_relocate): Pass output file offset to
2845         write_local_symbols.
2846         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2847         from class declaration.
2848         * script.cc (read_input_script): Allocate Script_info; pass
2849         argument serial number to report_script.
2850         * script.h (class Script_info): Move to incremental.h.
2851         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2852         * symtab.h (Symbol_table::add_from_incrobj): New function.
2853         (Symbol_table::set_file_offset): New function.
2854
2855 2011-04-05  Cary Coutant  <ccoutant@google.com>
2856
2857         * incremental-dump.cc (dump_incremental_inputs): Change signature
2858         to take a Sized_incremental_binary; change caller.  Use readers
2859         in Sized_incremental_binary.
2860         * incremental.cc
2861         (Sized_incremental_binary::find_incremental_inputs_sections):
2862         Rename do_find_incremental_inputs_sections to this.
2863         (Sized_incremental_binary::setup_readers): New function.
2864         (Sized_incremental_binary::do_check_inputs): Check
2865         has_incremental_info_ flag; move setup code to setup_readers;
2866         use input readers.
2867         (Sized_incremental_binary::do_file_is_unchanged): New function.
2868         (Sized_incremental_binary::do_get_input_reader): New function.
2869         * incremental.h (class Incremental_binary): Move to end of file.
2870         (Incremental_binary::file_is_unchanged): New function.
2871         (Incremental_binary::do_file_is_unchanged): New function.
2872         (Incremental_binary::Input_reader): New class.
2873         (Incremental_binary::get_input_reader): New function.
2874         (class Sized_incremental_binary): Move to end of file.
2875         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2876         input section reader classes.
2877         (Sized_incremental_binary::has_incremental_info): New function.
2878         (Sized_incremental_binary::inputs_reader): New function.
2879         (Sized_incremental_binary::symtab_reader): New function.
2880         (Sized_incremental_binary::relocs_reader): New function.
2881         (Sized_incremental_binary::got_plt_reader): New function.
2882         (Sized_incremental_binary::do_file_is_unchanged): New function.
2883         (Sized_incremental_binary::Sized_input_reader): New class.
2884         (Sized_incremental_binary::get_input_reader): New function.
2885         (Sized_incremental_binary::find_incremental_inputs_sections):
2886         Rename do_find_incremental_inputs_sections to this.
2887         (Sized_incremental_binary::setup_readers): New function.
2888         (Sized_incremental_binary::has_incremental_info_): New data member.
2889         (Sized_incremental_binary::inputs_reader_): New data member.
2890         (Sized_incremental_binary::symtab_reader_): New data member.
2891         (Sized_incremental_binary::relocs_reader_): New data member.
2892         (Sized_incremental_binary::got_plt_reader_): New data member.
2893         (Sized_incremental_binary::current_input_file_): New data member.
2894
2895 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2896
2897         PR gold/12640
2898         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2899         violation.
2900
2901 2011-03-30  Cary Coutant  <ccoutant@google.com>
2902
2903         * archive.cc (Archive::include_member): Adjust call to report_object.
2904         (Add_archive_symbols::run): Add script_info to call to
2905         report_archive_begin.
2906         (Lib_group::include_member): Adjust call to report_object.
2907         (Add_lib_group_symbols::run): Adjust call to report_object.
2908         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2909         blocks.  Add object count for script input files.
2910         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2911         script_info parameter; change all callers.
2912         (Incremental_inputs::report_object): Add script_info parameter;
2913         change all callers.
2914         (Incremental_inputs::report_script): Store backpointer to
2915         incremental info entry.
2916         (Output_section_incremental_inputs::set_final_data_size): Record
2917         additional information for scripts.
2918         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2919         * incremental.h (Incremental_script_entry::add_object): New function.
2920         (Incremental_script_entry::get_object_count): New function.
2921         (Incremental_script_entry::get_object): New function.
2922         (Incremental_script_entry::objects_): New data member; adjust
2923         constructor.
2924         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2925         (Incremental_inputs::report_object): Add script_info parameter.
2926         (Incremental_inputs_reader::get_object_count): New function.
2927         (Incremental_inputs_reader::get_object_offset): New function.
2928         * options.cc (Input_arguments::add_file): Return reference to
2929         new input argument.
2930         * options.h (Input_argument::set_script_info): New function.
2931         (Input_argument::script_info): New function.
2932         (Input_argument::script_info_): New data member; adjust all
2933         constructors.
2934         (Input_file_group::add_file): Return reference to new input argument.
2935         (Input_file_lib::add_file): Likewise.
2936         (Input_arguments::add_file): Likewise.
2937         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2938         * script.cc (Parser_closure::Parser_closure): Add script_info
2939         parameter; adjust all callers.
2940         (Parser_closure::script_info): New function.
2941         (Parser_closure::script_info_): New data member.
2942         (read_input_script): Report scripts earlier to incremental info.
2943         (script_add_file): Set script_info in Input_argument.
2944         (script_add_library): Likewise.
2945         * script.h (Script_options::Script_info): Rewrite class.
2946
2947 2011-03-29  Cary Coutant  <ccoutant@google.com>
2948
2949         * archive.cc (Library_base::should_include_member): Move
2950         method here from class Archive.
2951         (Archive::Archive): Initialize base class.
2952         (Archive::should_include_member): Move to base class.
2953         (Archive::do_for_all_unused_symbols): New function.
2954         (Add_archive_symbols::run): Remove redundant access to
2955         incremental_inputs.
2956         (Lib_group::Lib_group): Initialize base class.
2957         (Lib_group::do_filename): New function.
2958         (Lib_group::include_member): Pass pointer to Lib_group to
2959         report_object.
2960         (Lib_group::do_for_all_unused_symbols): New function.
2961         (Add_lib_group_symbols::run): Report archive information for
2962         incremental links.
2963         * archive.h (class Library_base): New base class.
2964         (class Archive): Derive from Library_base.
2965         (Archive::filename): Move to base class.
2966         (Archive::set_incremental_info): Likewise.
2967         (Archive::incremental_info): Likewise.
2968         (Archive::Should_include): Likewise.
2969         (Archive::should_include_member): Likewise.
2970         (Archive::Armap_entry): Remove.
2971         (Archive::Unused_symbol_iterator): Remove.
2972         (Archive::unused_symbols_begin): Remove.
2973         (Archive::unused_symbols_end): Remove.
2974         (Archive::do_filename): New function.
2975         (Archive::do_get_mtime): New function.
2976         (Archive::do_for_all_unused_symbols): New function.
2977         (Archive::task_): Move to base class.
2978         (Archive::incremental_info_): Likewise.
2979         (class Lib_group): Derive from Library_base.
2980         (Lib_group::do_filename): New function.
2981         (Lib_group::do_get_mtime): New function.
2982         (Lib_group::do_for_all_unused_symbols): New function.
2983         (Lib_group::task_): Move to base class.
2984         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2985         function.
2986         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2987         function.
2988         * incremental.cc (Incremental_inputs::report_archive_begin):
2989         Use Library_base; call library's get_mtime; add incremental inputs
2990         entry before members.
2991         (class Unused_symbol_visitor): New class.
2992         (Incremental_inputs::report_archive_end): Use Library_base; use
2993         visitor class to record unused symbols; don't add incremental inputs
2994         entry after members.
2995         (Incremental_inputs::report_object): Use Library_base.
2996         * incremental.h
2997         (Incremental_archive_entry::Incremental_archive_entry): Remove
2998         unused Archive parameter.
2999         (Incremental_inputs::report_archive_begin): Use Library_base.
3000         (Incremental_inputs::report_archive_end): Likewise.
3001         (Incremental_inputs::report_object): Likewise.
3002         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3003         function.
3004         * object.h (Object::for_all_global_symbols): New function.
3005         (Object::do_for_all_global_symbols): New function.
3006         (Sized_relobj::do_for_all_global_symbols): New function.
3007         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3008         function.
3009         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3010         function.
3011
3012 2011-03-27  Ian Lance Taylor  <iant@google.com>
3013
3014         * archive.cc (Archive::interpret_header): Return -1 if something
3015         goes wrong.  Change callers accordingly.
3016
3017 2011-03-25  Cary Coutant  <ccoutant@google.com>
3018
3019         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3020         * testsuite/Makefile.in: Regenerate.
3021
3022 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3023
3024         * plugin.cc (get_view): New.
3025         (Plugin::load): Pass get_view to the plugin.
3026         (Plugin_manager::get_view): New.
3027
3028 2011-03-21  Ian Lance Taylor  <iant@google.com>
3029
3030         * testsuite/final_layout.sh: Rewrite to not use dc.
3031         * testsuite/relro_test.sh: Fail if dc is not present.
3032
3033 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3034
3035         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3036         Change == to -eq.
3037         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3038         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3039         Change == to -eq.
3040         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3041         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3042
3043 2011-03-14  Ian Lance Taylor  <iant@google.com>
3044
3045         * script-sections.cc (Sort_output_sections::script_compare):
3046         Rename from is_before, change return type.
3047         (Sort_output_sections::operator()): Adjust accordingly.
3048
3049 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3050
3051         PR gold/12572
3052         * testsuite/odr_violation2.cc: Add comment to make all error line
3053         numbers double digits.
3054         * testsuite/debug_msg.sh: Adjust expected errors.
3055
3056 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3057
3058         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3059         but mark earlier ones as non-canonical
3060         (offset_to_iterator): Update search target and example
3061         (do_addr2line): Return extra lines in a vector*
3062         (format_file_lineno): Extract from do_addr2line
3063         (one_addr2line): Add vector* out-param
3064         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3065         when a lineno entry appeared last for its instruction
3066         (Dwarf_line_info): Add vector* out-param
3067         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3068         * symtab.cc (Odr_violation_compare): Include the lineno in the
3069         comparison again.
3070         (linenos_from_loc): New. Combine the canonical line for an
3071         address with its other lines.
3072         (True_if_intersect): New. Helper functor to make
3073         std::set_intersection a query.
3074         (detect_odr_violations): Compare sets of lines instead of just
3075         one line for each function. This became less deterministic, but
3076         has fewer false positives.
3077         * symtab.h: Declarations.
3078         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3079         mix an optimized and non-optimized object in the same binary
3080         (odr_violation2.so): Same.
3081         * testsuite/Makefile.in: Regenerate from Makefile.am.
3082         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3083         * testsuite/debug_msg.sh: Update line numbers and add
3084         assertions.
3085         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3086         non-optimized context.
3087         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3088         isn't inlined, and use OdrDerived in an optimized context.
3089         * testsuite/odr_header1.h: Defines OdrDerived, where
3090         optimization will change the
3091         first-instruction-in-the-destructor's file and line number.
3092         * testsuite/odr_header2.h: Defines OdrBase.
3093
3094 2011-03-09  Ian Lance Taylor  <iant@google.com>
3095
3096         * fileread.cc (File_read::clear_views): Don't delete the whole
3097         file view.
3098
3099 2011-03-08  Ian Lance Taylor  <iant@google.com>
3100
3101         PR gold/12525
3102         * fileread.cc: #include <climits>.
3103         (GOLD_IOV_MAX): Define.
3104         (File_read::read_multiple): Limit number of entries by iov_max.
3105         * fileread.h (class File_read): Always set max_readv_entries to
3106         128.
3107
3108 2011-03-07  Ian Lance Taylor  <iant@google.com>
3109
3110         PR gold/12525
3111         * options.h (class General_options): Add -dy and -dn.
3112
3113 2011-03-02  Cary Coutant  <ccoutant@google.com>
3114
3115         * testsuite/script_test_9.t: Add TLS segment.
3116
3117 2011-03-02  Simon Baldwin  <simonb@google.com>
3118
3119         * configure.ac: Add check for gnu_indirect_function support in
3120         the toolchain building binutils.
3121         * configure: Rebuild.
3122
3123 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3124
3125         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3126         plugin only symbols.
3127         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3128         in plugin files as not needed in the symbol table.
3129
3130 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3131
3132         * output.cc (Output_section::add_input_section): Delay fill
3133         generation for section ordering.
3134
3135 2011-02-09  Ian Lance Taylor  <iant@google.com>
3136
3137         PR gold/12316
3138         * object.h (class Sized_relobj): Remove clear_local_symbols.
3139         * reloc.cc (Sized_relobj::do_relocate): Don't call
3140         clear_local_symbols.
3141
3142 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3143
3144         * plugin.cc (is_visible_from_outside): Return true for symbols
3145         in the -u option.
3146
3147 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3148
3149         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3150         filename.
3151
3152 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3153
3154         * icf.h (is_section_foldable_candidate): Change type of parameter
3155         to std::string.
3156         * icf.cc (Icf::find_identical_sections): Change type of local variable
3157         section_name to be std::string.
3158         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3159
3160 2011-01-25  Ian Lance Taylor  <iant@google.com>
3161
3162         * script.cc (script_add_extern): Rewrite to use
3163         add_symbol_reference.
3164
3165 2011-01-25  Doug Kwan  <dougkwan@google.com>
3166
3167         * icf.cc (get_section_contents): Always lock section's object.
3168
3169 2011-01-24  Ian Lance Taylor  <iant@google.com>
3170
3171         * options.h (class General_options): Accept
3172         --no-detect-odr-violations.
3173
3174 2011-01-24  Ian Lance Taylor  <iant@google.com>
3175
3176         * version.cc (version_string): Bump to 1.11.
3177
3178 2011-01-24  Ian Lance Taylor  <iant@google.com>
3179
3180         * plugin.cc (class Plugin_rescan): Define new class.
3181         (Plugin_manager::claim_file): Set any_claimed_.
3182         (Plugin_manager::save_archive): New function.
3183         (Plugin_manager::save_input_group): New function.
3184         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3185         necessary.
3186         (Plugin_manager::new_undefined_symbol): New function.
3187         (Plugin_manager::rescan): New function.
3188         (Plugin_manager::rescannable_defines): New function.
3189         (Plugin_manager::add_input_file): Set any_added_.
3190         * plugin.h (class Plugin_manager): define new fields rescannable_,
3191         undefined_symbols_, any_claimed_, and any_added_.  Declare
3192         Plugin_rescan as friend.  Declare new functions.
3193         (Plugin_manager::Rescannable): Define type.
3194         (Plugin_manager::Rescannable_list): Define type.
3195         (Plugin_manager::Undefined_symbol_list): Define type.
3196         (Plugin_manager::Plugin_manager): Initialize new fields.
3197         * archive.cc (Archive::defines_symbol): New function.
3198         (Add_archive_symbols::run): Pass archive to plugins if any.
3199         * archive.h (class Archive): Declare defines_symbol.
3200         * readsyms.cc (Input_group::~Input_group): New function.
3201         (Finish_group::run): Pass input_group to plugins if any.
3202         * readsyms.h (class Input_group): Declare destructor.
3203         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3204         any.
3205
3206 2011-01-10  Ian Lance Taylor  <iant@google.com>
3207
3208         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3209         section as relro.
3210         (Layout::set_segment_offsets): Reset increase_relro before calling
3211         set_section_addresses a second time.
3212
3213 2011-01-04  Cary Coutant  <ccoutant@google.com>
3214
3215         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3216         sections before NOBITS sections.
3217
3218 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3219
3220         * version.cc (print_version): Update copyright to 2011.
3221
3222 2010-12-23  Cary Coutant  <ccoutant@google.com>
3223
3224         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3225         of OS to this->add.  Add OD parameter to second form of the function.
3226
3227 2010-12-20  Ian Lance Taylor  <iant@google.com>
3228
3229         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3230         second of two consecutive entries with same offset.
3231
3232 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3233
3234         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3235         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3236         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3237         to avoid unneeded links against $(LDADD).
3238         * testsuite/Makefile.in: Regenerate.
3239
3240 2010-12-15  Ian Lance Taylor  <iant@google.com>
3241
3242         PR gold/12324
3243         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3244         for R_X86_64_32 and R_X86_64_PC32.
3245         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3246         ver_matching_def_pic.o.
3247         (ver_matching_def_pic.o): New target.
3248
3249 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3250
3251         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3252         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3253         Move definition before File_read::View member definitions.
3254         (File_read::View::~View): Initialize and hold lock before
3255         updating current_mapped_bytes.
3256
3257 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3258
3259         * dwarf_reader.cc: Remove outdated comment.
3260         * gold-threads.cc: Fix typo in error message.
3261         * archive.cc: Fix typos in comments.
3262         * archive.h: Likewise.
3263         * arm-reloc-property.cc: Likewise.
3264         * arm-reloc-property.h: Likewise.
3265         * arm-reloc.def: Likewise.
3266         * arm.cc: Likewise.
3267         * attributes.h: Likewise.
3268         * cref.cc: Likewise.
3269         * ehframe.cc: Likewise.
3270         * fileread.h: Likewise.
3271         * gold.h: Likewise.
3272         * i386.cc: Likewise.
3273         * icf.cc: Likewise.
3274         * incremental.h: Likewise.
3275         * int_encoding.cc: Likewise.
3276         * layout.h: Likewise.
3277         * main.cc: Likewise.
3278         * merge.h: Likewise.
3279         * object.cc: Likewise.
3280         * object.h: Likewise.
3281         * options.cc: Likewise.
3282         * readsyms.cc: Likewise.
3283         * reduced_debug_output.cc: Likewise.
3284         * reloc.cc: Likewise.
3285         * script-sections.cc: Likewise.
3286         * sparc.cc: Likewise.
3287         * symtab.h: Likewise.
3288         * target-reloc.h: Likewise.
3289         * target.cc: Likewise.
3290         * target.h: Likewise.
3291         * timer.cc: Likewise.
3292         * timer.h: Likewise.
3293         * x86_64.cc: Likewise.
3294
3295 2010-12-09  Cary Coutant  <ccoutant@google.com>
3296
3297         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3298         stack.
3299         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3300         parameter; change all callers.
3301         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3302         * options.h (warn_execstack): New option.
3303
3304 2010-12-07  Doug Kwan  <dougkwan@google.com>
3305
3306         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3307         like function call relocations.
3308
3309 2010-12-07  Ian Lance Taylor  <iant@google.com>
3310
3311         * archive.cc (Archive::get_elf_object_for_member): Permit
3312         punconfigured to be NULL.
3313         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3314         (Archive::include_member): Pass NULL to get_elf_object_for_member
3315         if we searched for the archive and this is the first included
3316         object.
3317
3318 2010-12-01  Ian Lance Taylor  <iant@google.com>
3319
3320         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3321         track_relocs_type_ field.
3322         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3323         Set track_relocs_type_.
3324         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3325         contents when using RELA relocs.
3326         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3327         reloc_map_.
3328         * reloc.cc (Track_relocs::next_addend): New function.
3329         * reloc.h (class Track_relocs): Declare next_addend.
3330
3331 2010-12-01  Ian Lance Taylor  <iant@google.com>
3332
3333         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3334         virtual destructor.
3335
3336 2010-12-01  Ian Lance Taylor  <iant@google.com>
3337
3338         * README: Update compilers known to work and fail.
3339
3340 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3341
3342         * configure.in: For --enable-gold, handle value `default' instead of
3343         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3344         not the default.
3345         * configure: Regenerate.
3346
3347 2010-11-18  Doug Kwan  <dougkwan@google.com>
3348
3349         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3350         and right_alignment to be zero.  Store result alignment only if it is
3351         greater than existing alignment.
3352
3353 2010-11-16  Cary Coutant  <ccoutant@google.com>
3354
3355         PR gold/12220
3356         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3357         Check for ".zdebug_line".
3358
3359 2010-11-16  Doug Kwan  <dougkwan@google.com>
3360             Cary Coutant  <ccoutant@google.com>
3361
3362         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3363         by reference; adjust all callers.
3364         * output.cc (Output_segment::set_section_addresses): Adjust references
3365         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3366         list is empty.
3367         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3368         end at page boundary.
3369
3370 2010-11-16  Cary Coutant  <ccoutant@google.com>
3371
3372         PR gold/12220
3373         * layout.cc (Layout::choose_output_section): Transform names of
3374         compressed sections even when using a script with a SECTIONS clause.
3375         (Layout::output_section_name): Remove code to transform
3376         compressed debug section names.
3377         * output.cc (Output_section::add_input_section): Use uncompressed
3378         section size when tracking input sections.
3379
3380 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3381
3382         * symtab.h (Symbol::NON_PIC_REF): Remove.
3383         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3384         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3385         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3386         (Symbol::use_plt_offset): Take a flags argument and pass it
3387         directly to needs_dynamic_reloc.  Restrict check for undefined
3388         weak symbols to function calls.
3389         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3390         (Target_arm::Scan::global): Use it.
3391         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3392         (Target_arm::Relocate::relocate): Likewise.
3393         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3394         parameter with an r_type parameter.  Use get_reference_flags
3395         to get the flags.
3396         (Target_arm::Relocate::relocate): Update accordingly.
3397         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3398         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3399         (Target_i386::Scan::global): Likewise.
3400         (Target_i386::Relocate::relocate): Likewise.
3401         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3402         parameter with an r_type parameter.  Use get_reference_flags
3403         to get the flags.
3404         (Target_i386::Relocate::relocate): Update accordingly.
3405         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3406         (Target_powerpc::Scan::global): Use it.
3407         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3408         (Target_powerpc::Relocate::relocate): Likewise.
3409         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3410         (Target_sparc::Scan::global): Use it.
3411         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3412         (Target_sparc::Relocate::relocate): Likewise.
3413         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3414         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3415         (Target_x86_64::Scan::global): Likewise.
3416         (Target_x86_64::Relocate::relocate): Likewise.
3417
3418 2010-11-08  Doug Kwan  <dougkwan@google.com>
3419             Cary Coutant  <ccoutant@google.com>
3420
3421         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3422         (Arm_exidx_merge_section::section_contents_): New data member.
3423         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3424         (Arm_input_section::~Arm_input_section): De-allocate memory.
3425         (Arm_input_section::original_contents_): New data member.
3426         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3427         in parameters instead of calling Object::section_contents without
3428         locking.
3429         (Arm_output_section::group_section): New parameter TASK.  Pass it
3430         to callees that need locking objects.
3431         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3432         to lock EXIDX input sections.  Fix a formatting issue.  Call
3433         Arm_exidx_merged_section::build_contents to create merged section
3434         contents.
3435         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3436         to lock object of stub table owner.
3437         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3438         TEXT_SIZE to initialize data member TEXT_SIZE_.
3439         (Arm_exidx_input_section::addralign): Fix typo in comment.
3440         (Arm_exidx_input_section::text_size): New method.
3441         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3442         that require locking objects.  Lock objects before scanning for stubs
3443         and updating local symbols.
3444         (Arm_input_section<big_endian>::init): Copy contents of original
3445         input section.
3446         (Arm_input_section<big_endian>::do_write): Use saved contents of
3447         original input section instead of calling Object::section_contents
3448         without locking.
3449         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3450         size without calling Object::section_size().
3451         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3452         for size.  Allocate a buffer for merged EXIDX entries.
3453         (Arm_exidx_merged_section::build_contents): New method.
3454         (Arm_exidx_merged_section::do_write): Move merge section contents
3455         building code to Arm_exidx_merged_section::build_contetns.  Write
3456         out contetns in buffer instead of building it on the fly.
3457         (Arm_relobj::make_exidx_input_section): Also pass text section size
3458         to Arm_exidx_input_section constructor.
3459         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3460         (Arm_dynobj::do_read_symbols): Fix memory leak.
3461         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3462         * target.h: (class Task): Add forward declaration.
3463         (Target::relax): Add new parameter TASK and pass it to
3464         Target::do_relax().
3465         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3466
3467 2010-11-05  Cary Coutant  <ccoutant@google.com>
3468
3469         PR gold/10708
3470         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3471         object when reading from the file.
3472         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3473         second layout pass.
3474         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3475         when reading section contents.
3476         (get_section_contents): Likewise.
3477         (icf::find_identical_sections): Likewise.
3478         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3479         object when reading from the file.
3480         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3481         the object when doing deferred section layout.
3482
3483 2010-11-03  Nick Clifton  <nickc@redhat.com>
3484
3485         PR gold/12001
3486         * script.h (class Symbol_assignment: name): New member.  Returns
3487         the name of the symbol.
3488         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3489         Returns true if the given symbol name is on the list of
3490         assignments wating to be processed.
3491         * archive.cc (should_incldue_member): If the symbol is undefined,
3492         check to see if it is on the list of symbols pending assignment.
3493
3494 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3495
3496         * script-sections.cc (Script_sections::find_memory_region): Check
3497         for a NULL output section pointer.
3498
3499 2010-10-29  Doug Kwan  <dougkwan@google.com>
3500
3501         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3502         Output_section::add_relaxed_input_section.
3503         * output.cc (Output_section::add_relaxed_input_section): Add new
3504         arguments LAYOUT and NAME.  Set section order index.
3505         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3506         Copy section order index.
3507         * output.h (Output_section::add_relaxed_input_section): Add new
3508         arguments LAYOUT and NAME.
3509
3510 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3511
3512         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3513         NATIVE_OR_CROSS_LINKER.
3514         * testsuite/Makefile.in: Regenerate.
3515
3516 2010-10-20  Doug Kwan  <dougkwan@google.com>
3517
3518         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3519         without SHF_LINK_ORDER flags.
3520         * layout.cc (Layout::choose_output_section): Do not filter
3521         SHF_LINK_ORDER flag in a relocatable link.
3522
3523 2010-10-17  Cary Coutant  <ccoutant@google.com>
3524
3525         * output.h (Output_segment::set_section_addresses): Change function
3526         signature.  Update all callers.
3527         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3528         sections.
3529         (Output_segment::set_section_addresses): Align after last TLS
3530         section.  Add padding before last relro section instead of after.
3531
3532 2010-10-17  Doug Kwan  <dougkwan@google.com>
3533
3534         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3535         GOT output section to be writable.
3536
3537 2010-10-14  Cary Coutant  <ccoutant@google.com>
3538
3539         * debug.h (DEBUG_INCREMENTAL): New flag.
3540         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3541         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3542         mode.
3543         * incremental.cc (report_command_line): Ignore all forms of
3544         --incremental.
3545         * layout.cc (Layout::Layout): Check parameters for incremental link
3546         mode.
3547         * options.cc (General_options::parse_incremental): New function.
3548         (General_options::parse_no_incremental): New function.
3549         (General_options::parse_incremental_full): New function.
3550         (General_options::parse_incremental_update): New function.
3551         (General_options::incremental_mode_): New data member.
3552         (General_options::finalize): Check incremental_mode_.
3553         * options.h (General_options): Update help text for --incremental.
3554         Add --no-incremental, --incremental-full, --incremental-update.
3555         (General_options::Incremental_mode): New enum type.
3556         (General_options::incremental_mode): New function.
3557         (General_options::incremental_mode_): New data member.
3558         * parameters.cc (Parameters::incremental_mode_): New data member.
3559         (Parameters::set_options): Set incremental_mode_.
3560         (Parameters::set_incremental_full): New function.
3561         (Parameters::incremental): New function.
3562         (Parameters::incremental_update): New function.
3563         (set_parameters_incremental_full): New function.
3564         * parameters.h (Parameters::set_incremental_full): New function.
3565         (Parameters::incremental): New function.
3566         (Parameters::incremental_update): New function.
3567         (Parameters::incremental_mode_): New data member.
3568         (set_parameters_incremental_full): New function.
3569         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3570         incremental link mode.
3571         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3572         (Sized_relobj::do_relocate_sections): Likewise.
3573         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3574         option.
3575         * testsuite/Makefile.in: Regenerate.
3576         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3577
3578 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3579
3580         * script-sections.h (class Script_sections): Make
3581         Sections_elements typedef public.
3582         * script-sections.cc (class Sort_output_sections): Add elements_
3583         field.  Add constructor which sets it; change all callers.
3584         (Sort_output_sections::is_before): New function.
3585         (Sort_output_sections::operator()): Call is_before.
3586         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3587         conditional.
3588         * testsuite/script_test_10.sh: New test. Test script section
3589         order.
3590         * testsuite/script_test_10.t: Likewise.
3591         * testsuite/script_test_10.s: Likewise.
3592         * testsuite/Makefile.am: Wrap the cross linker tests and the
3593         common tests into NATIVE_OR_CROSS_LINKER.
3594         (check_SCRIPTS): Add script_test_10.sh.
3595         (check_DATA): Add script_test_10.stdout.
3596         (script_test_10.o, script_test_10): New targets.
3597         (script_test_10.stdout): New target.
3598         * configure, testsuite/Makefile.in: Regenerate.
3599
3600 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3601
3602         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3603         error for the deprecated relocations.
3604         (Target_arm::Scan::global): Likewise.
3605         (Target_arm::Relocate::relocate): Likewise.
3606
3607 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3608
3609         * fileread.cc (Input_file::find_file): Initialize *found_name
3610         and *namep when using the fallback search for case 4.
3611
3612 2010-10-11  Cary Coutant  <ccoutant@google.com>
3613
3614         * options.h (class General_options): Redefine -z lazy as an alias for
3615         the negation of -z now.
3616
3617 2010-10-11  Ian Lance Taylor  <iant@google.com>
3618
3619         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3620         binding.
3621
3622 2010-10-06  Nick Clifton  <nickc@redhat.com>
3623
3624         * script-sections.cc(class Memory_region): Remove
3625         current_lma_offset_ field.  Rename current_vma_offset_ to
3626         current_offset_.  Add last_section_ field.
3627         (Memory_region::get_current_vma_address): Rename to
3628         get_current_address.
3629         (Memory_region::get_current_lma_address): Delete.
3630         (Memory_region::increment_vma_offset): Rename to
3631         increment_offset.
3632         (Memory_region::increment_lma_offset): Delete.
3633         (Memory_region::attributes_compatible): New method.  Returns
3634         true if the provided section is compatible with the region.
3635         (Memory_region::get_last_section): New method.  Returns the last
3636         section to use the region.
3637         (Memory_region::set_last_section): New method.  Stores the last
3638         section to use the region.
3639         (Script_sections::block_in_region): New method.  Returns true if
3640         a block of memory is contained within a region.
3641         (Script_sections::find_memory_region): New method.  Locates a
3642         memory region to be used to set a VMA or LMA address.
3643         (Output_section_definition::set_section_addresses): Add code to
3644         check for addresses set by memory regions.
3645         (Output_segment::set_section_addresses): Remove memory region
3646         walking code.
3647         (Script_sections::create_segment): Add a warning if a header
3648         segment is created outside of any region.
3649         * script-sections.h (class Script_sections): Add prototypes for
3650         find_memory_region and block_in_region methods.
3651         * testsuite/memory_test.s: Use .long instead of .word.
3652         * testsuite/memory_test.t: Add some more output sections.
3653         * testsuite/memory_test.sh: Update expected output.
3654
3655 2010-10-02  Doug Kwan  <dougkwan@google.com>
3656
3657         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3658         defintion to symtab.h
3659         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3660         declaration to defintion.
3661
3662 2010-10-01  Nick Clifton  <nickc@redhat.com>
3663
3664         * expression.cc (eval): Replace dummy argument with NULL.
3665         (eval_maybe_dot): Check for a NULL result section pointer.
3666         (Symbol_expression::value): Likewise.
3667         (Dot_expression::value): Likewise.
3668         (BINARY_EXPRESSION): Likewise.
3669         (Max_expression::value): Likewise.
3670         (Min_expression::value): Likewise.
3671         (Absolute_expression::value): Likewise.
3672         (Addr_expression::value_from_output_section): Likewise.
3673         (Loaddddr_expression::value_from_output_section): Likewise.
3674         (Segment_start_expression::value): Likewise.
3675         * script-sections.cc
3676         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3677         argument with NULL.
3678         (Sections_elememt_dot_assignment::set_section_addresses):
3679         Likewise.
3680         (Output_data_expression::do_write_to_buffer): Likewise.
3681         (Output_section_definition::finalize_symbols): Likewise.
3682         (Output_section_definition::set_section_addresses): Likewise.
3683
3684 2010-09-30  Doug Kwan  <dougkwan@google.com>
3685
3686         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3687
3688 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3689
3690         * target.h (Target::can_icf_inline_merge_sections): New virtual
3691         function.
3692         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3693         virtual function.
3694         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3695         virtual function.
3696         * icf.cc (get_section_contents): Inline merge sections only when
3697         target allows it.
3698
3699 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3700
3701         * configure: Regenerate.
3702
3703 2010-09-17  Ian Lance Taylor  <iant@google.com>
3704
3705         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3706         * testsuite/Makefile.am (memory_test.o): New target.
3707         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3708         memory_test.t.
3709         * testsuite/Makefile.in: Rebuild.
3710
3711 2010-09-17  Doug Kwan  <dougkwan@google.com>
3712
3713         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3714         defintion if relocation uses GOT entries of the symbol.
3715         * testsuite/icf_safe_test.sh: Fix test.
3716         * testsuite/icf_safe_so_test.sh: Fix test.
3717
3718 2010-09-16  Cary Coutant  <ccoutant@google.com>
3719
3720         * script_sections.cc (class Memory_region): Remove "NULL" from
3721         vector initializations.
3722
3723 2010-09-15  Cary Coutant  <ccoutant@google.com>
3724
3725         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3726         Resolve forwarding symbols.
3727
3728 2010-09-15  Doug Kwan  <dougkwan@google.com>
3729
3730         * gold/testsuite/script_test_3.t: Add ARM special sections.
3731         * gold/testsuite/script_test_4.t: Same.
3732         * gold/testsuite/script_test_5.t: Same.
3733         * gold/testsuite/script_test_6.t: Same.
3734         * gold/testsuite/script_test_7.t: Same.
3735         * gold/testsuite/script_test_7.t: Same.
3736         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3737
3738 2010-09-14  Cary Coutant  <ccoutant@google.com>
3739
3740         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3741         (Target_x86_64::Relocate::relocate_tls): Replace check for
3742         saw_tls_block_reloc_ with test for executable section.
3743
3744 2010-09-12  Cary Coutant  <ccoutant@google.com>
3745
3746         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3747         position-independent executables to shared libraries need dynamic
3748         relocations.
3749         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3750         position-independent executables.
3751         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3752         * testsuite/Makefile.in: Regenerate.
3753
3754 2010-09-10  Nick Clifton  <nickc@redhat.com>
3755
3756         PR gold/11997
3757         * testsuite/memory_test.t: Discard any sections that are not
3758         needed.
3759
3760 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3761
3762         PR gold/11996
3763         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3764         "This::" to work around a bug in gcc 4.2.
3765
3766         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3767
3768 2010-09-09  Rafael Espindola  <espindola@google.com>
3769
3770         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3771         sections with different PF_X flags in the same segment.
3772         (Layout::find_first_load_seg): Search all segments to find the first
3773         one.
3774         * options.h (rosegment): New.
3775
3776 2010-09-08  Rafael Espindola  <espindola@google.com>
3777
3778         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3779
3780 2010-09-08  Doug Kwan  <dougkwan@google.com>
3781
3782         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3783         (Arm_relobj::do_relocate_sections): Add new parameter for output
3784         file to match the parent.
3785         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3786         of local symbols instead of input values.  Update code to track
3787         changes in gold::relocate_section.
3788         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3789         (Sized_relobj::compute_final_local_value_internal): New methods.
3790         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3791         body into private version of Sized_relobj::compute_final_local_value.
3792         Call the inline method.
3793         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3794         merged symbol value if there is one.
3795         (Symbol_value::has_output_value): New method defintiion.
3796         (Sized_relobj::Compute_final_local_value_status): New enum type.
3797         (Sized_relobj::compute_final_local_value): New methods.
3798         (Sized_relobj::compute_final_local_value_internal): New methods.
3799         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3800         and arm_cortex_a8.sh.
3801         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3802         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3803         New tests.
3804         * Makefile.in: Regenerate.
3805         * testsuite/arm_bl_out_of_range.s: Update test.
3806         * testsuite/thumb_bl_out_of_range.s: Ditto.
3807         * testsuite/thumb_blx_out_of_range.s: Ditto.
3808         * testsuite/arm_branch_out_of_range.sh: New file.
3809         * testsuite/arm_cortex_a8.sh: Ditto.
3810         * testsuite/arm_cortex_a8_b.s: Ditto.
3811         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3812         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3813         * testsuite/arm_cortex_a8_bl.s: Ditto.
3814         * testsuite/arm_cortex_a8_blx.s: Ditto.
3815         * testsuite/arm_cortex_a8_local.s: Ditto.
3816         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3817         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3818
3819 2010-09-08  Rafael Espindola  <espindola@google.com>
3820
3821         * Makefile.am (memory_test.stdout): Run readelf with -W.
3822         * Makefile.in: Regenerate.
3823         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3824         64 bit output.
3825
3826 2010-09-08  Rafael Espindola  <espindola@google.com>
3827
3828         * script-sections.cc (Script_sections::add_memory_region): Convert
3829         field precision to int.
3830         * script.cc (script_set_section_region, script_set_section_region):
3831         Convert field precision to int.
3832
3833 2010-09-08  Rafael Espindola  <espindola@google.com>
3834
3835         * arm.cc (do_finalize_sections): Create the __exidx_start and
3836         __exdix_end symbols even when the section is missing.
3837
3838 2010-09-08  Nick Clifton  <nickc@redhat.com>
3839
3840         * README: Remove claim that MEMORY is not supported.
3841         * expression.cc (script_exp_function_origin)
3842         (script_exp_function_length): Move from here to ...
3843         * script.cc: ... here.
3844         (script_set_section_region, script_add_memory)
3845         (script_parse_memory_attr, script_include_directive): New
3846         functions.
3847         * script-sections.cc
3848         (class Memory_region): New class.
3849         (class Output_section_definition): Add set_memory_region,
3850         set_section_vma, set_section_lma and get_section_name methods.
3851         (class Script_Sections): Add add_memory_region,
3852         find_memory_region, find_memory_region_origin,
3853         find_memory_region_length and set_memory_region methods.
3854         Have set_section_addresses method walk the list of set memory
3855         regions.
3856         Extend the print methos to display memory regions.
3857         * script-sections.h: Add prototypes for new methods.
3858         Add enum for MEMORY region attributes.
3859         * yyscript.y: Add support for parsing MEMORY regions.
3860         * script-c.h: Add prototypes for new functions.
3861         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3862         * testsuite/Makefile.in: Regenerate.
3863         * testsuite/memory_test.sh: New script.
3864         * testsuite/memory_test.s: New assembler source file.
3865         * testsuite/memory_test.t: New linker script.
3866
3867 2010-08-27  Doug Kwan  <dougkwan@google.com>
3868
3869         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3870         reference override an existing dynamic weak reference.
3871         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3872         * testsuite/Makefile.in: Regenerate.
3873         * testsuite/dyn_weak_ref.sh: New file.
3874         * testsuite/dyn_weak_ref_1.c: Ditto.
3875         * testsuite/dyn_weak_ref_2.c: Ditto.
3876
3877 2010-08-27  Ian Lance Taylor  <iant@google.com>
3878
3879         * incremental.h (class Incremental_input_entry): Add virtual
3880         destructor.
3881
3882 2010-08-27  Ian Lance Taylor  <iant@google.com>
3883
3884         * testsuite/start_lib_test_3.c: Mark t3 as used.
3885
3886 2010-08-27  Nick Clifton  <nickc@redhat.com>
3887
3888         * options.cc (version_script): Fix small typo in previous
3889         whitespace tidyup.
3890
3891 2010-08-25  Nick Clifton  <nickc@redhat.com>
3892
3893         * archive.cc: Formatting fixes: Remove whitespace between
3894         typename and following asterisk.  Remove whitespace between
3895         function name and opening parenthesis.
3896         * archive.h: Likewise.
3897         * arm.cc: Likewise.
3898         * attributes.cc: Likewise.
3899         * attributes.h: Likewise.
3900         * common.cc: Likewise.
3901         * copy-relocs.cc: Likewise.
3902         * dirsearch.h: Likewise.
3903         * dynobj.cc: Likewise.
3904         * ehframe.cc: Likewise.
3905         * ehframe.h: Likewise.
3906         * expression.cc: Likewise.
3907         * fileread.cc: Likewise.
3908         * fileread.h: Likewise.
3909         * gc.h: Likewise.
3910         * gold-threads.cc: Likewise.
3911         * gold.cc: Likewise.
3912         * i386.cc: Likewise.
3913         * icf.h: Likewise.
3914         * incremental-dump.cc: Likewise.
3915         * incremental.cc: Likewise.
3916         * layout.cc: Likewise.
3917         * layout.h: Likewise.
3918         * main.cc: Likewise.
3919         * merge.cc: Likewise.
3920         * merge.h: Likewise.
3921         * object.cc: Likewise.
3922         * object.h: Likewise.
3923         * options.cc: Likewise.
3924         * options.h: Likewise.
3925         * output.cc: Likewise.
3926         * output.h: Likewise.
3927         * plugin.cc: Likewise.
3928         * plugin.h: Likewise.
3929         * powerpc.cc: Likewise.
3930         * reloc.cc: Likewise.
3931         * script-c.h: Likewise.
3932         * script-sections.cc: Likewise.
3933         * script.cc: Likewise.
3934         * stringpool.cc: Likewise.
3935         * symtab.cc: Likewise.
3936         * symtab.h: Likewise.
3937         * target.cc: Likewise.
3938         * timer.cc: Likewise.
3939         * timer.h: Likewise.
3940         * version.cc: Likewise.
3941         * x86_64.cc: Likewise.
3942
3943 2010-08-24  Nick Clifton  <nickc@redhat.com>
3944
3945         PR 11899
3946         * layout.cc (segment_precedes): Sort segments by their physical
3947         addresses, if they have been set.
3948
3949 2010-08-23  Cary Coutant  <ccoutant@google.com>
3950
3951         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3952         symbols data.
3953         (Lib_group::include_member): Unlock object after deleting its
3954         symbols data.
3955         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3956         the bug fixed here.
3957
3958 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3959             Cary Coutant  <ccoutant@google.com>
3960
3961         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3962         constructor, and set_blocker.
3963         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3964         readsyms_blocker_.
3965         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3966         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3967         * testsuite/Makefile.am (start_lib_test): New test case.
3968         * testsuite/Makefile.in: Regenerate.
3969         * testsuite/start_lib_test_main.c: New file.
3970         * testsuite/start_lib_test_1.c: New file.
3971         * testsuite/start_lib_test_2.c: New file.
3972         * testsuite/start_lib_test_3.c: New file.
3973
3974 2010-08-19  Ian Lance Taylor  <iant@google.com>
3975
3976         * Makefile.in: Rebuild with automake 1.11.1.
3977         * aclocal.m4: Likewise.
3978         * testsuite/Makefile.in: Likewise.
3979
3980 2010-08-19  Ian Lance Taylor  <iant@google.com>
3981
3982         PR 10893
3983         * i386.cc (class Output_data_plt_i386): Update declarations.
3984         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3985         local_ifuncs_ fields.
3986         (Target_i386::do_plt_section_for_global): New function.
3987         (Target_i386::do_plt_section_for_local): New function.
3988         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3989         parameter; change all callers.  Initialize global_ifuncs_ and
3990         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3991         __rel_iplt_end.
3992         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3993         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3994         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3995         symbols.
3996         (Target_i386::make_plt_section): New function, broken out of
3997         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3998         (Target_i386::make_plt_entry): Call make_plt_section.
3999         (Target_i386::make_local_ifunc_plt_entry): New function.
4000         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4001         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4002         R_386_IRELATIVE to switch.
4003         (Target_i386::Scan::global): Likewise.
4004         (Target_i386::Relocate::relocate): Likewise.
4005         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4006         switch.
4007         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4008         (Target_x86_64::do_plt_section_for_global): New function.
4009         (Target_x86_64::do_plt_section_for_local): New function.
4010         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4011         parameter; change all callers.  If doing a static link define
4012         __rela_iplt_start and __rela_iplt_end.
4013         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4014         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4015         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4016         to point to .plt.
4017         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4018         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4019         switch.
4020         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4021         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4022         R_X86_64_IRELATIVE to switch.
4023         (Target_x86_64::Scan::global): Likewise.
4024         (Target_x86_64::Relocate::relocate): Likewise.
4025         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4026         switch.
4027         * target.h (class Target): Add plt_section_for_global and
4028         plt_section_for_local functions.  Add do_plt_section_for_global
4029         and do_plt_section_for_local virtual functions.
4030         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4031         clarifying comments.
4032         (Symbol::use_plt_offset): Handle IFUNC symbol.
4033         * object.cc (Sized_relobj::Sized_relobj): Initialize
4034         local_plt_offsets_.
4035         (Sized_relobj::local_has_plt_offset): New function.
4036         (Sized_relobj::local_plt_offset): New function.
4037         (Sized_relobj::set_local_plt_offset): New function.
4038         (Sized_relobj::do_count): Handle IFUNC symbol.
4039         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4040         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4041         is_ifunc_symbol functions.
4042         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4043         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4044         local_plt_offsets_ field.
4045         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4046         * output.h (class Output_section_data): Add non-const
4047         output_section function.
4048         (class Output_data_got): Update declarations.
4049         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4050         Add use_plt_offset parameter to global and local constructors.
4051         Change all callers.  Change local_sym_index_ field to 31 bits.
4052         Change GSYM_CODE and CONSTANT_CODE accordingly.
4053         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4054         doing a static link don't set sh_link field.
4055         (Output_data_got::Got_entry::write): Use PLT offset if
4056         appropriate.
4057         (Output_data_got::add_global_plt): New function.
4058         (Output_data_got::add_local_plt): New function.
4059         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4060         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4061         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4062         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4063         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4064         IFUNC conditional.
4065         * testsuite/ifunc-sel.h: New file.
4066         * testsuite/ifuncmain1.c: New file.
4067         * testsuite/ifuncmain1vis.c: New file.
4068         * testsuite/ifuncmod1.c: New file.
4069         * testsuite/ifuncdep2.c: New file.
4070         * testsuite/ifuncmain2.c: New file.
4071         * testsuite/ifuncmain3.c: New file.
4072         * testsuite/ifuncmod3.c: New file.
4073         * testsuite/ifuncmain4.c: New file.
4074         * testsuite/ifuncmain5.c: New file.
4075         * testsuite/ifuncmod5.c: New file.
4076         * testsuite/ifuncmain6pie.c: New file.
4077         * testsuite/ifuncmod6.c: New file.
4078         * testsuite/ifuncmain7.c: New file.
4079         * configure, testsuite/Makefile.in: Rebuild.
4080
4081 2010-08-18  Ian Lance Taylor  <iant@google.com>
4082
4083         * incremental.cc
4084         (Output_section_incremental_inputs::write_input_files): Add cast
4085         to avoid signed/unsigned comparison warning.
4086         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4087
4088 2010-08-12  Cary Coutant  <ccoutant@google.com>
4089
4090         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4091
4092 2010-08-13  Ian Lance Taylor  <iant@google.com>
4093
4094         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4095
4096 2010-08-12  Cary Coutant  <ccoutant@google.com>
4097             Doug Kwan  <dougkwan@google.com>
4098
4099         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4100         defintion overrides non-weak undef, remember that the original undef
4101         is not weak.
4102         * symtab.cc (Symbol_table::sized_write_global): For undef without
4103         an original weak binding, set binding to global in output.
4104         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4105         * testsuite/Makefile.in: Regenerate.
4106         * testsuite/strong_ref_weak_def.sh: New file.
4107         * testsuite/strong_ref_weak_def_1.c: Ditto.
4108         * testsuite/strong_ref_weak_def_2.c: Ditto.
4109
4110 2010-08-12  Cary Coutant  <ccoutant@google.com>
4111
4112         * testsuite/incremental_test.sh: Rewrite.
4113         * testsuite/incremental_test_1.c: Rewrite.
4114         * testsuite/incremental_test_2.c: Rewrite.
4115
4116 2010-08-12  Cary Coutant  <ccoutant@google.com>
4117
4118         * arm.cc (Target_arm::got_size): Add const.
4119         (Target_arm::got_entry_count): New function.
4120         (Target_arm::plt_entry_count): New function.
4121         (Target_arm::first_plt_entry_offset): New function.
4122         (Target_arm::plt_entry_size): New function.
4123         (Output_data_plt_arm::entry_count): New function.
4124         (Output_data_plt_arm::first_plt_entry_offset): New function.
4125         (Output_data_plt_arm::get_plt_entry_size): New function.
4126         * i386.cc (Target_i386::got_size): Add const.
4127         (Target_i386::got_entry_count): New function.
4128         (Target_i386::plt_entry_count): New function.
4129         (Target_i386::first_plt_entry_offset): New function.
4130         (Target_i386::plt_entry_size): New function.
4131         (Output_data_plt_i386::entry_count): New function.
4132         (Output_data_plt_i386::first_plt_entry_offset): New function.
4133         (Output_data_plt_i386::get_plt_entry_size): New function.
4134         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4135         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4136         * incremental.cc: Include target.h.
4137         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4138         parameter.  Adjust all callers.  Find incremental_got_plt section.
4139         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4140         section.
4141         (Output_section_incremental_inputs::set_final_data_size): Calculate
4142         size of incremental_got_plt section.
4143         (Output_section_incremental_inputs::do_write): Write the
4144         incremental_got_plt section.
4145         (Got_plt_view_info): New struct.
4146         (Local_got_offset_visitor): New class.
4147         (Global_got_offset_visitor): New class.
4148         (Global_symbol_visitor_got_plt): New class.
4149         (Output_section_incremental_inputs::write_got_plt): New function.
4150         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4151         Add parameter.  Adjust all callers.
4152         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4153         (Incremental_inputs::got_plt_section): New function.
4154         (Incremental_inputs::got_plt_section_): New data member.
4155         (Incremental_got_plt_reader): New class.
4156         * layout.cc (Layout::create_incremental_info_sections): Add the
4157         incremental_got_plt section.
4158         * object.h (Got_offset_list::get_list): New function.
4159         (Got offset_list::for_all_got_offsets): New function.
4160         (Sized_relobj::local_got_offset_list): New function.
4161         * powerpc.cc (Target_powerpc::got_size): Add const.
4162         (Target_powerpc::got_entry_count): New function.
4163         (Target_powerpc::plt_entry_count): New function.
4164         (Target_powerpc::first_plt_entry_offset): New function.
4165         (Target_powerpc::plt_entry_size): New function.
4166         (Output_data_plt_powerpc::entry_count): New function.
4167         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4168         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4169         * sparc.cc (Target_sparc::got_size): Add const.
4170         (Target_sparc::got_entry_count): New function.
4171         (Target_sparc::plt_entry_count): New function.
4172         (Target_sparc::first_plt_entry_offset): New function.
4173         (Target_sparc::plt_entry_size): New function.
4174         (Output_data_plt_sparc::entry_count): New function.
4175         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4176         (Output_data_plt_sparc::get_plt_entry_size): New function.
4177         * symtab.h (Symbol::got_offset_list): New function.
4178         (Symbol_table::for_all_symbols): New function.
4179         * target.h (Sized_target::got_entry_count): New function.
4180         (Sized_target::plt_entry_count): New function.
4181         (Sized_target::plt_entry_size): New function.
4182         * x86_64.cc (Target_x86_64::got_size): Add const.
4183         (Target_x86_64::got_entry_count): New function.
4184         (Target_x86_64::plt_entry_count): New function.
4185         (Target_x86_64::first_plt_entry_offset): New function.
4186         (Target_x86_64::plt_entry_size): New function.
4187         (Output_data_plt_x86_64::entry_count): New function.
4188         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4189         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4190
4191 2010-08-12  Cary Coutant  <ccoutant@google.com>
4192
4193         * archive.cc: Include incremental.h.
4194         (Archive::Archive): Initialize incremental_info_.
4195         (Archive::include_member): Record archive members in incremental info.
4196         (Add_archive_symbols::run): Record begin and end of an archive in
4197         incremental info.
4198         (Lib_group::include_member): Record objects in incremental info.
4199         * archive.h (Incremental_archive_entry): Forward declaration.
4200         (Archive::set_incremental_info): New member function.
4201         (Archive::incremental_info): New member function.
4202         (Archive::Unused_symbol_iterator): New class.
4203         (Archive::unused_symbols_begin): New member function.
4204         (Archive::unused_symbols_end): New member function.
4205         (Archive::incremental_info_): New data member.
4206         * incremental-dump.cc (find_input_containing_global): New function.
4207         (dump_incremental_inputs): Dump new incremental info sections.
4208         * incremental.cc: Include symtab.h.
4209         (Output_section_incremental_inputs): New class.
4210         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4211         new incremental info sections.
4212         (Sized_incremental_binary::do_check_inputs): Likewise.
4213         (Incremental_inputs::report_archive): Remove.
4214         (Incremental_inputs::report_archive_begin): New function.
4215         (Incremental_inputs::report_archive_end): New function.
4216         (Incremental_inputs::report_object): New function.
4217         (Incremental_inputs::finalize_inputs): Remove.
4218         (Incremental_inputs::report_input_section): New function.
4219         (Incremental_inputs::report_script): Rewrite.
4220         (Incremental_inputs::finalize): Do nothing but finalize string table.
4221         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4222         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4223         (Incremental_inputs::create_data_sections): New function.
4224         (Incremental_inputs::relocs_entsize): New function.
4225         (Output_section_incremental_inputs::set_final_data_size): New function.
4226         (Output_section_incremental_inputs::do_write): New function.
4227         (Output_section_incremental_inputs::write_header): New function.
4228         (Output_section_incremental_inputs::write_input_files): New function.
4229         (Output_section_incremental_inputs::write_info_blocks): New function.
4230         (Output_section_incremental_inputs::write_symtab): New function.
4231         * incremental.h (Incremental_script_entry): Forward declaration.
4232         (Incremental_object_entry): Forward declaration.
4233         (Incremental_archive_entry): Forward declaration.
4234         (Incremental_inputs): Forward declaration.
4235         (Incremental_inputs_header_data): Remove.
4236         (Incremental_inputs_header): Remove.
4237         (Incremental_inputs_header_write): Remove.
4238         (Incremental_inputs_entry_data): Remove.
4239         (Incremental_inputs_entry): Remove.
4240         (Incremental_inputs_entry_write): Remove.
4241         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4242         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4243         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4244         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4245         Likewise.
4246         (Incremental_input_entry): New class.
4247         (Incremental_script_entry): New class.
4248         (Incremental_object_entry): New class.
4249         (Incremental_archive_entry): New class.
4250         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4251         (Incremental_inputs::report_inputs): Remove.
4252         (Incremental_inputs::report_archive): Remove.
4253         (Incremental_inputs::report_archive_begin): New function.
4254         (Incremental_inputs::report_archive_end): New function.
4255         (Incremental_inputs::report_object): Change prototype.
4256         (Incremental_inputs::report_input_section): New function.
4257         (Incremental_inputs::report_script): Change prototype.
4258         (Incremental_inputs::get_reloc_count): New function.
4259         (Incremental_inputs::set_reloc_count): New function.
4260         (Incremental_inputs::create_data_sections): New function.
4261         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4262         (Incremental_inputs::inputs_section): New function.
4263         (Incremental_inputs::symtab_section): New function.
4264         (Incremental_inputs::relocs_section): New function.
4265         (Incremental_inputs::get_stringpool): Add const.
4266         (Incremental_inputs::command_line): Add const.
4267         (Incremental_inputs::inputs): Remove.
4268         (Incremental_inputs::command_line_key): New function.
4269         (Incremental_inputs::input_file_count): New function.
4270         (Incremental_inputs::input_files): New function.
4271         (Incremental_inputs::relocs_entsize): New function.
4272         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4273         (Incremental_inputs::finalize_inputs): Remove.
4274         (Incremental_inputs::Input_info): Remove.
4275         (Incremental_inputs::lock_): Remove.
4276         (Incremental_inputs::inputs_): Change type.
4277         (Incremental_inputs::inputs_map_): Remove.
4278         (Incremental_inputs::current_object_entry_): New data member.
4279         (Incremental_inputs::inputs_section_): New data member.
4280         (Incremental_inputs::symtab_section_): New data member.
4281         (Incremental_inputs::relocs_section_): New data member.
4282         (Incremental_inputs::reloc_count_): New data member.
4283         (Incremental_inputs_reader): New class.
4284         (Incremental_symtab_reader): New class.
4285         (Incremental_relocs_reader): New class.
4286         * layout.cc (Layout::finalize): Move finalization of incremental info
4287         and creation of incremental info sections to follow finalization of
4288         symbol table.  Set offsets for postprocessing sections.
4289         (Layout::create_incremental_info_sections): Call
4290         Incremental_inputs::create_data_sections.  Add incremental symtab
4291         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4292         sections to layout after input sections.
4293         * layout.h (struct Timespec): Forward declaration.
4294         (Layout::incremental_inputs): Add const.
4295         (Layout::create_incremental_info_sections): Add parameter.
4296         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4297         * object.cc: Include incremental.h.
4298         (Relobj::finalize_incremental_relocs): New function.
4299         (Sized_relobj::do_layout): Record input sections in incremental info.
4300         * object.h (Object::output_section): New function.
4301         (Object::output_section_offset): Moved from Relobj.
4302         (Object::get_incremental_reloc_base): New function.
4303         (Object::get_incremental_reloc_count): New function.
4304         (Object::do_output_section): New function.
4305         (Object::do_output_section_offset): Moved from Relobj.
4306         (Object::do_get_incremental_reloc_base): New function.
4307         (Object::do_get_incremental_reloc_count): New function.
4308         (Object::Object): Initialize new data members.
4309         (Relobj::output_section): Renamed do_output_section and moved to
4310         protected.
4311         (Relobj::output_section_offset): Moved to Object.
4312         (Relobj::do_get_incremental_reloc_base): New function.
4313         (Relobj::do_get_incremental_reloc_count): New function.
4314         (Relobj::allocate_incremental_reloc_counts): New function.
4315         (Relobj::count_incremental_reloc): New function.
4316         (Relobj::finalize_incremental_relocs): New function.
4317         (Relobj::next_incremental_reloc_index): New function.
4318         (Relobj::reloc_counts_): New data member.
4319         (Relobj::reloc_bases_): New data member.
4320         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4321         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4322         (Sized_relobj::incremental_relocs_scan): New function.
4323         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4324         (Sized_relobj::incremental_relocs_write): New function.
4325         (Sized_relobj::incremental_relocs_write_reltype): New function.
4326         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4327         incremental link.
4328         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4329         archives and object files elsewhere.
4330         (Add_symbols::run): Report object files here.
4331         (Finish_group::run): Report end of archive at end of group.
4332         * reloc.cc: Include layout.h, incremental.h.
4333         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4334         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4335         (Sized_relobj::incremental_relocs_scan): New function.
4336         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4337         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4338         (Sized_relobj::incremental_relocs_write): New function.
4339         (Sized_relobj::incremental_relocs_write_reltype): New function.
4340         * script.cc (read_input_script): Rewrite test for incremental link.
4341         Change call to Incremental_inputs::report_script.
4342         * symtab.h (Symbol_table::first_global_index): New function.
4343         (Symbol_table::output_count): New function.
4344
4345 2010-08-12  Doug Kwan  <dougkwan@google.com>
4346
4347         * arm.cc (Target_arm::merge_object_attributes): Check command line
4348         options --no-wchar-size-warning and --no-enum-size-warning.
4349         * options.h (General_options): Add ld-compatible options
4350         --no-enum-size-warning and --no-wchar-size-warning.
4351
4352 2010-08-04  Ian Lance Taylor  <iant@google.com>
4353
4354         * x86_64.cc (Target_x86_64::Scan::local): Use
4355         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4356         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4357         (Target_x86_64::Scan::global): Likewise.
4358         (Target_x86_64::Relocate::relocate): Likewise.
4359         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4360         Likewise.
4361
4362 2010-08-03  Cary Coutant  <ccoutant@google.com>
4363
4364         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4365         to reserve space in merged_strings vector. Keep total input size
4366         for stats.
4367         (Output_merge_string::do_print_merge_stats): Print total input size.
4368         * merge.h (Output_merge_string): Add input_size_ field.
4369         * stringpool.cc (Stringpool_template::string_length): Move
4370         implementations out of Stringpool_template class and place in
4371         stringpool.h.
4372         * stringpool.h (string_length): Move out of Stringpool_template.
4373
4374 2010-08-03  Ian Lance Taylor  <iant@google.com>
4375
4376         PR 11712
4377         * layout.cc (relaxation_loop_body): If address of load segment is
4378         set, adjust address to include headers if possible.
4379
4380 2010-08-03  Ian Lance Taylor  <iant@google.com>
4381
4382         * version.cc (version_string): Bump to 1.10.
4383
4384 2010-08-03  Ian Lance Taylor  <iant@google.com>
4385
4386         PR 11805
4387         * layout.h (enum Output_section_order): Define.
4388         (class Layout): Update declarations.
4389         * layout.cc (Layout::get_output_section): Add order parameter.
4390         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4391         is_first_non_relro parameters.  Change all callers.
4392         (Layout::choose_output_section): Likewise.
4393         (Layout::add_output_section_data): Likewise.
4394         (Layout::make_output_section): Likewise.  Set order.
4395         (Layout::default_section_order): New function.
4396         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4397         * output.cc (Output_section::Output_section): Initialize order_.
4398         Don't initialize deleted fields.
4399         (Output_segment::Output_segment): Don't initialize deleted
4400         fields.
4401         (Output_segment::add_output_section_to_load): New function
4402         replacing add_output_section.  Change all callers to call this or
4403         add_output_section_to_nonload.
4404         (Output_segment::add_output_section_to_nonload): New function.
4405         (Output_segment::remove_output_section): Rewrite.
4406         (Output_segment::add_initial_output_data): Likewise.
4407         (Output_segment::has_any_data_sections): Likewise.
4408         (Output_segment::is_first_section_relro): Likewise.
4409         (Output_segment::maximum_alignment): Likewise.
4410         (Output_segment::has_dynamic_reloc): New function replacing
4411         dynamic_reloc_count.  Change all callers.
4412         (Output_segment::has_dynamic_reloc_list): New function replacing
4413         dynamic_reloc_count_list.  Change all callers.
4414         (Output_segment::set_section_addresses): Rewrite.
4415         (Output_segment::set_offset): Rewrite.
4416         (Output_segment::find_first_and_last_list): Remove.
4417         (Output_segment::set_tls_offsets): Rewrite.
4418         (Output_segment::first_section_load_address): Likewise.
4419         (Output_segment::output_section_count): Likewise.
4420         (Output_segment::section_with_lowest_load_address): Likewise.
4421         (Output_segment::write_section_headers): Likewise.
4422         (Output_segment::print_sections_to_map): Likewise.
4423         * output.h (class Output_data): Remove dynamic_reloc_count_
4424         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4425         (Output_data::add_dynamic_reloc): Rewrite.
4426         (Output_data::has_dynamic_reloc): New function.
4427         (Output_data::dynamic_reloc_count): Remove.
4428         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4429         is_last_relro_, is_first_non_relro_, is_interp_,
4430         is_dynamic_linker_section_ fields.  Add order and set_order
4431         functions.  Remove is_relro_local, set_is_relro_local,
4432         is_last_relro, set_is_last_relro, is_first_non_relro,
4433         set_is_first_non_relro functions, is_interp, set_is_interp,
4434         is_dynamic_linker_section, and set_is_dynamic_linker_section
4435         functions.
4436         (class Output_segment): Change Output_data_list from std::list to
4437         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4438         output_bss_ fields.  Update declarations.
4439
4440 2010-08-02  Ian Lance Taylor  <iant@google.com>
4441
4442         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4443         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4444         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4445
4446 2010-08-02  Ian Lance Taylor  <iant@google.com>
4447
4448         PR 11855
4449         * script.cc (Script_options::Script_options): Initialize
4450         symbol_definitions_ and symbol_references_.
4451         (Script_options::add_symbol_assignment): Update
4452         symbol_definitions_ and symbol_references_.
4453         (Script_options::add_symbol_reference): New function.
4454         (script_symbol): New function.
4455         * script.h (class Script_options): Add symbol_definitions_ and
4456         symbol_references_ fields.
4457         (Script_options::referenced_const_iterator): New type.
4458         (Script_options::referenced_begin): New function.
4459         (Script_options::referenced_end): New function.
4460         (Script_options::is_referenced): New function.
4461         (Script_options::any_unreferenced): New function.
4462         * script-c.h (script_symbol): Declare.
4463         * yyscript.y (exp): Call script_symbol.
4464         * symtab.cc: Include "script.h".
4465         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4466         Change all callers.  Check symbols referenced by scripts.
4467         (Symbol_table::add_undefined_symbols_from_command_line): Add
4468         layout parameter.  Change all callers.
4469         (Symbol_table::do_add_undefined_symbols_from_command_line):
4470         Likewise.  Break out loop body.  Check symbols referenced by
4471         scripts.
4472         (Symbol_table::add_undefined_symbol_from_command_line): New
4473         function broken out of
4474         do_add_undefined_symbols_from_command_line.
4475         * symtab.h (class Symbol_table): Update declarations.
4476         * archive.cc: Include "layout.h".
4477         (Archive::should_include_member): Add layout parameter.  Change
4478         all callers.  Check for symbol mentioned in expression.
4479         * archive.h (class Archive): Update declaration.
4480         * object.cc (Sized_relobj::do_should_include_member): Add layout
4481         parameter.
4482         * object.h (Object::should_include_member): Add layout parameter.
4483         Change all callers.
4484         (Object::do_should_include_member): Add layout parameter.
4485         (class Sized_relobj): Update declaration.
4486         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4487         parameter.
4488         * dynobj.h (class Sized_dynobj): Update declaration.
4489         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4490         layout parameter.
4491         * plugin.h (class Sized_pluginobj): Update declaration.
4492
4493 2010-08-02  Ian Lance Taylor  <iant@google.com>
4494
4495         PR 11866
4496         * output.cc (Output_segment::set_offset): Search for the first and
4497         last sections rather than assuming that the list is in order.
4498         (Output_segment::find_first_and_last_list): New function.
4499         * output.h (class Output_segment): Update declarations.
4500         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4501         (relro_strip_test_SOURCES): New variable.
4502         (relro_strip_test_DEPENDENCIES): New variable.
4503         (relro_strip_test_LDFLAGS): New variable.
4504         (relro_strip_test_LDADD): New variable.
4505         (relro_strip_test.so): New target.
4506
4507 2010-08-02  Ian Lance Taylor  <iant@google.com>
4508
4509         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4510         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4511         (Target_i386::got_tlsdesc_section): New function.
4512         (Target_i386::got_section): Create space for GOT entries for
4513         TLSDESC relocations.
4514         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4515         R_386_TLS_GOTDESC.
4516         (Target_i386::Scan::global): Likewise.
4517         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4518         using TLSDESC GOT.
4519         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4520         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4521         (Target_x86_64::got_tlsdesc_section): New function.
4522         (Target_x86_64::got_section): Create space for GOT entries for
4523         TLSDESC relocations.
4524         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4525         R_386_TLS_GOTDESC.
4526         (Target_x86_64::Scan::global): Likewise.
4527         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4528         using TLSDESC GOT.
4529
4530 2010-08-02  Ian Lance Taylor  <iant@google.com>
4531
4532         * testsuite/final_layout.sh: Use dc to convert from hex to
4533         decimal.
4534
4535 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4536
4537         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4538         paramter to the call to gold::gc_process_relocs.
4539         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4540         paramter to the call to gold::gc_process_relocs.
4541         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4542         parameter to the call to gold::gc_process_relocs.
4543         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4544         template parameter to the call to gold::gc_process_relocs.
4545         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4546         paramter to the call to gold::gc_process_relocs.
4547         * gc.h (get_embedded_addend_size): New function.
4548         (gc_process_relocs): Save the size of the reloc for use by ICF.
4549         * icf.cc (get_section_contents): Get the addend from the text section
4550         for SHT_REL relocation sections.
4551         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4552         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4553         * int_encoding.h (read_from_pointer): New overloaded function.
4554         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4555         * testsuite/icf_sht_rel_addend_test.sh: New file.
4556         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4557         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4558
4559 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4560
4561         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4562         * Makefile.in: Regenerate.
4563         * testsuite/Makefile.in: Regenerate.
4564
4565 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4566
4567         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4568         * gold/testsuite/debug_msg.cc: Likewise.
4569         * gold/testsuite/odr_violation1.cc
4570         * gold/testsuite/odr_violation2.cc
4571
4572 2010-07-21  Cary Coutant  <ccoutant@google.com>
4573
4574         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4575         string, and length fields.
4576         (Output_merge_string::Merged_strings_list): New type.
4577         (Output_merge_string::Merged_strings_lists): New typedef.
4578         (Output_merge_string): Replace merged_strings_ with
4579         merged_strings_lists_.
4580         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4581         Merged_strings_list per input object and section.  Don't store pointer
4582         to the string.  Don't store length with each merged string entry.
4583         (Output_merge_string::finalize_merged_data): Loop over list of merged
4584         strings lists.  Recompute length of each merged string.
4585
4586 2010-07-15  Cary Coutant  <ccoutant@google.com>
4587
4588         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4589         here.
4590
4591 2010-07-14  Ian Lance Taylor  <iant@google.com>
4592
4593         * descriptors.cc (Descriptors::open): Report correct name in error
4594         message.
4595
4596 2010-07-13  Doug Kwan  <dougkwan@google.com>
4597
4598         * arm.cc (Arm_input_section::Arm_input_section): For a
4599         SHT_ARM_EXIDX section, always keeps the input sections.
4600         (Arm_input_section::set_exidx_section_link): New method.
4601         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4602         has_errors_ to false.
4603         (Arm_exidx_input_section::has_errors,
4604         Arm_exidx_input_section::set_has_errors): New methods.
4605         (Arm_exidx_input_section::has_errors_): New data member.
4606         (Arm_relobj::get_exidx_shndx_list): New method.
4607         (Arm_output_section::append_text_sections_to_list): Do not skip
4608         section without SHF_EXECINSTR.
4609         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4610         errors.
4611         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4612         section header.  Make error messages more verbose.  Check for
4613         a non-executable section linked to an EXIDX section.
4614         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4615         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4616         check that there is no deferred EXIDX section if we exit early.
4617         Instead of not making an EXIDX section in case of an error, make one
4618         and set the has_errors flag of it.
4619         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4620         in a relocatable link.
4621         (Target_arm::do_relax): Look for the EXIDX output section instead of
4622         assuming that it is called .ARM.exidx.
4623         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4624         section list.  Do not check for SHF_EXECINSTR section flags but
4625         skip any input section with errors.
4626         * output.cc (Output_section::Output_section): Initialize
4627         always_keeps_input_sections_ to false.
4628         (Output_section::add_input_section): Check for
4629         always_keeps_input_sections_.
4630         *  output.h (Output_section::always_keeps_input_sections,
4631         Output_section::set_always_keeps_input_sections): New methods.
4632         (Output_section::always_keeps_input_sections): New data member.
4633
4634 2010-07-13  Rafael Espindola  <espindola@google.com>
4635
4636         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4637         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4638
4639 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4640             Ian Lance Taylor  <iant@google.com>
4641
4642         * output.h (Output_section_lookup_maps::add_merge_section):
4643         Correct check of whether value was inserted.
4644         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4645         (Output_section_lookup_maps::add_relaxed_input_section):
4646         Likewise.
4647         * arm.cc (Target_arm::got_section): Remove used local os.
4648         * i386.cc (Target_i386::got_section): Likewise.
4649         * x86_64.cc (Target_x86_64::got_section): Likewise.
4650         * sparc.cc (Target_sparc::got_section): Likewise.
4651         (Target_sparc::relocate): Remove unused local have_got_offset.
4652         * powerpc.cc (Target_powerpc::relocate): Likewise.
4653
4654 2010-07-13  Ian Lance Taylor  <iant@google.com>
4655
4656         * compressed_output.cc (zlib_decompress): Fix signature in
4657         !HAVE_ZLIB_H case.
4658
4659         * archive.cc (Archive::include_member): Unlock an external member
4660         of a thin archive.  Don't bother to delete an object we know is
4661         NULL.
4662
4663 2010-07-12  Cary Coutant  <ccoutant@google.com>
4664
4665         * compressed_output.cc (zlib_decompress): New function.
4666         (get_uncompressed_size): New function.
4667         (decompress_input_section): New function.
4668         * compressed_output.h (get_uncompressed_size): New function.
4669         (decompress_input_section): New function.
4670         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4671         Handle compressed debug sections.
4672         * layout.cc (is_compressed_debug_section): New function.
4673         (Layout::output_section_name): Map compressed section names to
4674         canonical names.
4675         * layout.h (is_compressed_debug_section): New function.
4676         (is_debug_info_section): Recognize compressed debug sections.
4677         * merge.cc: Include compressed_output.h.
4678         (Output_merge_data::do_add_input_section): Handle compressed
4679         debug sections.
4680         (Output_merge_string::do_add_input_section): Handle compressed
4681         debug sections.
4682         * object.cc: Include compressed_output.h.
4683         (Sized_relobj::Sized_relobj): Initialize new data members.
4684         (build_compressed_section_map): New function.
4685         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4686         * object.h (Object::section_is_compressed): New method.
4687         (Object::do_section_is_compressed): New method.
4688         (Sized_relobj::Compressed_section_map): New type.
4689         (Sized_relobj::do_section_is_compressed): New method.
4690         (Sized_relobj::compressed_sections_): New data member.
4691         * output.cc (Output_section::add_input_section): Handle compressed
4692         debug sections.
4693         * reloc.cc: Include compressed_output.h.
4694         (Sized_relobj::write_sections): Handle compressed debug sections.
4695
4696 2010-07-08  Cary Coutant  <ccoutant@google.com>
4697
4698         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4699         weak when resolving to a dynamic def.
4700         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4701         for weak undef/dynamic def cases. Adjust callers.
4702         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4703         undef_binding_weak_.
4704         (Symbol_table::sized_write_globals): Adjust symbol binding.
4705         (Symbol_table::sized_write_symbol): Add binding parameter.
4706         * symtab.h (Symbol::set_undef_binding): New method.
4707         (Symbol::is_undef_binding_weak): New method.
4708         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4709         (Symbol_table::should_override): Add new parameter.
4710         (Symbol_table::sized_write_symbol): Add new parameter.
4711
4712         * testsuite/weak_undef_file1.cc: Add new test case.
4713         * testsuite/weak_undef_file2.cc: Fix header comment.
4714         * testsuite/weak_undef_test.cc: Add new test case.
4715
4716 2010-06-29  Doug Kwan  <dougkwan@google.com>
4717
4718         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4719         Initialize USE_SYMBOL_.
4720         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4721         definition.
4722         (Arm_reloc_property::uses_symbol_): New data member declaration.
4723         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4724         uses symbol value and symbol is undefined but not weakly undefined.
4725
4726 2010-06-28  Rafael Espindola  <espindola@google.com>
4727
4728         * plugin.cc (Plugin::load): Use dlerror.
4729
4730 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4731
4732         * symtab.cc (detect_odr_violations): When reporting an ODR
4733         violation, report an object where the symbol is defined.
4734
4735 2010-06-25  Doug Kwan  <dougkwan@google.com>
4736
4737         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4738         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4739         definition.
4740         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4741         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4742         target hook to detect function points.
4743         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4744         * icf.h (Icf::check_section_for_function_pointers): Change type of
4745         parameter SECTION_NAME to const reference to std::string.  Use
4746         target hook to determine if section may have unsafe pointers.
4747         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4748         method definition.
4749
4750 2010-06-21  Rafael Espindola  <espindola@google.com>
4751
4752         * fileread.cc (Input_file::find_fie): New
4753         (Input_file::open): Use Input_file::find_fie.
4754         * fileread.h (Input_file::find_fie): New
4755         * plugin.cc (set_extra_library_path): New.
4756         (Plugin::load): Add set_extra_library_path to the transfer vector.
4757         (Plugin_manager::set_extra_library_path): New.
4758         (Plugin_manager::add_input_file): Use the extra search path if set.
4759         (set_extra_library_path(): New.
4760         * plugin.h (Plugin_manager): Add set_extra_library_path and
4761         extra_search_path_.
4762
4763 2010-06-19  Cary Coutant  <ccoutant@google.com>
4764
4765         * layout.cc (gdb_sections): Add .debug_types.
4766         (lines_only_debug_sections): Likewise.
4767
4768 2010-06-18  Rafael Espindola  <espindola@google.com>
4769
4770         * plugin.cc (add_input_file,add_input_library)
4771         (Plugin_manager::add_input_file): Make filename arguments const.
4772         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4773         const.
4774
4775 2010-06-16  Doug Kwan  <dougkwan@google.com>
4776
4777         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4778         .ARM.attributes section if we have not merged any input
4779         attributes sections.
4780
4781 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4782
4783         * arm.cc: Allow combining objects with no EABI version
4784         information.
4785
4786 2010-06-15  Rafael Espindola  <espindola@google.com>
4787
4788         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4789
4790 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4791
4792         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4793         (struct iovec): Correct !HAVE_READV definition.
4794
4795 2010-06-10  Cary Coutant  <ccoutant@google.com>
4796
4797         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4798         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4799         reloc sections.
4800         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4801
4802         PR 11683
4803         * symtab.h (Symbol::is_placeholder): New member function.
4804         * target-reloc.h (relocate_section): Check for placeholder symbols.
4805
4806         * testsuite/Makefile.am (plugin_test_8): New test.
4807         (plugin_test_9): New test.
4808         * testsuite/Makefile.in: Regenerate.
4809
4810 2010-06-09  Nick Clifton  <nickc@redhat.com>
4811
4812         * yyscript.y (input_list_element): Allow strings prefixed with
4813         the '-' character.  Treat these as libraries.
4814         * script.cc (script_add_library): New function.  Adds a library
4815         specified by "-l<name>" found in an input script.
4816         * script-c.h: Add prototype for script_add_library.
4817
4818 2010-06-07  Doug Kwan  <dougkwan@google.com>
4819
4820         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4821         Restrict stub-group size to be within long conditional branch
4822         range when working around cortex-A8 erratum.
4823
4824 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4825
4826         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4827         #ifdef typo.
4828
4829 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4830
4831         PR gold/11658
4832         * output.cc
4833         (Output_section::Input_section_sort_entry::compare_section_ordering):
4834         Change to return non-zero correctly.
4835         (Output_section::Input_section_sort_section_order_index_compare
4836         ::operator()): Change to fix ambiguity in comparisons.
4837
4838 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4839
4840         * gold.h (is_wildcard_string): New function.
4841         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4842         (Layout::layout_eh_frame): Ditto.
4843         (Layout::find_section_order_index): New method.
4844         (Layout::read_layout_from_file): New method.
4845         * layout.h (Layout::find_section_order_index): New method.
4846         (Layout::read_layout_from_file): New method.
4847         (Layout::input_section_position_): New private member.
4848         (Layout::input_section_glob_): New private member.
4849         * main.cc (main): Call read_layout_from_file here.
4850         * options.h (--section-ordering-file): New option.
4851         * output.cc (Output_section::input_section_order_specified_): New
4852         member.
4853         (Output_section::Output_section): Initialize new member.
4854         (Output_section::add_input_section): Add new parameter.
4855         Keep input sections when --section-ordering-file is used.
4856         (Output_section::set_final_data_size): Sort input sections when
4857         section ordering file is specified.
4858         (Output_section::Input_section_sort_entry): Add new parameter.
4859         Check sorting type.
4860         (Output_section::Input_section_sort_entry::compare_section_ordering):
4861         New method.
4862         (Output_section::Input_section_sort_compare::operator()): Change to
4863         consider section_order_index.
4864         (Output_section::Input_section_sort_init_fini_compare::operator()):
4865         Change to consider section_order_index.
4866         (Output_section::Input_section_sort_section_order_index_compare
4867         ::operator()): New method.
4868         (Output_section::sort_attached_input_sections): Change to sort
4869         according to section order when specified.
4870         (Output_section::add_input_section<32, true>): Add new parameter.
4871         (Output_section::add_input_section<64, true>): Add new parameter.
4872         (Output_section::add_input_section<32, false>): Add new parameter.
4873         (Output_section::add_input_section<64, false>): Add new parameter.
4874         * output.h (Output_section::add_input_section): Add new parameter.
4875         (Output_section::input_section_order_specified): New
4876         method.
4877         (Output_section::set_input_section_order_specified): New method.
4878         (Input_section::Input_section): Initialize section_order_index_.
4879         (Input_section::section_order_index): New method.
4880         (Input_section::set_section_order_index): New method.
4881         (Input_section::section_order_index_): New member.
4882         (Input_section::Input_section_sort_section_order_index_compare): New
4883         struct.
4884         (Output_section::input_section_order_specified_): New member.
4885         * script-sections.cc (is_wildcard_string): Delete and move modified
4886         method to gold.h.
4887         (Output_section_element_input::Output_section_element_input): Modify
4888         call to is_wildcard_string.
4889         (Output_section_element_input::Input_section_pattern
4890         ::Input_section_pattern): Ditto.
4891         (Output_section_element_input::Output_section_element_input): Ditto.
4892         * testsuite/Makefile.am (final_layout): New test case.
4893         * testsuite/Makefile.in: Regenerate.
4894         * testsuite/final_layout.cc: New file.
4895         * testsuite/final_layout.sh: New file.
4896
4897 2010-06-01  Rafael Espindola  <espindola@google.com>
4898
4899         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4900
4901 2010-06-01  Rafael Espindola  <espindola@google.com>
4902
4903         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4904         visibility of symbols.
4905
4906 2010-05-27  Doug Kwan  <dougkwan@google.com>
4907
4908         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4909         from start of output section instead of address for a local symbol
4910         in a merged or relaxed section when doing a relocatable link.
4911
4912 2010-05-26  Rafael Espindola  <espindola@google.com>
4913
4914        PR 11604
4915         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4916         adding sections the garbage collector removed.
4917         * gold/testsuite/Makefile.am: Add test.
4918         * gold/testsuite/Makefile.in: Regenerate.
4919         * gold/testsuite/plugin_test_7.sh: New.
4920         * gold/testsuite/plugin_test_7_1.c: New.
4921         * gold/testsuite/plugin_test_7_2.c: New.
4922
4923 2010-05-26  Rafael Espindola  <espindola@google.com>
4924
4925         * script-sections.cc (Output_section_definition::set_section_addresses):
4926         Check for --section-start.
4927
4928 2010-05-26  Doug Kwan  <dougkwan@google.com>
4929
4930         * arm.cc (Arm_scan_relocatable_relocs): New class.
4931         (Target_arm::relocate_special_relocatable): New method.
4932         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4933         (Arm_relocate_functions::thumb_branch_common): Same.
4934         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4935         instead of Default_scan_relocatable_relocs.
4936         * target-reloc.h (relocate_for_relocatable): Let target handle
4937         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4938         * target.h (Sized_target::relocate_special_relocatable): New method.
4939
4940 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4941
4942         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4943
4944 2010-05-23  Doug Kwan  <dougkwan@google.com>
4945
4946         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4947         instead of a cast.
4948         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4949         with a direct branch, not a conditional branch, to a stub.
4950         * merge.cc (Output_merge_base::record_input_section): New method
4951         defintion.
4952         (Output_merge_data::do_add_input_section): Record input section if
4953         keeps-input-sections flag is set.
4954         (Output_merge_string::do_add_input_section): Ditto.
4955         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4956         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4957         INPUT_SECTIONS_.
4958         (Output_merge_base::keeps_input_sections,
4959         Output_merge_base::set_keeps_input_sections,
4960         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4961         method definitions.
4962         (Output_merge_base::Input_sections): New type declaration.
4963         (Output_merge_base::input_sections_begin,
4964         Output_merge_base::input_sections_end,
4965         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4966         (Output_merge_base::bool keeps_input_sections_,
4967         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4968         Output_merge_base::input_sections_): New data members.
4969         (Output_merge_data::do_set_keeps_input_sections): New method
4970         defintion.
4971         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4972         * output.cc (Output_section::Input_section::relobj): Move method
4973         defintion from class declaration to here and handle merge sections.
4974         (Output_section::Input_section::shndx): Ditto.
4975         (Output_section::Output_section): Remove initializations of removed
4976         data members and initialize new data member LOOKUP_MAPS_.
4977         (Output_section::add_input_section): Set keeps-input-sections flag
4978         for a newly created merge output section as appropriate.  Adjust code
4979         to use Output_section_lookup_maps class.
4980         (Output_section::add_relaxed_input_section): Adjst code for lookup
4981         maps code refactoring.
4982         (Output_section::add_merge_input_section): Add a new parameter
4983         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4984         class.  If adding input section to a newly created merge output
4985         section fails, remove the new merge section.
4986         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4987         Adjust code for use of the Output_section_lookup_maps class.
4988         (Output_section::find_merge_section): Ditto.
4989         (Output_section::build_lookup_maps): New method defintion.
4990         (Output_section::find_relaxed_input_section): Adjust code to use
4991         Output_section_lookup_maps class.
4992         (Output_section::get_input_sections): Export merge sections.  Adjust
4993         code to use Output_section_lookup_maps class.
4994         (Output_section:::add_script_input_section): Adjust code to use
4995         Output_section_lookup_maps class.  Update lookup maps for merge
4996         sections also.
4997         (Output_section::discard_states): Use Output_section_lookup_maps.
4998         (Output_section::restore_states): Same.
4999         * output.h (Merge_section_properties): Move class defintion out of
5000         Output_section.
5001         (Output_section_lookup_maps): New class.
5002         (Output_section::Input_section::is_merge_section): New method
5003         defintion.
5004         (Output_section::Input_section::relobj): Move defintion out of class
5005         defintion.  Declare method only.
5006         (Output_section::Input_section::shndx): Ditto.
5007         (Output_section::Input_section::output_merge_base): New method defintion.
5008         (Output_section::Input_section::u2_.pomb): New union field.
5009         (Output_section::Merge_section_by_properties_map,
5010         Output_section::Output_section_data_by_input_section_map,
5011         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5012         Remove types.
5013         (Output_section::add_merge_input_section): Add new parameter
5014         KEEPS_INPUT_SECTIONS.
5015         (Output_section::build_lookup_maps): New method declaration.
5016         (Output_section::merge_section_map_,
5017         Output_section::merge_section_by_properties_map_,
5018         Output_section::relaxed_input_section_map_,
5019         Output_section::is_relaxed_input_section_map_valid_): Remove data
5020         members.
5021         (Output_section::lookup_maps_): New data member.
5022
5023 2010-05-21  Doug Kwan  <dougkwan@google.com>
5024
5025         PR gold/11619
5026         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5027         avoid a compilation error.
5028
5029 2010-05-19  Rafael Espindola  <espindola@google.com>
5030
5031         * script-sections.cc (Output_section_definition::allocate_to_segment):
5032         Update the phdrs_list even when the output section is NULL.
5033         * testsuite/Makefile.am: Add test.
5034         * testsuite/Makefile.in: Regenerate.
5035         * testsuite/script_test_9.cc: New.
5036         * testsuite/script_test_9.sh: New.
5037         * testsuite/script_test_9.t: New.
5038
5039 2010-05-19  Doug Kwan  <dougkwan@google.com>
5040
5041         * arm.cc (Arm_input_section::original_size): New method.
5042         (Arm_input_section::do_addralign): Add a cast.
5043         (Arm_input_section::do_output_offset): Remove static cast.
5044         (Arm_input_section::original_addralign,
5045          Arm_input_section::original_size_): Change type to uint32_t.
5046         (Arm_input_section::init): Add safe casts for section alignment
5047         and size.
5048         (Arm_input_section::set_final_data_size): Do not set address and
5049         offset of stub table.
5050         (Arm_output_section::fix_exidx_coverage): Change use of of
5051         Output_section::Simple_input_section to that of
5052         Output_section::Input_section.
5053         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5054         except for the first pass.
5055         * output.cc (Output_section::get_input_sections): Change type of
5056         input_sections to std::list<Input_section>.
5057         (Output_section::add_script_input_section): Rename from
5058         Output_section::add_simple_input_section.  Change type of SIS
5059         parameter from Simple_input_section to Input_section.
5060         * output.h (Output_section::Simple_input_section): Remove class.
5061         (Output_section::Input_section): Change class visibility to public.
5062         (Output_section::Input_section::addralign): Use stored alignments
5063         for special input sections if set.
5064         (Output_section::Input_section::set_addralign): New method.
5065         (Output_section::get_input_sections): Change parameter type from
5066         list of Simple_input_section to list of Input_section.
5067         (Output_section::add_script_input_section): Rename from
5068         Output_section::add_simple_input_section. Change first parameter's
5069         type from Simple_input_section to Input_section and remove the
5070         second and third parameters.
5071         * script-sections.cc (Input_section::Input_section_list): Change
5072         type to list of Output_section::Input_section/
5073         (Input_section_info::Input_section_info): Change parameter type of
5074         INPUT_SECTION to Output_section::Input_section.
5075         (Input_section_info::input_section): Change return type.
5076         (Input_section_info::input_section_): Change type to
5077         Output_section::Input_section.
5078         (Output_section_element_input::set_section_addresses): Adjust code
5079         to use Output_section::Input_section instead of
5080         Output_section::Simple_input_section.  Adjust code for renaming
5081         of Output_section::add_simple_input_section.
5082         (Orphan_output_section::set_section_addresses): Ditto.
5083
5084 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5085
5086         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5087         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5088
5089 2010-05-18  Rafael Espindola  <espindola@google.com>
5090
5091         * options.cc (General_options::finalize): Handle -nostdlib.
5092         * options.h (nostdlib): New option.
5093         * script.cc (script_add_search_dir): Handle -nostdlib.
5094
5095 2010-05-12  Doug Kwan  <dougkwan@google.com>
5096
5097         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5098         attributes section only if there no attributes section after merging.
5099         (Target_arm::merge_object_attributes): Move value of
5100         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5101         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5102         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5103         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5104         and arm_attr_merge_7.stdout.
5105         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5106         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5107         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5108         arm_attr_merge_7b.o): New rules.
5109         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5110         arm_attr_merge_7
5111         * testsuite/Makefile.in: Regenerate.
5112         * testsuite/arm_attr_merge.sh: New file.
5113         * testsuite/arm_attr_merge_[67][ab].s: Same.
5114
5115 2010-05-05  Nick Clifton  <nickc@redhat.com>
5116
5117         * po/es.po: Updated Spanish translation.
5118
5119 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5120
5121         * Makefile.am (install-exec-local): Properly install gold as
5122         default cross linker.
5123         * Makefile.in: Regenerated.
5124
5125 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5126             Nick Clifton  <nickc@redhat.com>
5127
5128         * configure.ac (install_as_default): Define and set to false
5129         unless --enable-gold or --enable-gold=both/gold has been
5130         specified.
5131         * configure: Regenerate.
5132
5133         * Makefile.am (install-exec-local): Install the executable as
5134         'ld.gold'.  If install_as_default is true then also install it as
5135         'ld'.
5136         * Makefile.in: Regenerated.
5137
5138 2010-04-24  Ian Lance Taylor  <iant@google.com>
5139
5140         * layout.cc (Layout::layout_reloc): In relocatable link don't
5141         combine reloc sections for grouped sections.
5142
5143 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5144
5145         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5146         sections that are not ordinary to icf.
5147         * icf.cc (get_section_contents): Handle relocation pointing to section
5148         with no object or shndx information.
5149         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5150         * testsuite/Makefile.in: Regenerate.
5151         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5152         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5153
5154 2010-04-22  Ian Lance Taylor  <iant@google.com>
5155
5156         * expression.cc (Expression::Expression_eval_info): Add
5157         result_alignment_pointer field.
5158         (Expression::eval_with_dot): Add result_alignment_pointer
5159         parameter.  Change all callers.
5160         (Expression::eval_maybe_dot): Likewise.
5161         (class Binary_expression): Add alignment_pointer parameter to
5162         left_value and right_value.  Change all callers.
5163         (BINARY_EXPRESSION): Set result alignment.
5164         (class Trinary_expression): Add alignment_pointer parameter to
5165         arg2_value and arg3_value.  Change all callers.
5166         (Trinary_cond::value): Set result alignment.
5167         (Max_expression::value, Min_expression::value): Likewise.
5168         (Align_expression::value): Likewise.
5169         * script-sections.cc (class Sections_element): Add dot_alignment
5170         parameter to set_section_addresses virtual function.  Update
5171         instantiations.
5172         (class Output_section_element): Likewise.
5173         (Script_sections::create_segments): Add dot_alignment parameter.
5174         Change all callers.
5175         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5176         (Script_sections::set_phdrs_clause_addresses): Likewise.
5177         * script-sections.h: Update declarations.
5178         * script.h: Update declarations.
5179         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5180         min_p_align.
5181         * testsuite/script_test_3.t: Set large alignment.
5182         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5183         segment has expected alignment.
5184
5185 2010-04-22  Nick Clifton  <nickc@redhat.com>
5186
5187         * po/gold.pot: Updated by the Translation project.
5188         * po/vi.po: Updated Vietnamese translation.
5189
5190 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5191
5192         * testsuite/Makefile.am (check_PROGRAMS): Add
5193         icf_virtual_function_folding_test.
5194         * testsuite/Makefile.in: Regenerated.
5195
5196 2010-04-15  Andrew Haley  <aph@redhat.com>
5197
5198         * options.h (merge_exidx_entries): New option.
5199         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5200         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5201         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5202         (Target_arm::merge_exidx_entries): New function.
5203         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5204         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5205         to Arm_exidx_fixup constructor.
5206         Add new arg, merge_exidx_entries.
5207         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5208         Arm_output_section::fix_exidx_coverage.
5209
5210 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5211
5212         * icf.cc (get_section_contents): Check for preemptible functions.
5213         Ignore addend when appropriate.
5214         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5215         section folded.
5216         (add_from_relobj): Check for section folded.
5217         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5218         * symtab.h (should_add_dynsym_entry): Add new parameter.
5219         * target-reloc.h (scan_relocs): Check for section folded.
5220         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5221         Check reloc types for function pointers in shared objects.
5222         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5223         case.
5224         (icf_preemptible_functions_test): New test case.
5225         (icf_string_merge_test): New test case.
5226         * testsuite.Makefile.in: Regenerate.
5227         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5228         bar_glob.  Refactor code.
5229         * testsuite/icf_preemptible_functions_test.cc: New file.
5230         * testsuite/icf_preemptible_functions_test.sh: New file.
5231         * testsuite/icf_string_merge_test.cc: New file.
5232         * testsuite/icf_string_merge_test.sh: New file.
5233         * testsuite/icf_virtual_function_folding_test.cc: New file.
5234         * testsuite/icf_virtual_function_folding_test.sh: New file.
5235
5236 2010-04-14  Doug Kwan  <dougkwan@google.com>
5237
5238         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5239         for local symbol recounting if we remove a section due to ICF.
5240         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5241         there are no regular objects in input.
5242
5243 2010-04-13  Doug Kwan  <dougkwan@google.com>
5244
5245         * arm.cc (Arm_input_section::set_final_data_size): Compute
5246         accurate final data size instead of using current data size.
5247
5248 2010-04-09  Doug Kwan  <dougkwan@google.com>
5249
5250         * layout.cc (Layout::choose_output_section): Handle script section
5251         types.
5252         (Layout::make_output_section_for_script): Add section type parameter.
5253         Handle script section types.
5254         * layout.h (Layout::make_output_section_for_script): Add section
5255         type parameter.
5256         * output.cc (Output_section::Output_section): Initialize data member
5257         is_noload_.
5258         (Output_section::do_reset_address_and_file_offset): Do not set address
5259         to 0 if section is a NOLOAD section.
5260         * output.h (Output_section::is_noload): New method.
5261         (Output_section::set_is_noload): Ditto.
5262         (Output_section::is_noload_): New data member.
5263         * script-c.h (Script_section_type): New enum type.
5264         (struct Parser_output_section_header): Add new file section_type.
5265         * script-sections.cc (Sections_element::output_section_name): Add
5266         parameter for returning script section type.
5267         (Output_section_definition::output_section_name): Ditto.
5268         (Output_section_definition::section_type)P; New method.
5269         (Output_section_definiton::script_section_type_name): Ditto.
5270         (Output_section_definition::script_section_type_): New data member.
5271         (Output_section_definition::Output_section_definition): Initialize
5272         data member Output_section_definition::script_section_type_.
5273         (Output_section_definition::create_sections): Pass script section type
5274         to Layout::make_output_section_for_script.
5275         (Output_section_definition::output_section_name): Return script
5276         section type to caller.
5277         (Output_section_definition::set_section_address): Do not advance
5278         dot value and load address if section type is NOLOAD.  Set address
5279         of NOLOAD sections regardless of section flags.
5280         (Output_section_definition::print): Print section type if it is
5281         not SCRIPT_SECTION_TYPE_NONE.
5282         (Output_section_definition::section_type): New method.
5283         (Output_section_definition::script_section_type_name): Ditto.
5284         (Script_sections::output_section_name): Add new parameter
5285         PSECTION_TYPE for returning script section type.  Pass it to
5286         section elements.  Handle discard sections.
5287         (Sort_output_sections::operator()): Handle NOLOAD sections.
5288         * script-sections.h (Script_sections::Section_type): New enum type.
5289         (Script_sections::output_section_name): Add a new parameter for
5290         returning script section type.
5291         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5292         INFO and NOLOAD.
5293         * yyscript.y (union): Add new field SECTION_TYPE.
5294         (COPY, DSECT, INFO, NOLOAD): New tokens.
5295         (opt_address_and_section_type): Change type to output_section_header.
5296         (section_type): New non-terminal
5297         (section_header): Handle section type.
5298         (opt_address_and_section_type): Return section type value.
5299
5300 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5301
5302         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5303         * testsuite/plugin_common_test_2.c (foo): Likewise.
5304
5305 2010-04-08  Doug Kwan  <dougkwan@google.com>
5306
5307         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5308         Output_merge_data.
5309         * output.cc (Output_section::add_merge_input_section): Simplify
5310         code and return status of Output_merge_base::add_input_section.
5311         Update merge section map only if Output_merge_base::add_input_section
5312         returns true.
5313
5314 2010-04-07  Doug Kwan  <dougkwan@google.com>
5315
5316         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5317         if section is marked as containing instructions but has no mapping
5318         symbols.
5319         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5320         correct section index.
5321         (Arm_relobj::find_linked_text_section): Ditto.
5322
5323 2010-04-07  Cary Coutant  <ccoutant@google.com>
5324
5325         * archive.cc (include_member): Destroy Read_symbols_data object before
5326         releasing file.
5327         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5328         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5329         (Read_symbols_data::~Read_symbols_data) New destructor.
5330         (Section_relocs::Section_relocs) New constructor.
5331         (Section_relocs::~Section_relocs) New destructor.
5332         (Read_relocs_data::Read_relocs_data) New constructor.
5333         (Read_relocs_data::~Read_relocs_data) New destructor.
5334         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5335         pointers to NULL after deleting.
5336
5337 2010-04-07  Doug Kwan  <dougkwan@google.com>
5338
5339         * arm.cc: Replace "endianity" with "endianness" in comments.
5340         (Arm_exidx_cantunwind): Ditto.
5341         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5342         (Arm_relobj::merge_flags_and_attributes): New method.
5343         (Arm_relobj::merge_flags_and_attributes_): New data member.
5344         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5345         (Arm_relobj::scan_sections_for_stubs): Ditto.
5346         (Arm_relobj::do_read_symbols): Check to see if we really want to
5347         merge processor-specific flags and attributes.  Exit early if
5348         an object is empty except for section names and the undefined symbol.
5349         (Target_arm::do_finalize_sections): Move check for ELF format to
5350         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5351         attributes from a regular object only when we have determined that
5352         it is aapropriate.  Do not create an .ARM.attributes section in
5353         output if there is no regular input object.
5354         (Target_arm::merge_processor_specific_flags): Check
5355         --warn-mismatch before printing any error.
5356         (Target_arm::merge_object_attributes): Ditto.
5357         * gold.cc (queue_middle_tasks): Handle the case in which there is
5358         no regular object in input.
5359         * options.cc (General_options::parse_EB): New method.
5360         (General_options::parse_EL): Same.
5361         (General_options::General_options): Initialize endianness_.
5362         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5363         New options.
5364         (General_options::Endianness): New enum.
5365         (General_options::endianness): New method.
5366         (General_options::endianness_): New data member.
5367         * parameters.cc (Parameters::set_options): Check target endianness.
5368         (Parameters::set_target_once): Ditto.
5369         (Parameters::check_target_endianness): New method.
5370         (parameters_force_valid_target): If either -EL or -EB is specified,
5371         use it to define endianness of default target.
5372         * parameters.h (Parameters::check_target_endianness): New method
5373         declaration.
5374         * target.h (class Target): Change "endianity" to "endianness"
5375         in comments.
5376
5377 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5378
5379         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5380         * configure: Regenerate.
5381         * Makefile.in: Regenerate.
5382         * testsuite/Makefile.in: Regenerate.
5383
5384 2010-04-06  Cary Coutant  <ccoutant@google.com>
5385
5386         gcc PR lto/42757
5387         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5388         prevailing definitions of common symbols.
5389         * testsuite/plugin_test_6.sh: New test case.
5390         * testsuite/plugin_common_test_1.c: New test case.
5391         * testsuite/plugin_common_test_2.c: New test case.
5392         * testsuite/Makefile.am (plugin_test_6): New test case.
5393         * testsuite/Makefile.in: Regenerate.
5394
5395 2010-04-06  Nick Clifton  <nickc@redhat.com>
5396
5397         * po/vi.po: New Vietnamese translation.
5398
5399 2010-03-30  Doug Kwan  <dougkwan@google.com>
5400
5401         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5402
5403 2010-03-25  Doug Kwan  <dougkwan@google.com>
5404
5405         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5406         to avoid a conversion warning on a 32-bit host.
5407
5408 2010-03-24  Ian Lance Taylor  <iant@google.com>
5409
5410         * testsuite/script_test_3.t: Add a TLS segment.
5411         * testsuite/Makefile.am (check_PROGRAMS): Add
5412         tls_phdrs_script_test.
5413         (tls_phdrs_script_test_SOURCES): Define.
5414         (tls_phdrs_script_test_DEPENDENCIES): Define.
5415         (tls_phdrs_script_test_LDFLAGS): Define.
5416         (tls_phdrs_script_test_LDADD): Define.
5417         * testsuite/Makefile.in: Rebuild.
5418
5419 2010-03-23  Cary Coutant  <ccoutant@google.com>
5420
5421         * fileread.cc (find_or_make_view): Fix comment.
5422
5423 2010-03-23  Ian Lance Taylor  <iant@google.com>
5424
5425         * script-sections.cc (class Orphan_section_placement): Define
5426         PLACE_TLS and PLACE_TLS_BSS.
5427         (Orphan_section_placement::Orphan_section_placement): Initialize
5428         new places.
5429         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5430         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5431         (tls_script_test_SOURCES): Define.
5432         (tls_script_test_DEPENDENCIES): Define.
5433         (tls_script_test_LDFLAGS): Define.
5434         (tls_script_test_LDADD): Define.
5435         * testsuite/Makefile.in: Rebuild.
5436
5437 2010-03-22  Doug Kwan  <dougkwan@google.com>
5438
5439         * arm.cc (Arm_relocate_functions::abs8,
5440         Arm_relocate_functions::abs16): Use correct check for overflow
5441         specified in the ARM ELF specs.
5442         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5443         target of a BLX instruction specially.
5444         (Reloc_stub::stub_type_for_reloc): Ditto.
5445         (Relocate::relocate): Use symbolic names instead of numeric relocation
5446         codes to report error.
5447         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5448         workaround.
5449         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5450         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5451         thumb2_blx_out_of_range.stdout
5452         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5453         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5454         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5455         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5456         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5457         thumb2_blx_in_range, thumb2_blx_in_range.o,
5458         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5459         thumb2_blx_out_of_range.o): New rules.
5460         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5461         thumb2_blx_in_range and thumb2_blx_out_of_range.
5462         * testsuite/Makefile.in: Regenerate.
5463         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5464         * testsuite/thumb_blx_in_range.s: New file.
5465         * testsuite/thumb_blx_out_of_range.s: New file.
5466
5467 2010-03-22  Rafael Espindola  <espindola@google.com>
5468
5469         * archive.cc (Should_include): Move to archive.h.
5470         (should_include_member): Make it a member of Archive.
5471         (Lib_group): New.
5472         (Add_lib_group_symbols): New.
5473         * archive.h: Include options.h.
5474         (Archive_member): Moved from Archive.
5475         (Should_include): Moved from archive.cc.
5476         (Lib_group): New.
5477         (Add_lib_group_symbols): New.
5478         * dynobj.cc (do_should_include_member): New.
5479         * dynobj.h (do_should_include_member): New.
5480         * gold.cc (queue_initial_tasks): Update call to queue.
5481         * main.cc (main): Print lib group stats.
5482         * object.cc (do_should_include_member): New.
5483         * object.h: Include archive.h.
5484         (Object::should_include_member): New.
5485         (Object::do_should_include_member): New.
5486         (Sized_relobj::do_should_include_member): New.
5487         * options.cc (General_options::parse_start_lib): New.
5488         (General_options::parse_end_lib): New.
5489         (Input_arguments::add_file): Handle lib groups.
5490         (Input_arguments::start_group): Check we are not in a lib.
5491         (Input_arguments::start_lib): New.
5492         (Input_arguments::end_lib): New.
5493         * options.h (General_options): Add start_lib and end_lib.
5494         (Input_argument::lib_): New.
5495         (Input_argument::lib): New.
5496         (Input_argument::is_lib): New.
5497         (Input_file_lib): New.
5498         (Input_arguments::in_lib_): New.
5499         (Input_arguments::in_lib): New.
5500         (Input_arguments::start_lib): New.
5501         (Input_arguments::end_lib_): New.
5502         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5503         in unused members as preempted.
5504         (Sized_pluginobj::do_should_include_member): New.
5505         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5506         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5507         return the blocker.
5508         (Read_symbols::do_whole_lib_group): New.
5509         (Read_symbols::do_lib_group): New.
5510         (Read_symbols::do_read_symbols): Handle lib groups.
5511         (Read_symbols::get_name): Handle lib groups.
5512         * readsyms.h (Read_symbols): Add an archive member pointer.
5513         (Read_symbols::do_whole_lib_group): New.
5514         (Read_symbols::do_lib_group): New.
5515         (Read_symbols::member_): New.
5516         * script.cc (read_input_script): Update call to queue_soon.
5517
5518 2010-03-19  Doug Kwan  <dougkwan@google.com>
5519
5520         * arm.cc (Stub_table::Stub_table): Initialize new data members
5521         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5522         (Stub_table::add_reloc_stub): Assign stub offset and update
5523         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5524         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5525         New data members.
5526         (Stub_table::update_data_size_and_addralign): Use
5527         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5528         instead of going over all reloc stubs.
5529         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5530         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5531         Stringpool_template::offset_ to size of Stringpool_char.
5532         (Stringpool_template::new_key_offset): Remove code to initialize
5533         Stringpool_template::offset_.
5534         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5535         Stringpool_template::offset_ to zero.
5536
5537 2010-03-15  Doug Kwan  <dougkwan@google.com>
5538
5539         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5540         offset_.
5541         (Stringpool_template::new_key_offset): New method.
5542         (Stringpool_template::add_string): Assign offsets when adding new
5543         strings.
5544         (Stringpool_template::set_string_offsets): Do not set string offsets
5545         when not optimizing.
5546         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5547         member size_.
5548         (Chunked_vector::clear): Clear size_.
5549         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5550         (Chunked_vector::size): Return size_.
5551         (Chunked_vector::push_back): Use size_ to find insert position.
5552         (Chunked_vector::size_): New data member.
5553         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5554         (Stringpool_template::new_key_offset): New method declaration.
5555         (Stringpool_template::offset_): New data member.
5556
5557 2010-03-15   Rafael Espindola  <espindola@google.com>
5558
5559         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5560         Add_symbols' constructor.
5561         * readsyms.h (Add_symbols): Remove the input_group member.
5562
5563 2010-03-10  Ian Lance Taylor  <iant@google.com>
5564
5565         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5566         target to ask whether a reference to a symbol requires a stack
5567         split.
5568         * target.h (Target::is_call_to_non_split): New function.
5569         (Target::do_is_call_to_non_split): Declare virtual function.
5570         * target.cc: Include "symtab.h".
5571         (Target::do_is_call_to_non_split): New function.
5572         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5573
5574 2010-03-10  Cary Coutant  <ccoutant@google.com>
5575
5576         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5577         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5578         (File_read::open[2]): Add whole_file_view_ to list of views.
5579         (File_read::make_view): Remove test of whole_file_view_.
5580         (File_read::find_or_make_view): Create whole_file_view_ if
5581         necessary.
5582         (File_read::clear_views): Replace bool parameter with enum;
5583         adjust all callers.  Don't delete views with permanent data;
5584         do delete cached views and views from archives if
5585         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5586         if clearing the corresponding view.
5587         * fileread.h (File_read::Clear_views_mode): New enum.
5588         (File_read::View::is_permanent_view): New method.
5589         (File_read::clear_views): Replace bool parameter
5590         with enum; adjust all callers.
5591         * options.h (General_options): Change keep_files_mapped option;
5592         add map_whole_files.
5593         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5594         releasing the file.
5595         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5596         the file.
5597
5598 2010-03-10  David S. Miller  <davem@davemloft.net>
5599
5600         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5601
5602 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5603
5604         * icf.cc (get_section_contents): Add '@' marker after processing the
5605         merge reloc.
5606
5607 2010-03-08  Doug Kwan  <dougkwan@google.com>
5608
5609         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5610         due to a conversion warning.
5611         (Arm_relobj::update_output_local_symbol_count): Check for local
5612         symbol with unset output index.
5613
5614 2010-03-05  Ian Lance Taylor  <iant@google.com>
5615
5616         * options.h (class General_options): Add --spare-dynamic-tags.
5617         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5618         --spare-dynamic-tags.
5619
5620 2010-03-05  Ian Lance Taylor  <iant@google.com>
5621
5622         * incremental.cc: Include "libiberty.h".
5623
5624 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5625
5626         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5627         function, is_info_ member.
5628         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5629         (Versions::Versions): Update caller.
5630         (Versions::define_base_version): Likewise.
5631         (Versions::add_def): Likewise.
5632
5633 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5634
5635         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5636         (Scan::possible_function_pointer_reloc): New function.
5637         (Scan::local_reloc_may_be_function_pointer): Change to call
5638         possible_function_pointer_reloc.
5639         (Scan::global_reloc_may_be_function_pointer): Ditto.
5640         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5641         relocations in ".data.rel.ro._ZTV" section.
5642         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5643         * testsuite/icf_safe_so_test.cc: Ditto.
5644         * testsuite/icf_safe_test.cc: Ditto.
5645         * testsuite/icf_safe_test.sh: Ditto.
5646
5647 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5648             Ian Lance Taylor  <iant@google.com>
5649
5650         * target-reloc.h (relocate_section): Check the symbol table index
5651         for -1U before setting the local symbol index.
5652         (scan_relocatable_relocs): If copying the relocation, record that
5653         the local symbol is required.
5654         * object.h (Symbol_value::is_output_symtab_index_set): New
5655         function.
5656         (Symbol_value::may_be_discarded_from_output_symtab): New
5657         function.
5658         (Symbol_value::has_output_symtab_entry): New function.
5659         (Symbol_value::needs_output_symtab_entry): Remove.
5660         (Symbol_value::output_symtab_index): Make sure the symbol index is
5661         set.
5662         (Symbol_value::set_output_symtab_index): Make sure the symbol
5663         index is not set.  Make sure the new index is valid.
5664         (Symbol_value::set_must_have_output_symtab_entry): New function.
5665         (Symbol_value::has_output_dynsym_entry): New function.
5666         (Symbol_value::set_output_dynsym_index): Make sure the new index
5667         is valid.
5668         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5669         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5670         local symbol if permitted.
5671         (Sized_relobj::do_finalize_local_symbols): Call
5672         is_output_symtab_index_set rather than needs_output_symtab_entry.
5673         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5674         rather than needs_output_symtab_entry.  Call
5675         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5676         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5677         is_output_symtab_index_set rather than needs_output_symtab_entry.
5678         * testsuite/discard_locals_relocatable_test.c: New file.
5679         * testsuite/discard_locals_test.sh: Test -r.
5680         * testsuite/Makefile.am (check_DATA): Add
5681         discard_locals_relocatable_test1.syms,
5682         discard_local_relocatable_test2.syms.
5683         (MOSTLYCLEANFILES): Likewise.  Also add
5684         discard_locals_relocatable_test1.lout and
5685         discard_locals_relocatable_test2.out.
5686         (discard_locals_relocatable_test1.syms): New target.
5687         (discard_locals_relocatable_test.o): New target.
5688         (discard_locals_relocatable_test1.out): New target.
5689         (discard_locals_relocatable_test2.syms): New target.
5690         (discard_locals_relocatable_test2.out): New target.
5691         (various): Add missing ../ld-new dependencies.
5692         * testsuite/Makefile.in: Rebuild.
5693
5694 2010-03-03  Nick Clifton  <nickc@redhat.com>
5695
5696         * po/fi.po: New Finnish translation.
5697
5698 2010-03-01  Doug Kwan  <dougkwan@google.com>
5699
5700         * layout.cc (Layout::Layout): Force section types of .init_array*,
5701         .preinit_array* and .fini_array* sections.
5702         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5703         Fix check of return value of std::string::find.().
5704         (Output_section::Input_section_sort_compare::operator()): Remove
5705         comment about .init_array.
5706         (Output_section::Input_section_sort_init_fini_compare::operator()):
5707         New method.
5708         (Output_section::sort_attached_input_sections): Handle .init_array
5709         and .fini_array specially.
5710         * output.h (Output_section::Inut_section_sort_compare): Update
5711         comment.
5712         (Output_section::Input_section_sort_init_fini_compare): New struct.
5713
5714 2010-02-26  Doug Kwan  <dougkwan@google.com>
5715
5716         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5717         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5718         * testsuite/debug_msg.sh: Avoid matching source line number for
5719         use of global variable undef_int.
5720
5721 2010-02-26  Doug Kwan  <dougkwan@google.com>
5722
5723         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5724         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5725         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5726         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5727         * options.cc (General_options::General_options): Initialize member
5728         fix_v4bx_.
5729         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5730         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5731         and rm_no_fix_v4bx.stdout
5732         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5733         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5734         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5735         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5736         and arm_no_fix_v4bx.
5737         * Makefile.in: Regenerate.
5738         * testsuite/arm_fix_v4bx.s: New file.
5739         * testsuite/arm_fix_v4bx.sh: Ditto.
5740
5741 2010-02-24  Doug Kwan  <dougkwan@google.com>
5742
5743         * arm.cc (Target_arm::got_section): Make the .got section the first
5744         non RELRO section in the data segment.
5745         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5746         suffixes of section names.
5747
5748 2010-02-24  Doug Kwan  <dougkwan@google.com>
5749
5750         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5751         flags and attributes merging if an input file is a binary file.
5752         * fileread.cc (Input_file::open): Record format of original file.
5753         * fileread.h (Input_file::Format): New enum type.
5754         (Input_file::Input_file): Initialize data member format_.
5755         (Input_file::format): New method definition.
5756         (Input_file::format_):: New data member.
5757
5758 2010-02-24  Doug Kwan  <dougkwan@google.com>
5759
5760         * arm.cc (Arm_output_data_got): New class.
5761         (ARM_TCB_SIZE): New constant
5762         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5763         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5764         If user uses a script with a SECTIONS clause, issue only a warning
5765         for a misplaced EXIDX input section.  Otherwise, issue an error.
5766         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5767         garbage collection.
5768         (Target_arm::got_mode_index_entry): Handle static linking.
5769         (Target_arm::Scan::local): Ditto.
5770         (Target_arm::Scan::global): Ditto.
5771         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5772         all incorrectly implemented relocations.
5773         (Target_arm::fix_exidx_coverage): Pass layout to
5774         Arm_output_section::fix_exidx_coverage.
5775         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5776         from ".ARM.exidx." and ".ARM.extab.".
5777
5778 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5779
5780         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5781         section if it does not already exist.
5782         * attributes.cc (Attributes_section_data::Attributes_section_data):
5783         Don't crash if size is zero.
5784
5785 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5786             Ian Lance Taylor  <iant@google.com>
5787
5788         * gold.cc (queue_middle_tasks): If no input files were opened,
5789         exit.
5790         * workqueue.h (Task_function::Task_function): Assert that there is
5791         a blocker.
5792
5793 2010-02-22  Doug Kwan  <dougkwan@google.com>
5794
5795         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5796         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5797         types to avoid warnings due to different uint64_t implementations
5798         on different hosts.
5799
5800 2010-02-21  Doug Kwan  <dougkwan@google.com>
5801
5802         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5803         handling of the maximum backward branch offset.
5804         (Arm_relocate_functions::thumb_branch_common): Ditto.
5805         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5806         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5807         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5808         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5809         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5810         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5811         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5812         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5813         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5814         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5815         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5816         thumb2_bl_out_of_range.o): New rules.
5817         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5818         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5819         thumb2_bl_out_of_range
5820         * testsuite/Makefile.in: Regenerate.
5821         * testsuite/arm_bl_in_range.s: New file.
5822         * testsuite/arm_bl_out_of_range.s: Ditto.
5823         * testsuite/arm_branch_in_range.sh: Ditto.
5824         * testsuite/arm_branch_range.t: Ditto.
5825         * testsuite/thumb2_branch_range.t: Ditto.
5826         * testsuite/thumb_bl_in_range.s: Ditto.
5827         * testsuite/thumb_bl_out_of_range.s: Ditto.
5828         * testsuite/thumb_branch_range.t: Ditto.
5829
5830 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5831
5832         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5833         Add reloc offset information.
5834         * icf.cc (get_section_contents): Change iterators to point to the new
5835         vectors. Add reloc offset information to the contents.
5836         * icf.h (Icf::Sections_reachable_info): New typedef.
5837         (Icf::Sections_reachable_list): New typedef.
5838         (Icf::Offset_info): New typedef.
5839         (Icf::Reloc_info): New struct typedef.
5840         (Icf::Reloc_info_list): New typedef.
5841         (Icf::symbol_reloc_list): Delete method.
5842         (Icf::addend_reloc_list): Delete method.
5843         (Icf::section_reloc_list): Delete method.
5844         (Icf::reloc_info_list): New method.
5845         (Icf::reloc_info_list_): New member.
5846
5847 2010-02-19  Doug Kwan  <dougkwan@google.com>
5848
5849         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5850         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5851         * arm.cc (Arm_relocation_functions): New forward declaration.
5852         (Target_arm::Target_arm): Initialize new data members
5853         got_mod_index_offset_ and tls_base_symbol_defined_.
5854         (Target_arm::Relocate::relocate_tls): New method.
5855         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5856          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5857         New methods.
5858         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5859         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5860         (Target_arm::got_mod_index_offset_,
5861         Target_arm::tls_base_symbol_defined_): New data members.
5862         (Target_arm::Scan::local, Target::Scan::global,
5863         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5864         relocations.
5865
5866 2010-02-18  Doug Kwan  <dougkwan@google.com>
5867
5868         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5869         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5870         text section as a parameter becuase some broken tools may not set
5871         the link in section header.
5872         (Target_arm::has_got_section): New method.
5873         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5874         without any mapping symbol as data only.  Remove warning.
5875         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5876         link in its section header, try to discover the link by inspecting the
5877         REL31 relocation at the beginning of the section.
5878         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5879         in error message.
5880         (Target_arm::Scan::global): Treat any reference to the symbol
5881         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5882
5883 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5884
5885         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5886         (Scan::global_reloc_may_be_function_pointer): New function.
5887         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5888         (Scan::global_reloc_may_be_function_pointer): New function.
5889         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5890         (Scan::global_reloc_may_be_function_pointer): New function.
5891         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5892         (Scan::global_reloc_may_be_function_pointer): New function.
5893         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5894         (Scan::global_reloc_may_be_function_pointer): New function.
5895         (Scan::possible_function_pointer_reloc): New function.
5896         (Target_x86_64::can_check_for_function_pointers): New function.
5897         * gc.h (gc_process_relocs): Scan relocation types to determine if
5898         function pointers were taken for targets that support it.
5899         * icf.cc (Icf::find_identical_sections): Include functions for
5900         folding in safe ICF whose pointer is not taken.
5901         * icf.h (Secn_fptr_taken_set): New typedef.
5902         (fptr_section_id_): New member.
5903         (section_has_function_pointers): New function.
5904         (set_section_has_function_pointers): New function.
5905         (check_section_for_function_pointers): New function.
5906         * options.h: Fix comment for safe ICF option.
5907         * target.h (can_check_for_function_pointers): New function.
5908         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5909         Modify icf_safe_test for X86-64.
5910         * testsuite/Makefile.in: Regenerate.
5911         * testsuite/icf_safe_so_test.cc: New file.
5912         * testsuite/icf_safe_so_test.sh: New file.
5913         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5914         (main): Change to take pointer to function kept_func_3.
5915         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5916         folding is done correctly for X86-64.
5917
5918 2010-02-12  David S. Miller  <davem@davemloft.net>
5919
5920         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5921         is_symbolless parameter.
5922         (Output_reloc<SHT_REL>::is_symbolless): New.
5923         (Output_reloc<SHT_REL>::is_symbolless_): New.
5924         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5925         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5926         (Output_reloc<SHT_RELA>::is_symbolless): New.
5927         (Output_data_reloc::add_global): Handle is_symbolless.
5928         (Output_data_reloc::add_global_relative): Likewise.
5929         (Output_data_reloc::add_local): Likewise.
5930         (Output_data_reloc::add_local_relative): Likewise.
5931         (Output_data_reloc::add_symbolless_global_addend): New.
5932         (Output_data_reloc::add_symbolless_local_addend): New.
5933         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5934         is_symbolless.
5935         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5936         instead of ->is_relative_
5937         (Output_reloc::write): Likewise.
5938         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5939         (Output_reloc::write_rel): Simplify.
5940
5941         * sparc.cc (Target_sparc::Scan::local): Use
5942         ->add_symbolless_local_addend as needed.
5943         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5944         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5945         based upon relocation offset.
5946
5947 2010-02-11  Doug Kwan  <dougkwan@google.com>
5948
5949         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5950         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5951         beginning of function.
5952         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5953         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5954         parameter is_32bit in calls to should_apply_static_reloc.
5955         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5956         (check_DATA): Add arm_abs_global.stdout.
5957         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5958         arm_abs_global.stdout): New rules.
5959         (MOSTLLYCLEANFILES): Add arm_abs_global
5960         * Makefile.in: Regenerate.
5961         * testsuite/arm_abs_global.s: New file.
5962         * testsuite/arm_abs_global.sh: Ditto.
5963         * testsuite/arm_abs_lib.s: Ditto.
5964
5965 2010-02-11  Ian Lance Taylor  <iant@google.com>
5966
5967         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5968         Read_relocs task.
5969         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5970         Allocate_commons_task first.
5971         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5972         task, rather than symtab_lock_.
5973         (Gc_process_relocs::~Gc_process_relocs): New function.
5974         (Gc_process_relocs::is_runnable): Check this_blocker_.
5975         (Gc_process_relocs::locks): Use next_blocker_ rather than
5976         blocker_.
5977         (Scan_relocs::~Scan_relocs): New function.
5978         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5979         symtab_lock_.
5980         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5981         next_blocker_.
5982         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5983         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5984         constructor accordingly.
5985         (class Gc_process_relocs): Likewise.
5986         (class Scan_relocs): Likewise.
5987         * common.h (class Allocate_commons_task): Remove symtab_lock_
5988         field, and corresponding constructor parameter.
5989         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5990         symtab_lock_.
5991         (Allocate_commons_task::locks): Likewise.
5992
5993 2010-02-11  Ian Lance Taylor  <iant@google.com>
5994
5995         * gold-threads.h (class Once): Define.
5996         (class Initialize_lock): Rewrite as child of Once.
5997         * gold-threads.cc (class Once_initialize): Define.
5998         (once_pointer_control): New static variable.
5999         (once_pointer, once_arg): New static variables.
6000         (c_run_once): New static function.
6001         (Once::Once, Once::run_once, Once::internal_run): New functions.
6002         (class Initialize_lock_once): Remove.
6003         (initialize_lock_control): Remove.
6004         (initialize_lock_pointer): Remove.
6005         (initialize_lock_once): Remove.
6006         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6007         (Initialize_lock::initialize): Rewrite.
6008         (Initialize_lock::do_run_once): New function.
6009         * archive.cc (Archive::interpret_header): Only clear name if it is
6010         not already empty.
6011         * fileread.cc: Include "gold-threads.h"
6012         (file_counts_lock): New static variable.
6013         (file_counts_initialize_lock): Likewise.
6014         (File_read::release): Only increment counts when using --stats.
6015         Use a lock around the increment.
6016         * parameters.cc (class Set_parameters_target_once): Define.
6017         (set_parameters_target_once): New static variable.
6018         (Parameters::Parameters): Move here from parameters.h.
6019         (Parameters::set_target): Rewrite.
6020         (Parameters::set_target_once): New function.
6021         (Parameters::clear_target): Move here and rewrite.
6022         * parameters.h (class Parameters): Update declarations.  Add
6023         set_parameters_target_once_ field.
6024         (Parameters::Parameters): Move to parameters.cc.
6025         (Parameters::clear_target): Likewise.
6026         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6027         task.
6028         (Start_group::~Start_group): New function.
6029         (Start_group::is_runnable): New function.
6030         (Start_group::locks, Start_group::run): New functions.
6031         (Finish_group::run): Change saw_undefined to size_t.
6032         * readsyms.h (class Start_group): Define.
6033         (class Finish_group): Change saw_undefined_ field to size_t.
6034         (Finish_group::Finish_group): Remove saw_undefined and
6035         this_blocker parameters.  Change all callers.
6036         (Finish_group::set_saw_undefined): New function.
6037         (Finish_group::set_blocker): New function.
6038         * symtab.h (class Symbol_table): Change saw_undefined to return
6039         size_t.  Change saw_undefined_ field to size_t.
6040         * target-select.cc (Set_target_once::do_run_once): New function.
6041         (Target_selector::Target_selector): Initialize set_target_once_
6042         field.  Don't initialize lock_ and initialize_lock_ fields.
6043         (Target_selector::instantiate_target): Rewrite.
6044         (Target_selector::set_target): New function.
6045         * target-select.h (class Set_target_once): Define.
6046         (class Target_selector): Update declarations.  Make
6047         Set_target_once a friend.  Remove lock_ and initialize_lock_
6048         fields.  Add set_target_once_ field.
6049
6050 2010-02-10  Ian Lance Taylor  <iant@google.com>
6051
6052         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6053         queueing any tasks.
6054         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6055         (queue_middle_tasks): Add all blockers before queueing any tasks.
6056         (queue_final_tasks): Likewise.
6057         * token.h (Task_token::add_blockers): New function.
6058         * object.h (Input_objects::number_of_relobjs): New function.
6059
6060 2010-02-10  Ian Lance Taylor  <iant@google.com>
6061
6062         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6063         shared, not if not position independent.
6064         * x86_64.cc (Relocate::relocate_tls): Likewise.
6065         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6066         (tls_pie_pic_test): New target.
6067         * testsuite/Makefile.in: Rebuild.
6068
6069         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6070         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6071         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6072         * testsuite/Makefile.in: Rebuild.
6073
6074 2010-02-09  David S. Miller  <davem@davemloft.net>
6075
6076         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6077         R_SPARC_RELATIVE using ->add_local_relative().
6078         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6079
6080         * output.h (Output_data_dynamic::add_section_size): New method
6081         that takes two Output_data objects.
6082         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6083         entry param.  Handle it in initializers.
6084         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6085         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6086         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6087         arg.
6088         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6089         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6090         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6091         for dynrel_includes_plt.
6092         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6093         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6094         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6095         before .rela.plt
6096         (Target_sparc::do_finalize_sections): Update to pass true for
6097         dynrel_includes_plt.
6098         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6099         output before .rela.plt
6100         (Target_powerpc::do_finalize_sections): Update to pass true for
6101         dynrel_includes_plt when 32-bit.
6102
6103 2010-02-08  Doug Kwan  <dougkwan@google.com>
6104
6105         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6106         method.
6107         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6108         Arm_relobj::scan_section_for_cortex_a8_stubs,
6109         Arm_relobj::do_relocation_section): Instead of calling
6110         Output_section::output_address, use faster
6111         Arm_relobj::simple_input_section_output_address.
6112
6113 2010-02-08  David S. Miller  <davem@davemloft.net>
6114
6115         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6116         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6117         relocation helper function.
6118
6119         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6120         just like R_SPARC_GOT{10,13,22}.
6121         (Target_sparc::Scan::local): Likewise.
6122         (Target_sparc::Relocate:relocate): Likewise.
6123
6124 2010-02-06  Ian Lance Taylor  <iant@google.com>
6125
6126         * configure.ac: Rewrite targetobjs duplicate removal code to use
6127         only shell constructs.
6128         * configure: Rebuild.
6129
6130 2010-02-05  Doug Kwan  <dougkwan@google.com>
6131
6132         PR 11247
6133         * arm.cc (Arm_relobj::section_is_scannable): New method.
6134         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6135         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6136
6137 2010-02-04  Doug Kwan  <dougkwan@google.com>
6138
6139         PR 11247
6140         * arm-reloc-property.cc (cstdio): Include.
6141         * configure.ac (targetobjs): Remove duplicates.
6142         * configure: Regenerate.
6143         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6144         big and little endian version for a given address size.
6145
6146 2010-02-03  Doug Kwan  <dougkwan@google.com>
6147
6148         * arm-reloc-property.cc
6149         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6150         definition.
6151         * arm-reloc-property.h
6152         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6153         New method definition.
6154         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6155         declaration.
6156         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6157         overflow to N.
6158         (GOT_PREL): Change implemented to Y.
6159         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6160         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6161         (Arm_relocate_functions::movw_abs_nc): Remove method.
6162         (Arm_relocate_functions::movt_abs): Ditto.
6163         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6164         (Arm_relocate_functions::thm_movt_abs): Ditto.
6165         (Arm_relocate_functions::movw_rel_nc): Ditto.
6166         (Arm_relocate_functions::movw_rel): Ditto.
6167         (Arm_relocate_functions::movt_rel): Ditto.
6168         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6169         (Arm_relocate_functions:thm_movw_rel): Ditto.
6170         (Arm_relocate_functions:thm_movt_rel): Ditto.
6171         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6172         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6173         New method definitions.
6174         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6175         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6176         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6177         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6178         (Target_arm::Relocate::relocate): Check for non-static or
6179         unimplemented relocation code and exit early.  Change calls to
6180         Target_arm::reloc_uses_thumb_bit and
6181         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6182         instead.  Refactor code to handle similar relocations to increase
6183         code sharing.  Remove check for unsupported relocation code in switch
6184         statement.
6185         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6186         relocation property table to find out size.  Change error message to
6187         print out the name of a relocation code instead of the numeric value.
6188         (Target_arm::scan_reloc_for_stub): Use relocation property table
6189         instead of calling Target_arm::reloc_uses_thumb_bit().
6190
6191 2010-02-02  Doug Kwan  <dougkwan@google.com>
6192
6193         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6194         types of relaxed input section.
6195
6196 2010-02-02  Doug Kwan  <dougkwan@google.com>
6197
6198         * Makefile.am (HFILES): Add arm-reloc-property.h.
6199         (DEFFILES): New.
6200         (TARGETSOURCES): Add arm-reloc-property.cc
6201         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6202         (libgold_a_SOURCES): $(DEFFILES)
6203         * Makefile.in: Regenerate.
6204         * arm-reloc-property.cc: New file.
6205         * arm-reloc-property.h: New file.
6206         * arm-reloc.def: New file.
6207         * arm.cc: Update comments.
6208         (arm-reloc-property.h): New included header.
6209         (arm_reloc_property_table): New global variable.
6210         (Target_arm::do_select_as_default_target): New method definition.
6211         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6212         arm-reloc-property to targ_extra_obj.
6213         * parameters.cc (set_parameters_target): Call
6214         Target::select_as_default_target().
6215         * target.h (Target::select_as_default_target): New method definition.
6216         (Target::do_select_as_default_target): Same.
6217
6218 2010-02-01  Doug Kwan  <dougkwan@google.com>
6219
6220         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6221         first_output_text_section_.
6222         (Arm_exidx_fixup::first_output_text_section): New method definition.
6223         (Arm_exidx_fixup::first_output_text_section_): New data member.
6224         (Arm_exidx_fixup::process_exidx_section): Record the first text
6225         output section seen.
6226         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6227         and entsize in output section header.
6228
6229 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6230
6231         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6232         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6233         (Arm_relocate_functions::thm_alu11): New Method.
6234         (Arm_relocate_functions::thm_pc8): New Method.
6235         (Arm_relocate_functions::thm_pc12): New Method.
6236         (Target_arm::Scan::local): Handle the relocations.
6237         (Target_arm::Scan::global): Likewise.
6238         (Target_arm::Relocate::relocate): Likewise.
6239         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6240
6241 2010-01-29  Doug Kwan  <dougkwan@google.com>
6242
6243         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6244         of relocation types as ld.
6245
6246 2010-01-29  Doug Kwan  <dougkwan@google.com>
6247
6248         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6249         to public.
6250         (Arm_relocate_functions::thumb_branch_common): Ditto.
6251         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6252         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6253         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6254         Arm_relocate_functions::jump24): Remove.
6255         (Target_arm::Relocate::relocate): Adjust code to call
6256         Arm_relocation_functions::arm_branch_common and
6257         Arm_relocation_functions::thumb_branch_common instead of their removed
6258         wrappers.  Merge switch-cases together to reduce source code size.
6259
6260 2010-01-29  Doug Kwan  <dougkwan@google.com>
6261
6262         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6263         output_local_symbol_count_needs_update_.
6264         (Arm_relobj::output_local_symbol_count_needs_update,
6265          Arm_relobj::set_output_local_symbol_count_needs_update,
6266          Arm_relobj::update_output_local_symbol_count): New methods.
6267         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6268         member.
6269         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6270         of pointed function as in a R_ARM_PREL31 relocation.
6271         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6272         for output local symbol count updating.
6273         (Target_arm::do_relax): Update output local symbol counts in objects
6274         if necessary.
6275         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6276
6277 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6278
6279         * arm.cc: Added support for the ARM relocations:
6280         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6281         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6282         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6283         movw_prel_nc).
6284         (Arm_relocate_functions::movw_rel): New method.
6285         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6286         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6287         thm_movw_prel_nc).
6288         (Arm_relocate_functions::thm_movw_rel): New method.
6289         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6290         thm_movt_prel).
6291         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6292         relocations.
6293         (Target_arm::Scan::global): Likewise.
6294         (Target_arm::Relocate::relocate): Likewise.
6295         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6296         Likewise.
6297
6298 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6299
6300         * arm.cc: Added support for ARM group relocations.
6301         (Target_arm::reloc_needs_sym_origin): New method.
6302         (Arm_relocate_functions::calc_grp_kn): New method.
6303         (Arm_relocate_functions::calc_grp_residual): New method.
6304         (Arm_relocate_functions::calc_grp_gn): New method.
6305         (Arm_relocate_functions::arm_grp_alu): New Method.
6306         (Arm_relocate_functions::arm_grp_ldr): New Method.
6307         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6308         (Arm_relocate_functions::arm_grp_ldc): New Method.
6309         (Target_arm::Scan::local): Handle the ARM group relocations.
6310         (Target_arm::Scan::global): Likewise.
6311         (Target_arm::Relocate::relocate): Likewise.
6312         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6313         Likewise.
6314
6315 2010-01-26  Doug Kwan  <dougkwan@google.com>
6316
6317         * arm.cc (set): Include.
6318         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6319         pointer type.
6320         (Arm_output_section::Text_section_list): New type.
6321         (Arm_output_section::append_text_sections_to_list): New method.
6322         (Arm_output_section::fix_exidx_coverage): Ditto.
6323         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6324         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6325         Relobj::set_section_offset() instead of
6326         Sized_relobj::invalidate_section_offset().
6327         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6328         parameter for section headers. Ignore relocation sections for
6329         unallocated sections and EXIDX sections.
6330         (Target_arm::fix_exidx_coverage): New method.
6331         (Target_arm::output_section_address_less_than): New type.
6332         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6333         linked text section instead of the EXIDX section.
6334         (Arm_output_section::create_stub_group): Add an assertion to check
6335         that this is not an EXIDX output section.
6336         (Arm_output_section::append_text_sections_to_list): New method.
6337         (Arm_output_section::fix_exidx_coverage): Ditto.
6338         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6339         Arm_relobj::section_needs_reloc_stub_scanning.
6340         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6341         first pass.
6342         (Target_arm::fix_exidx_coverage): New method.
6343         * object.h (Relobj::set_output_section): New method.
6344         (Sized_relobj::invalidate_section_offset): Remove method.
6345         (Sized_relobj::do_invalidate_section_offset): Remove method.
6346         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6347
6348 2010-01-25  Doug Kwan  <dougkwan@google.com>
6349
6350         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6351         Fix warning due to signed and unsigned comparison on a 32-bit host.
6352
6353 2010-01-22  Doug Kwan  <dougkwan@google.com>
6354
6355         * arm.cc (Target_arm::do_relax): Record an output section for section
6356         offset adjustment it contains any stub table that has changed.
6357         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6358         offsets in an output section if necessary.
6359         * output.cc (Output_section::Output_section): Initialize
6360         section_offsets_need_adjustments_.
6361         (Output_section::add_input_section_for_script): Renamed to
6362         Output_section::add_simple_input_section.
6363         (Output_section::save_states): Add a comment.
6364         (Output_section::discard_states): New method defintion.
6365         (Output_section::adjust_section_offsets): Same.
6366         * output.h (Output_section::add_input_section_for_script): Renamed to
6367         Output_section::add_simple_input_section.
6368         (Output_section::discard_states): New method declaration.
6369         (Output_section::adjust_section_offsets): Same.
6370         (Output_section::section_offsets_need_adjustment,
6371         Output_section::set_section_offsets_need_adjustment): New method
6372         definitions.
6373         (Output_section::section_offsets_need_adjustment_): New data member.
6374         * script-sections.cc
6375         (Output_section_element_input::set_section_address): Adjust code for
6376         renaming of Output_section::add_input_section_for_script.
6377         (Orphan_output_section::set_section_address): Same.
6378
6379 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6380
6381         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6382         Fix_v4bx enum values .
6383         * gold/options.h (General_options): New option definitions.
6384         (General_options::fix_v4bx): New method.
6385         (General_options::Fix_v4bx): New enum.
6386         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6387         (General_options::parse_fix_v4bx_interworking): New method.
6388
6389 2010-01-22  Doug Kwan  <dougkwan@google.com>
6390
6391         * arm.cc (Arm_exidx_fixup): New class.
6392
6393 2010-01-21  Doug Kwan  <dougkwan@google.com>
6394
6395         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6396         classes.
6397         (Arm_exidx_section_offset_map): New type.
6398
6399 2010-01-21  Doug Kwan  <dougkwan@google.com>
6400
6401         * arm.cc (Arm_exidx_input_section): New class.
6402         (Arm_relobj::exidx_input_section_by_link,
6403         Arm_relobj::exidx_input_section_by_shndx,
6404         Arm_relobj::make_exidx_input_section): New methods.
6405         (read_arm_attributes_section): Remove.
6406         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6407         information about them.
6408         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6409         to here.
6410
6411 2010-01-20  Doug Kwan  <dougkwan@google.com>
6412
6413         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6414         Input_section_specifier to Section_id.
6415         (Target_arm::new_arm_input_section: Adjust code for change of key
6416         type.
6417         (Target_arm::find_arm_input_section): Ditto.
6418         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6419         (Section_id): Remove.
6420         (Garbage_collection::Section_id_hash): Remove.
6421         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6422         (Section_id): Remove.
6423         (Icf::Section_id_hash): Remove.
6424         * object.h (Section_id, Const_section_id, Section_id_hash,
6425         Const_section_id_hash): New type definitions.
6426         * output.cc (Output_section::add_relaxed_input_section): Change to
6427         use Const_section_id instead of Input_section_specifier as key type.
6428         (Output_section::add_merge_input_section): Ditto.
6429         (Output_section::build_relaxation_map): Change to use Section_id
6430         instead of Input_section_specifier as key type.
6431         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6432         Ditto.
6433         (Output_section::convert_input_sections_to_relaxed_sections): Change
6434         to use Const_section_id instead of Input_section_specifier as key type.
6435         (Output_section::find_merge_section): Ditto.
6436         (Output_section::find_relaxed_input_section): Ditto.
6437         * output.h (Input_section_specifier): Remove class.
6438         (Output_section::Output_section_data_by_input_section_map): Change
6439         key type to Const_section_id.
6440         (Output_section::Output_relaxed_input_section_by_input_section_map):
6441         Ditto.
6442         (Output_section::Relaxation_map): Change key type to Section_id.
6443
6444 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6445
6446         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6447         (class Arm_v4bx_stub): New class.
6448         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6449         (Stub_factory::make_arm_v4bx_stub): New method.
6450         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6451         (Stub_table::empty): Handle v4bx stubs.
6452         (Stub_table::add_arm_v4bx_stub): New method.
6453         (Stub_table::find_arm_v4bx_stub): New method.
6454         (Arm_relocate_functions::v4bx): New method.
6455         (Target_arm::fix_v4bx): New method.
6456         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6457         (Stub_table::relocate_stubs): Likewise.
6458         (Stub_table::do_write): Likewise.
6459         (Stub_table::update_data_size_and_addralign): Likewise.
6460         (Stub_table::finalize_stubs):  Likewise.
6461         (Target_arm::Scan::local): Likewise.
6462         (Target_arm::Scan::global): Likewise.
6463         (Target_arm::do_finalize_sections): Likewise.
6464         (Target_arm::Relocate::relocate): Likewise.
6465         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6466         Likewise.
6467         (Target_arm::scan_reloc_for_stub): Likewise.
6468         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6469
6470 2010-01-19  Ian Lance Taylor  <iant@google.com>
6471
6472         * output.cc (Output_section_headers::do_sized_write): Write large
6473         segment count to sh_info field.
6474         (Output_file_header::do_sized_write): For large segment count,
6475         write PN_XNUM to e_phnum field.
6476
6477 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6478
6479         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6480         (Arm_relocate_functions::thm_jump8): New function.
6481         (Arm_relocate_functions::thm_jump11): New function.
6482         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6483         R_ARM_THM_JUMP11.
6484         (Target_arm::Scan::global): Likewise.
6485         (Target_arm::Relocate::relocate): Likewise.
6486         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6487         Likewise.
6488
6489 2010-01-14  Doug Kwan  <dougkwan@google.com>
6490
6491         * arm.cc (map, utility): Include headers.
6492         (Target_arm::apply_cortex_a8_workaround): New method.
6493         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6494         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6495         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6496         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6497         the --[no-]fix-cortex-a8 command line options.
6498         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6499         (Target_arm::relocate_stub): Use addend in instruction template.
6500         * options.h (DEFINE_bool): Set the user-set flag.
6501         (General_options): Add --[no-]-fix-cortex options.
6502         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6503         : Update fast look-up map after conversion.
6504
6505 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6506
6507         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6508         in the first pass of do_layout.
6509
6510 2010-01-13  Doug Kwan  <dougkwan@google.com>
6511
6512         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6513         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6514         apparent compiler problem of not folding static constant integral
6515         data members of elfcpp::Elf_sizes<32>.
6516
6517 2010-01-13  Doug Kwan  <dougkwan@google.com>
6518
6519         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6520         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6521         Arm_relobj::scan_section_for_cortex_a8_erratum,
6522         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6523         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6524         sections to scan for relocation stubs into a new method
6525         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6526         relocation and Cortex-A8 stub scanning.
6527         (Target_arm::do_relax): Force stubs to be after stubbed sections
6528         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6529         the beginning of a new relaxation pass.  Update a comment.
6530         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6531
6532 2010-01-12  Ian Lance Taylor  <iant@google.com>
6533
6534         * target-reloc.h (visibility_error): New inline function.
6535         (relocate_section): Call visibility_error.
6536         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6537         (MOSTLYCLEANFILES): Likewise.
6538         (protected_4_pic.o, protected_3.err): New targets.
6539         * testsuite/protected_4.cc: New file.
6540
6541 2010-01-12  Doug Kwan  <dougkwan@google.com>
6542
6543         * arm.cc (Cortex_a8_reloc): New class.
6544         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6545         and cortex_a8_relocs_info_.
6546         (Target_arm::fix_cortex_a8): New method definition.
6547         (Target_arm::Cortex_a8_relocs_info): New type.
6548         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6549         New data member declarations.
6550         (Target_arm::scan_reloc_for_stub): Record information about
6551         relocations for THUMB branches that might be exempted from the
6552         Cortex-A8 workaround.
6553         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6554         at the beginning of a relaxation pass.
6555
6556 2010-01-12  Doug Kwan  <dougkwan@google.com>
6557
6558         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6559         (Arm_relobj::Mapping_symbol_position,
6560          Arm_reloj::Mapping_symbol_position_less,
6561          Arm_relobj::Mapping_symbols_info): New types.
6562         (Target_arm::is_mapping_symbol_name): New method definition.
6563         (Arm_relobj::do_count_local_symbols): Save information about mapping
6564         symbols.
6565
6566 2010-01-11  Doug Kwan  <dougkwan@google.com>
6567
6568         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6569         Arm_relocate_functions::thumb32_branch_upper,
6570         Arm_relocate_functions::thumb32_branch_lower,
6571         Arm_relocate_functions::thumb32_cond_branch_offset,
6572         Arm_relocate_functions::thumb32_cond_branch_upper,
6573         Arm_relocate_functions::thumb32_cond_branch_lower,
6574         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6575         branch offset encoding.
6576         (Arm_relocate_functions::thumb_branch_common): Use new branch
6577         offset encoding methods to avoid code duplication.
6578         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6579         (Stub_addend_reader::operator()): Use new branch encoding method
6580         to avoid code duplication.
6581
6582 2010-01-11  Doug Kwan  <dougkwan@google.com>
6583
6584         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6585         (Target_arm::do_finalize_sections): Define special EXIDX section
6586         symbols only if referenced.
6587         * gc.h (Garbage_collection::add_reference): New method.
6588         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6589         code duplication.
6590
6591 2010-01-11  Ian Lance Taylor  <iant@google.com>
6592
6593         * script.cc (Version_script_info::build_expression_list_lookup):
6594         Change complaing about duplicate wildcard match from error to
6595         warning.
6596
6597         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6598         of 2009-12-30.
6599         (Version_script_info::Version_script_info): Initialize globs_,
6600         default_version_, default_is_global_, and exact_.  Don't
6601         initialize globals_ or locals_.
6602         (Version_script_info::build_lookup_tables): Build local symbols
6603         first.
6604         (Version_script_info::unquote): New function.
6605         (Version_script_info::add_exact_match): New function.
6606         (Version_script_info::build_expression_list_lookup): Remove lookup
6607         parameter.  Add is_global parameter.  Change all callers.  Handle
6608         wildcard pattern specially.  Unquote pattern.  Call
6609         add_exact_match.
6610         (Version_script_info::get_name_to_match): New function.
6611         (Version_script_info::get_symbol_version): New function.
6612         (Version_script_info::get_symbol_version_helper): Remove.
6613         (Version_script_info::check_unmatched_names): Call unquote.
6614         * script.h (class Version_script_info): Change get_symbol_version
6615         to be non-inline and add is_global parameter; change all callers.
6616         Rewrite symbol_is_local.  Update declarations.  Define struct
6617         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6618         Remove globals_ and locals_ members.  Add exact_, globs_,
6619         default_version_, is_global_.
6620         (Version_script_info::Glob): Remove pattern, add expression and
6621         is_global.  Update constructor.  Change all callers.
6622         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6623         default version.
6624         (Versions::symbol_section_contents): If a symbol is undefined, or
6625         defined in a dynamic object, set the version index to
6626         VER_NDX_LOCAL.
6627         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6628         symbol_is_local.
6629         (Symbol_table::add_from_pluginobj): Likewise.
6630         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6631
6632 2010-01-11  Doug Kwan  <dougkwan@google.com>
6633
6634         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6635         (incremental_dump_LDADD): Add linking option for libintl.
6636         * Makefile.in: Regenerate.
6637
6638 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6639
6640         PR gold/11144
6641         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6642         instead of -Ds.
6643         * testsuite/Makefile.in: Regenerated.
6644
6645 2010-01-10  Doug Kwan  <dougkwan@google.com>
6646
6647         * options.h (DEFINE_var): Use parentheses around argument varname__
6648         in macro body to avoid any unintended subsequent substitutions.
6649
6650 2010-01-10  Ian Lance Taylor  <iant@google.com>
6651
6652         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6653         candidates before doing symbol resolution.
6654
6655         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6656         ODR candidates if only one is weak.
6657
6658 2010-01-08  Ian Lance Taylor  <iant@google.com>
6659
6660         * script.cc (Version_script_info::build_expression_list_lookup):
6661         Don't warn about ambiguous version, just record the ambiguity.
6662         (Version_script_info::get_symbol_version_helper): Give error if
6663         version is ambiguous.
6664
6665 2010-01-08  Doug Kwan  <dougkwan@google.com>
6666
6667         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6668           prev_data_size_ and prev_addralign_.  Remove initializer for
6669           deleted data member has_been_changed_.
6670           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6671           to determine if the table is empty.
6672           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6673           Remove.
6674           (Stub_table::add_reloc_stub): Define method in class definition
6675           instead of just declaring it there.
6676           (Stub_table::add_cortex_a8_stub): New method definition.
6677           (Stub_table::update_data_size_and_addralign): Ditto.
6678           (Stub_table::finalize_stubs): Ditto.
6679           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6680           (Stub_table::do_addralign_): Return address alignment in the
6681           (Stub_table::do_reset_address_and_file_offset): Define method in
6682           class definition instead of declaring it there.  Set current data
6683           size to be the data size of the previous pass.
6684           (Stub_table::set_final_data_size): Use current data size as the
6685           final data size.
6686           (Stub_table::relocate_stub): Change parameter type of stub from
6687           Reloc_stub pointer to Stub pointer.
6688           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6689           (Stub_table::Cortex_a8_stub_list): New typedef.
6690           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6691            Stub_table::prev_addralign_): New data member.
6692           (Arm_relobj::Arm_relobj): Initialize data member
6693           section_has_cortex_a8_workaround_.
6694           (Arm_relobj::section_has_cortex_a8_workaround,
6695            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6696            definitions.
6697           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6698           declarations.
6699           (Target_arm::relocate_stub): Change parameter type of stub from
6700           Reloc_stub pointer to Stub pointer.
6701           (Insn_template::size, Insn_template::alignment): Handle
6702           THUMB16_SPECIAL_TYPE.
6703           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6704            Stub_table::update_data_size_and_addralign,
6705            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6706           definitions.
6707           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6708           (Stub_table::do_write): Ditto.
6709           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6710
6711 2010-01-08  Ian Lance Taylor  <iant@google.com>
6712
6713         PR 11108
6714         * symtab.h (class Symbol): Remove fields is_target_special_ and
6715         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6716         (Symbol::is_defined_in_discarded_section): New function.
6717         (Symbol::set_is_defined_in_discarded_section): New function.
6718         (Symbol::has_plt_offset): Rewrite.
6719         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6720         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6721         Don't initialize is_target_special_ or has_plt_offset_.
6722         Initialize is_defined_in_discarded_section_.
6723         (Symbol_table::add_from_relobj): If appropriate, set
6724         is_defined_in_discarded_section.
6725         * resolve.cc (Symbol::override_base_with_special): Don't test
6726         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6727         * target-reloc.h (relocate_section): Do special handling for
6728         symbols defined in discarded sections for global symbols as well
6729         as local symbols.
6730
6731 2010-01-08  Ian Lance Taylor  <iant@google.com>
6732
6733         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6734         the SHT_SYMTAB case.
6735
6736 2010-01-08  Ian Lance Taylor  <iant@google.com>
6737
6738         * object.cc (Sized_relobj::do_layout): Don't get confused if
6739         layout_eh_frame returns NULL.
6740
6741 2010-01-08  Ian Lance Taylor  <iant@google.com>
6742
6743         PR 11084
6744         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6745         dynamic symbol table, use the normal symbol table.
6746         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6747         symbol table.
6748
6749 2010-01-08  Ian Lance Taylor  <iant@google.com>
6750
6751         PR 11072
6752         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6753         sections.
6754
6755 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6756
6757         * version.cc (print_version): Change to "Copyright 2010".
6758
6759 2010-01-08  Ian Lance Taylor  <iant@google.com>
6760
6761         PR 10287
6762         PR 11063
6763         * i386.cc (class Target_i386): Change return type of plt_section
6764         to be non-const.
6765         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6766         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6767         tls_desc_rel_ field.
6768         (Output_data_plt_i386::rel_tls_desc): New function.
6769         (Target_i386::rel_tls_desc_section): New function.
6770         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6771         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6772         R_386_TLS_DESC reloc in rel_tls_desc_section.
6773         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6774         Define struct Tlsdesc_info.
6775         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6776         (Target_x86_64::do_reloc_symbol_index): New function.
6777         (Target_x86_64::add_tlsdesc_info): New function.
6778         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6779         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6780         tlsdesc_rel_ field.
6781         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6782         all callers.
6783         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6784         (Target_x86_64::rela_tlsdesc_section): New function.
6785         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6786         handling.
6787         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6788         (Target_x86_64::do_reloc_addend): New function.
6789         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6790         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6791         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6792         (Output_reloc::type): New function.
6793         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6794         (Output_reloc::is_target_specific): New function.
6795         (Output_reloc::target_arg): New function.
6796         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6797         absolute relocs and target specific relocs.
6798         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6799         add_target_specific.
6800         (class Output_data_reloc) [SHT_RELA]: Likewise.
6801         * output.cc (Output_reloc::Output_reloc): Add four new versions
6802         for absolute relocs and target specific relocs.
6803         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6804         (Output_reloc::get_symbol_index): Likewise.
6805         (Output_reloc::local_section_offset): Check that local_sym_index_
6806         is not TARGET_CODE or 0.
6807         (Output_reloc::symbol_value): Likewise.
6808         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6809         reloc.
6810         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6811         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6812         functions.
6813         * layout.cc (add_target_dynamic_tags): Use output section for
6814         DT_PLTRELSZ and DT_JMPREL.
6815
6816 2010-01-07  Ian Lance Taylor  <iant@google.com>
6817
6818         PR 11061
6819         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6820         function.
6821         (class Output_data_reloc_generic): Define.
6822         (class Output_data_reloc_base): Change base class to
6823         Output_data_reloc_generic.  Change add() method to call
6824         bump_relative_reloc_count for a relative reloc.  Remove
6825         sort_relocs_ field.
6826         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6827         to sort_relocs().
6828         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6829         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6830         appropriate.
6831         * layout.h (class Layout): Update declaration.
6832
6833 2010-01-07  Ian Lance Taylor  <iant@google.com>
6834
6835         * output.h (class Output_data): Add const version of
6836         output_section and do_output_section.
6837         (class Output_section_data): Add const version of
6838         do_output_section.
6839         (class Output_section): Likewise.
6840         * layout.cc (Layout::add_target_dynamic_tags): New function.
6841         * layout.h (class Layout): Update declarations.
6842         * arm.cc (Target_arm::do_finalize_sections): Use
6843         add_target_dynamic_tags.
6844         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6845         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6846         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6847         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6848
6849 2010-01-07  Ian Lance Taylor  <iant@google.com>
6850
6851         PR 11042
6852         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6853         object as needed.
6854
6855 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6856             Ian Lance Taylor  <iant@google.com>
6857
6858         PR 11019
6859         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6860         Xindex::read_symtab_xindex.
6861
6862 2010-01-07  Doug Kwan  <dougkwan@google.com>
6863
6864         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6865         (Insn_template::thumb16_bcond_insn): New method declaration.
6866         (Insn_template): Fix spelling.
6867         (Stub::thumb16_special): New method declaration.
6868         (Stub::do_write): Define virtual method which was previously pure
6869         virtual.
6870         (Stub::do_thumb16_special): New method declaration.
6871         (Stub::do_fixed_endian_write): New template member.
6872         (Reloc_stub::do_write): Remove.
6873         (Reloc_stub::do_fixed_endian_write): Remove.
6874         (Cortex_a8_stub): New class definition.
6875         (Stub_factory::make_cortex_a8_stub): New method definition.
6876         (Stub_factory::Stub_factory): Add missing static storage class
6877         qualifier for elf32_arm_stub_a8_veneer_blx.
6878
6879 2010-01-07  Ian Lance Taylor  <iant@google.com>
6880
6881         PR 10980
6882         * options.h (class General_options): Add --warn-unresolved-symbols
6883         and --error-unresolved-symbols.
6884         * errors.cc (Errors::undefined_symbol): Implement
6885         --warn-unresolved-symbols.
6886
6887         * options.h (class General_options): Add -z text and -z textoff.
6888         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6889
6890 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6891
6892         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6893         (Garbage_collection::cident_sections): New function.
6894         (Garbage_collection::add_cident_section): New function.
6895         (Garbage_collection::cident_sections_): New member.
6896         (gc_process_relocs): Add references to sections whose names are C
6897         identifiers.
6898         * gold.h (cident_section_start_prefix): New constant.
6899         (cident_section_stop_prefix): New constant.
6900         (is_cident): New function.
6901         * layout.cc (Layout::define_section_symbols): Replace string constants
6902         with the newly defined constants.
6903         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6904         C identifiers.
6905         * testsuite/Makefile.am: Add gc_orphan_section_test.
6906         * testsuite/Makefile.in: Regenerate.
6907         * testsuite/gc_orphan_section_test.cc: New file.
6908         * testsuite/gc_orphan_section_test.sh: New file.
6909
6910 2010-01-06  Ian Lance Taylor  <iant@google.com>
6911
6912         PR 10980
6913         * options.h (class General_options): Add --warn-shared-textrel.
6914         * layout.cc (Layout::finish_dynamic_section): Implement
6915         --warn-shared-textrel.
6916
6917         PR 10980
6918         * options.h (class General_options): Add --warn-multiple-gp.
6919
6920 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6921
6922         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6923         $(THREADSLIB) and $(LIBDL).
6924         * Makefile.in: Rebuild.
6925
6926 2010-01-06  Ian Lance Taylor  <iant@google.com>
6927
6928         PR 10980
6929         * options.cc (General_options::parse_section_start): New function.
6930         (General_options::section_start): New function.
6931         (General_options::General_options): Initialize all members.
6932         * options.h: Include <map>
6933         (class General_options): Add --section-start.  Add section_starts_
6934         member.
6935         * layout.cc (Layout::attach_allocated_section_to_segment): If
6936         --section-start was used, set the address of the segment.  Remove
6937         local sort_sections.
6938         (Layout::relaxation_loop_body): If the address of the load segment
6939         has been set by --section-start, don't use it.
6940         * output.h (Output_segment::update_flags_for_output_section): New
6941         function.
6942         * output.cc (Output_segment::add_output_section): Call
6943         update_flags_for_output_section.
6944
6945 2010-01-05  Ian Lance Taylor  <iant@google.com>
6946
6947         PR 10980
6948         * options.h (class General_options): Add --undefined-version.
6949         * script.cc (struct Version_expression): Add was_matched_by_symbol
6950         field.
6951         (Version_script_info::matched_symbol): New function.
6952         (Version_script_info::get_symbol_version_helper): Call
6953         matched_symbol.
6954         (Version_script_info::check_unmatched_names): New function.
6955         * script.h (class Version_script_info): Update declarations.
6956         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6957
6958         * options.h (class General_options): Use DEFINE_bool_alias for
6959         allow_multiple_definition.
6960         * resolve.cc (Symbol_table::should_override): Don't test
6961         allow_multiple_definition.
6962
6963         PR 10980
6964         * options.h (class General_options): Add --cref.
6965         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6966         until after printing cref table.
6967         * cref.cc: Include "symtab.h".
6968         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6969         (Cref_table_compare::operator()): New function.
6970         (Cref_inputs::gather_cref): New function.
6971         (filecol): New static const.
6972         (Cref_inputs::print_cref): New function.
6973         (Cref::print_cref): New function.
6974         * cref.h: Include <cstdio>.
6975         (class Cref): Update declarations.
6976         * mapfile.h (Mapfile::file): New function.
6977         * object.h (class Object): Define Symbols.  Declare virtual
6978         do_get_global_symbols.
6979         (Object::get_global_symbols): New function.
6980         * object.cc (Input_objects::add_object): Pass object to cref_ if
6981         --cref.
6982         (Input_objects::archive_start): Likewise.
6983         (Input_objects::archive_stop): Likewise.
6984         (Input_objects::print_cref): New function.
6985         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6986         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6987         --cref.
6988         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6989         function.
6990         * plugin.h (class Sized_pluginobj): Update declarations.
6991
6992 2010-01-05  Ian Lance Taylor  <iant@google.com>
6993
6994         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6995         to is_default_version.  Rename insdef to insdefault.
6996         (Symbol_table::add_from_relobj): Rename def to is_default_version
6997         and local to is_forced_local.
6998         (Symbol_table::add_from_pluginobj): Likewise.
6999         (Symbol_table::add_from_dynobj): Likewise.
7000         (Symbol_table::define_special_symbol): Rename insdef to
7001         insdefault.
7002
7003 2010-01-04  Ian Lance Taylor  <iant@google.com>
7004
7005         PR 10980
7006         * options.h (class General_options): Add
7007         --allow-multiple-definition and -z muldefs.
7008         * resolve.cc (Symbol_table::should_override): Don't warn about a
7009         multiple symbol definition if --allow-multiple-definition or -z
7010         muldefs.
7011
7012         PR 10980
7013         * options.h (class General_options): Add --add-needed and
7014         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7015         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7016         error if --copy-dt-needed-entries aka --add-needed is used and
7017         would cause a change in behaviour.
7018
7019         PR 10980
7020         * options.h (class General_options): Add -G as a short version of
7021         --shared.  Add no-op options -assert, -g, and -i.
7022
7023 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7024
7025         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7026         check for .text or .gnu.linkonce.t sections.
7027         * icf.cc (Icf::find_identical_sections): Ditto.
7028         Change the detection for mangled function name within the section
7029         name.
7030         * icf.h (is_section_foldable_candidate): New function.
7031
7032 2009-12-30  Ian Lance Taylor  <iant@google.com>
7033
7034         PR 10980
7035         * options.h (class General_options): Permit two dashes with
7036         --retain-symbols-file.
7037
7038 2009-12-30  Ian Lance Taylor  <iant@google.com>
7039
7040         PR 10979
7041         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7042         don't put the file header and segment headers in the text
7043         segment.
7044
7045         PR 10979
7046         * common.cc (Sort_commons::operator()): Stabilize sort when both
7047         entries are NULL.
7048         (Symbol_table::do_allocate_commons_list): When allocating common
7049         symbols, skip a symbol which is no longer common.
7050         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7051         an object before checking its type.
7052         * testsuite/common_test_2.c: New file.
7053         * testsuite/common_test_3.c: New file.
7054         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7055         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7056         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7057         (common_test_2_pic.o, common_test_2.so): New targets.
7058         (common_test_3_pic.o, common_test_3.so): New targets.
7059         * testsuite/Makefile.in: Rebuild.
7060
7061         PR 10979
7062         * script.cc (read_input_script): If we see a new SECTIONS clause,
7063         and we have added an input section, give an error.
7064         * layout.h (class Layout): Add have_added_input_section function.
7065         Add have_added_input_section_ field.
7066         * layout.cc (Layout::Layout): Initialize
7067         have_added_input_section_.
7068         (Layout::layout): Set have_added_input_section_.
7069         (Layout::layout_eh_frame): Likewise.
7070
7071 2009-12-30  Ian Lance Taylor  <iant@google.com>
7072
7073         PR 10931
7074         * options.h (class General_options): Add --sort-common option.
7075         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7076         * common.cc (Sort_common): Add sort_order parameter to
7077         constructor.  Add sort_order_ field.
7078         (Sort_commons::operator): Check sort_order_.
7079         (Symbol_table::allocate_commons): Determine the sort order.
7080         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7081         Change all callers.
7082         (Symbol_table::do_allocate_commons_list): Likewise.
7083
7084 2009-12-30  Ian Lance Taylor  <iant@google.com>
7085
7086         PR 10916
7087         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7088         symbols from this object, don't change the visibility of an
7089         undefined symbol.
7090         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7091
7092 2009-12-30  Ian Lance Taylor  <iant@google.com>
7093
7094         PR 10861
7095         * script.h (class Version_script_info): Define Language enum.
7096         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7097         new fields globals_, locals_, and is_finalized_.
7098         * script.cc: Various formatting fixes.
7099         (class Parser_closure): Change language_stack_ from a vector of
7100         std::string to one of Version_script_info::Language.  Adjust all
7101         uses accordingly.
7102         (class Lazy_demangler): Remove.
7103         (struct Version_expression): Change language from std::string to
7104         Version_script_info::Language.
7105         (Version_script_info::Version_script_info): New function.
7106         (Version_script_info::~Version_script_info): Don't call clear.
7107         (Version_script_info::finalize): New function.
7108         (Version_script_info::build_lookup_tables): New function.
7109         (Version_script_info::build_expression_list_lookup): New
7110         function.
7111         (Version_script_info::get_symbol_version_helper): Rewrite to use
7112         lookup tables.
7113         (Version_script_info::print_expression_list): Adjust to use
7114         Version_script_info::Language.
7115         (script_push_lex_into_version_mode): Check that the version script
7116         has not been finalized.
7117         (version_script_push_lang): Change language string to
7118         Version_script_info::Language.
7119         * options.cc (Command_line::version_script): New function.
7120         * options.h (class General_options): Add finalize_dynamic_list
7121         function.  Change version_script from declaration to definition.
7122         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7123         * testsuite/version_script.map: Remove duplicate def of foo.
7124         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7125         version_script.map.
7126         * testsuite/Makefile.in: Rebuild.
7127
7128 2009-12-30  Ian Lance Taylor  <iant@google.com>
7129
7130         PR 10843
7131         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7132         if the input symbol index is 0, make the output symbol index 0.
7133
7134 2009-12-30  Ian Lance Taylor  <iant@google.com>
7135
7136         PR 10670
7137         * options.h (class General_options): Add -x/--discard-all.
7138         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7139         --discard-all.  If the local symbol needs a dynamic entry, check
7140         that before handling --discard-locals.
7141
7142 2009-12-30  Ian Lance Taylor  <iant@google.com>
7143
7144         PR 10450
7145         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7146         flags to PF_R.
7147         (Output_segment::add_output_section): Don't change the flags if
7148         the type is PT_TLS.
7149
7150         PR 10450
7151         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7152         GNU hash table if they need a dynamic value.  Otherwise, don't add
7153         them if they are defined in a dynamic object or are forced local.
7154
7155 2009-12-29  Ian Lance Taylor  <iant@google.com>
7156
7157         PR 10450
7158         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7159         .gnu.hash table for a 32-bit target.
7160
7161         PR 10450
7162         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7163         regular and a dynamic object only needs a dynamic symbol table
7164         entry if it is externally visible.
7165
7166         PR 10450
7167         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7168         constructor.  Add global_offset_table_ field.
7169         (Target_i386::got_section): Set global_offset_table_.
7170         (Target_i386::do_finalize_sections): Set global_offset_table_
7171         size.
7172         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7173         in constructor.  Add global_offset_table_ field.
7174         (Target_x86_64::got_section): Set global_offset_table_.
7175         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7176         size.
7177
7178         * layout.cc (Layout::Layout): Initialize increase_relro_.
7179         (Layout::get_output_section): Add is_relro, is_last_relro, and
7180         is_first_non_relro parameters.  Change all callers.
7181         (Layout::choose_output_section): Likewise.
7182         (Layout::add_output_section_data): Likewise.
7183         (Layout::make_output_section): Likewise.
7184         (Layout::set_segment_offsets): Clear increase_relro when using a
7185         linker script.
7186         * layout.h (class Layout): Add increase_relro method.  Add
7187         increase_relro_ field.  Update declarations.
7188         * output.cc (Output_section::Output_section): Initialize
7189         is_last_relro_ and is_first_non_relro_.
7190         (Output_segment::add_output_section): Group relro sections is
7191         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7192         (Output_segment::maximum_alignment): Remove relro handling.
7193         (Output_segment::set_section_addresses): Add increase_relro
7194         parameter.  Change all callers.  Add initial alignment to align
7195         relro sections on separate page.  Remove old relro handling.
7196         (Output_segment::set_section_list_addresses): Remove in_relro
7197         parameter.  Change all callers.
7198         (Output_segment::set_offset): Add increase parameter.  Change all
7199         callers.  Remove old relro handling.
7200         * output.h (class Output_section): Add new methods: is_last_relro,
7201         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7202         Add is_last_relro_ and is_first_non_relro_ fields.
7203         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7204         Create separate .got.plt section.  Call increase_relro.
7205         * x86_64.cc (Target_x86_64::got_section): Likewise.
7206         * testsuite/relro_script_test.t: Add .got.plt.
7207
7208         PR 10450
7209         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7210         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7211         (Layout::finalize): Call set_dynamic_symbol_size.
7212         (Layout::set_dynamic_symbol_size): New function.
7213         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7214         set_dynamic_symbol_size.
7215
7216         PR 10450
7217         * output.h (class Output_section): Add is_entsize_zero_ field.
7218         * output.cc (Output_section::Output_section): Initialize
7219         is_entsize_zero_.
7220         (Output_section::set_entsize): If two different entsizes are
7221         requested, force it to zero.
7222         (Output_section::add_input_section): Set flags for .debug_str
7223         before updating section flags.  Set entsize.
7224         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7225         and SHF_STRING if all input sections have those flags.
7226
7227 2009-12-29   Rafael Espindola  <espindola@google.com>
7228
7229         * main.cc (main): Fix the sys time reporting.
7230         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7231         reporting.
7232
7233 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7234
7235         * options.cc (General_options::parse_version): Allow -v to exit
7236         without an error if there is nothing to link.
7237
7238 2009-12-29  Ian Lance Taylor  <iant@google.com>
7239
7240         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7241         using a version of gcc before 4.1.
7242         * configure: Rebuild.
7243
7244 2009-12-28  Chris Demetriou  <cgd@google.com>
7245
7246         * attributes.cc (Output_attributes_section_data::do_write): Use
7247         std::vector::front rather than std::vector::data.
7248
7249 2009-12-28  Ian Lance Taylor  <iant@google.com>
7250
7251         * symtab.h (class Symbol_table): Add enum Defined.
7252         * resolve.cc (Symbol_table::should_override): Add defined
7253         parameter.  Change all callers.  Test whether object is NULL
7254         before calling a method on it.
7255         (Symbol_table::report_resolve_problem): Add defined parameter.
7256         Change all callers.
7257         (Symbol_table::should_override_with_special): Likewise.
7258         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7259         parameter.  Change all callers.
7260         (Symbol_table::do_define_in_output_data): Likewise.
7261         (Symbol_table::define_in_output_segment): Likewise.
7262         (Symbol_table::do_define_in_output_segment): Likewise.
7263         (Symbol_table::define_as_constant): Likewise.
7264         (Symbol_table::do_define_as_constant): Likewise.
7265         * script.h (class Symbol_assignment): Add is_defsym parameter to
7266         constructor; change all callers.
7267         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7268         parameter.  Change all callers.  Add is_defsym_ field.
7269         (class Parser_closure): Add parsing_defsym parameter to
7270         constructor; change all callers.  Add parsing_defsym accessor
7271         function.  Add parsing_defsym_ field.
7272
7273 2009-12-28  Ian Lance Taylor  <iant@google.com>
7274
7275         * gold.cc (queue_middle_tasks): Fix formatting.
7276         * object.cc (Relobj::is_section_name_included): Likewise.
7277
7278 2009-12-23  Ian Lance Taylor  <iant@google.com>
7279
7280         * i386.cc (Target_i386::do_calls_non_split): Recognize
7281         -fsplit-stack prologue for a function with a static chain.
7282         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7283         -fsplit-stack prologue when using %r11.
7284
7285 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7286
7287         * options.cc (General_options::parse_version): Make -v continue and do
7288         the link like GNU ld does.
7289
7290 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7291
7292         * Makefile.am (CCFILES): Add timer.cc.
7293         (HFILES): Add timer.h.
7294         * configure.ac: Check for sysconf and times.
7295         * main.cc: include timer.h.
7296         (main): Use Timer instead of get_run_time.
7297         * timer.cc: New.
7298         * timer.h: New.
7299         * workqueue.cc: include timer.h.
7300         (Workqueue::find_and_run_task):
7301         Report user, sys and wall time.
7302         * Makefile.in: Regenerate.
7303         * config.in: Regenerate.
7304         * configure: Regenerate.
7305
7306 2009-12-16  Doug Kwan  <dougkwan@google.com>
7307
7308         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7309         sections.
7310         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7311         relaxed input sections.
7312         * output.cc (Output_section::find_relaxed_input_section): Change
7313         return type to Output_relaxed_input_section pointer.  Adjust code
7314         for new type of relaxed_input_section_map_.
7315         * output.h (Output_section::find_relaxed_input_section): Change
7316         return type to Output_relaxed_input_section pointer.
7317         (Output_section::Output_relaxed_input_section_by_input_section_map):
7318         New type.
7319         (Output_section::relaxed_input_section_map_): Change type to
7320         Output_section::Output_relaxed_input_section_by_input_section_map.
7321         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7322         input section.
7323
7324 2009-12-15  Ian Lance Taylor  <iant@google.com>
7325
7326         * layout.cc (Layout::create_shstrtab): Only write out after input
7327         sections if we are compressing debug sections.
7328
7329 2009-12-15  Ian Lance Taylor  <iant@google.com>
7330
7331         * archive.cc (Archive::add_symbols): Only look up a symbol without
7332         a version if there is, in fact, a version.
7333
7334 2009-12-14  Ian Lance Taylor  <iant@google.com>
7335
7336         Revert -Wshadow changes, all changes from:
7337         2009-12-11  Doug Kwan  <dougkwan@google.com>
7338         2009-12-11  Nick Clifton  <nickc@redhat.com>
7339         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7340
7341 2009-12-11  Doug Kwan  <dougkwan@google.com>
7342
7343         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7344         due to -Wshadow.
7345         * attributes.cc (Object_attribute::size): Ditto.
7346         (Attributes_section_data::size): Ditto.
7347         (Attributes_section_data::Attributes_section_data): Ditto.
7348         (Output_attributes_section_data::do_write): Ditto.
7349         * attributes.h (Object_attribute::set_type): Ditto.
7350         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7351
7352 2009-12-11  Nick Clifton  <nickc@redhat.com>
7353
7354         * archive.cc: Fix shadowed variable warnings.
7355         * arm.cc: Likewise.
7356         * compressed_output.cc: Likewise.
7357         * compressed_output.h: Likewise.
7358         * configure: Likewise.
7359         * dwarf_reader.cc: Likewise.
7360         * dynobj.cc: Likewise.
7361         * dynobj.h: Likewise.
7362         * ehframe.cc: Likewise.
7363         * ehframe.h: Likewise.
7364         * errors.cc: Likewise.
7365         * expression.cc: Likewise.
7366         * fileread.cc: Likewise.
7367         * fileread.h: Likewise.
7368         * freebsd.h: Likewise.
7369         * i386.cc: Likewise.
7370         * icf.cc: Likewise.
7371         * incremental.h: Likewise.
7372         * layout.cc: Likewise.
7373         * layout.h: Likewise.
7374         * mapfile.cc: Likewise.
7375         * merge.cc: Likewise.
7376         * merge.h: Likewise.
7377         * object.cc: Likewise.
7378         * object.h: Likewise.
7379         * options.h: Likewise.
7380         * output.cc: Likewise.
7381         * output.h: Likewise.
7382         * parameters.cc: Likewise.
7383         * plugin.cc: Likewise.
7384         * powerpc.cc: Likewise.
7385         * reduced_debug_output.cc: Likewise.
7386         * reduced_debug_output.h: Likewise.
7387         * reloc.cc: Likewise.
7388         * reloc.h: Likewise.
7389         * resolve.cc: Likewise.
7390         * script-sections.cc: Likewise.
7391         * script.cc: Likewise.
7392         * script.h: Likewise.
7393         * sparc.cc: Likewise.
7394         * symtab.cc: Likewise.
7395         * symtab.h: Likewise.
7396         * target-select.cc: Likewise.
7397         * target-select.h: Likewise.
7398         * token.h: Likewise.
7399         * workqueue.cc: Likewise.
7400         * workqueue.h: Likewise.
7401         * x86_64.cc: Likewise.
7402
7403 2009-12-10  Doug Kwan  <dougkwan@google.com>
7404
7405         * arm.cc (attributes.h): New include.
7406         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7407         (Arm_relobj::~Arm_relobj): Delete object pointed by
7408         attributes_section_data_.
7409         (Arm_relobj::attributes_section_data): New method definition.
7410         (Arm_relobj::attributes_section_data_): New data member declaration.
7411         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7412         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7413         attributes_section_data_.
7414         (Arm_dynobj::attributes_section_data): New method definition.
7415         (Arm_dynobj::attributes_section_data_): New data member declaration.
7416         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7417         initialization value of may_use_blx_ to false.
7418         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7419         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7420         object attributes to compute results instead of hard-coding.
7421         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7422         Target_arm::get_secondary_compatible_arch,
7423         Target_arm::set_secondary_compatible_arch
7424         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7425         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7426         New method declarations.
7427         (Target_arm::get_aeabi_object_attribute): New method definition.
7428         (Target_arm::attributes_section_data_): New data member declaration.
7429         (read_arm_attributes_section): New template definition.
7430         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7431         (Arm_dynobj::do_read_symbols): Ditto.
7432         (Target_arm::do_finalize_sections): Merge attributes sections from
7433         input.  Check for BLX use after attributes section merging.
7434         Fix __exidx_start and __exidx_end visibility.  Create an
7435         .ARM.attributes section if necessary.
7436         (Target_arm::get_secondary_compatible_arch,
7437         Target_arm::set_secondary_compatible_arch,
7438         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7439         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7440         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7441         New method definitions.
7442
7443 2009-12-09  Ian Lance Taylor  <iant@google.com>
7444
7445         * plugin.cc (Plugin::load): Don't cast from void* to a function
7446         pointer.
7447
7448 2009-12-09  Ian Lance Taylor  <iant@google.com>
7449
7450         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7451         information fields.
7452
7453 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7454
7455         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7456         Replace two_file_shared_1.so with two_file_shared_2.so.
7457         * testsuite/Makefile.in: Regenerated.
7458
7459 2009-12-08  Doug Kwan  <dougkwan@google.com>
7460
7461         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7462         (HFILES): Add attributes.h and int_encoding.h.
7463         * Makefile.in: Regenerate.
7464         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7465         function definitions to int_encoding.cc
7466         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7467         prototypes to int_encoding.h
7468         * reduced_debug_output.cc (int_encoding.h): New include.
7469         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7470         function definitions to int_encoding.cc
7471         (insert_into_vector, read_from_pointer): Move template definitions to
7472         int_encoding.h
7473         * attributes.cc: New file.
7474         * attributes.h: New file.
7475         * int_encoding.cc: New file.
7476         * int_encoding.h: New file.
7477
7478 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7479
7480         PR gold/11055
7481         * incremental-dump.cc (dump_incremental_inputs): New.
7482         (main): Use dump_incremental_inputs.
7483
7484 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7485
7486         PR gold/10893
7487         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7488         checking elfcpp::STT_FUNC.
7489         (Target_i386::Relocate::relocate): Likewise.
7490         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7491
7492         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7493         symbols from shared libraries into normal FUNC symbols.
7494
7495         * symtab.h (Symbol): Add is_func and use it.
7496
7497 2009-12-05  Doug Kwan  <dougkwan@google.com>
7498
7499         * arm.cc (Target_arm::arm_info): Initialize new fields
7500         attributes_section and attributes_vendor.
7501         * i386.cc (Target_i386::i386_info): Same.
7502         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7503         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7504         fields attributes_section and attributes_vendor.
7505         * sparc.cc (Target_sparc::sparc_info): Same.
7506         * target.h (Target::attributes_section, Target::attributes_vendor,
7507         Target::is_attributes_section, Target::attribute_arg_type,
7508         Target::attributes_order): New method definitions.
7509         (Target::Target_info::attributes_section,
7510         Target::Target_info::attributes_vendor): New fields.
7511         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7512         virtual method definitions.
7513         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7514         attributes_section and attributes_vendor.
7515         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7516
7517 2009-12-05  Doug Kwan  <dougkwan@google.com>
7518
7519         * arm.cc: Update comments about interworking and stub generation.
7520         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7521         considered as non-PIC.
7522         (Arm_relocate_functions::base_abs): Fix formatting.
7523         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7524         of function to use GOT entry address instead of offset.
7525         (Target_arm::Scan::global): Issue an error if a symbol would need a
7526         PLT does not get one because it is untyped.  Remove code to create
7527         dynamic symbols for relative branches.
7528         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7529         takes unsigned integer instead of boolean.
7530
7531 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7532
7533         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7534         (two_file_test_LDADD): Likewise.
7535         (common_test_1_LDADD): Likewise.
7536         (exception_test_LDADD) Likewise.
7537         (weak_test_LDADD): Likewise.
7538         (many_sections_test_LDADD): Likewise.
7539         (initpri1_LDADD): Likewise.
7540         (script_test_1_LDADD): Likewise.
7541         (script_test_2_LDADD): Likewise.
7542         (justsyms_LDADD): Likewise.
7543         (binary_test_LDADD): Likewise.
7544         (large_LDADD): Likewise.
7545         * testsuite/Makefile.in: Regenerated.
7546
7547 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7548
7549         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7550         (Symbol_table::override_with_special): Likewise.
7551         (Symbol_table::add_from_object): Likewise.
7552
7553 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7554
7555         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7556         Don't set the data_offset twice.
7557
7558 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7559
7560         * testsuite/Makefile.in: Regenerate.
7561
7562 2009-12-03  Doug Kwan  <dougkwan@google.com>
7563
7564         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7565         (Target_arm::do_finalize_sections): Add parameter for symbol table
7566         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7567         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7568         parameter for symbol table pointer.
7569         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7570         an additional parameter for a pointer to symbol table.
7571         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7572         parameter for a symbol table pointer.
7573         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7574         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7575         Ditto.
7576         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7577         parameter for a symbol table pointer.
7578
7579 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7580
7581         * incremental.cc (Incremental_inputs_header)
7582         (Incremental_inputs_header_write, Incremental_inputs_entry)
7583         (Incremental_inputs_entry_write): Move ...
7584         * incremental.h (Incremental_inputs_header)
7585         (Incremental_inputs_header_write, Incremental_inputs_entry)
7586         (Incremental_inputs_entry_write): here.
7587
7588 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7589
7590         * incremental.cc (make_sized_incremental_binary): Set the target.
7591         Error if it is incompatible.
7592         * output.h (Output_file): Add filename method.
7593
7594 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7595
7596         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7597         from the get_* methods.
7598
7599 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7600
7601         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7602         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7603         Write 0 for the data_offset of scripts.
7604
7605 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7606
7607         * testsuite/Makefile.am: Add the incremental_test.sh test.
7608         * testsuite/incremental_test.sh: New.
7609         * testsuite/incremental_test_1.c: New.
7610         * testsuite/incremental_test_2.c: New.
7611
7612 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7613
7614        * incremental-dump.cc (main): Fix typos.
7615
7616 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7617
7618         PR gold/11025
7619         * incremental-dump.cc (main): Use llu to print 64 bit values.
7620
7621 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7622             H.J. Lu  <hongjiu.lu@intel.com>
7623
7624         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7625         $(LIBDL).
7626         (incremental_dump_LDADD): Likewise.
7627         * Makefile.in: Regenerated.
7628
7629 2009-11-25  Doug Kwan  <dougkwan@google.com>
7630
7631         Revert:
7632
7633         2009-11-25  Doug Kwan  <dougkwan@google.com>
7634
7635                 * arm.cc (Target_arm::Target_arm): Move method definition
7636                 outside of class definition.  Add code to handle
7637                 --target1-rel, --target1-abs and --target2= options.
7638                 (Target_arm::get_reloc_reloc_type): Change method to be
7639                 non-static and const.
7640                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7641                 New data member declaration.
7642                 (Target_arm::Scan::local, Target_arm::Scan::global,
7643                 Target_arm::Relocate::relocate,
7644                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7645                 Adjust call to Target_arm::get_real_reloc_type.
7646                 (Target_arm::get_real_reloc_type): Use command line options
7647                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7648                 * options.h (--target1-rel, --target1-abs, --target2): New
7649                 ARM-only options.
7650
7651 2009-11-25  Doug Kwan  <dougkwan@google.com>
7652
7653         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7654         class definition.  Add code to handle --target1-rel, --target1-abs
7655         and --target2= options.
7656         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7657         and const.
7658         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7659         member declaration.
7660         (Target_arm::Scan::local, Target_arm::Scan::global,
7661         Target_arm::Relocate::relocate,
7662         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7663         call to Target_arm::get_real_reloc_type.
7664         (Target_arm::get_real_reloc_type): Use command line options to
7665         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7666         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7667         options.
7668
7669 2009-11-25  Doug Kwan  <dougkwan@google.com>
7670
7671         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7672         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7673         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7674         formatting.
7675         (Arm_relocate_functions::thm_call): Replace body with a call to
7676         Arm_relocate_functions::thumb_branch_common.
7677         (Arm_relocate_functions::thm_jump24,
7678         Arm_relocate_functions::thm_xpc22): New method definitions.
7679         (Arm_relocate_functions::thumb_branch_common): New method definition.
7680         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7681         operator.
7682         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7683         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7684
7685 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7686
7687         * Makefile.am: Build incremental-dump
7688         * Makefile.in: Regenerate.
7689         * incremental-dump.cc: New.
7690         * incremental.cc (Incremental_inputs_header_data,
7691         Incremental_inputs_entry_data): Move to incremental.h
7692         * incremental.h: (Incremental_inputs_header_data,
7693         Incremental_inputs_entry_data): Move from incremental.cc
7694
7695 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7696
7697         * incremental.cc (Incremental_inputs_header,
7698         Incremental_inputs_header_write, Incremental_inputs_entry,
7699         Incremental_inputs_entry_write): Add a typedef with the data type.
7700
7701 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7702
7703         * incremental.cc (Incremental_inputs_header,
7704         Incremental_inputs_header_write, Incremental_inputs_entry,
7705         Incremental_inputs_entry_write): Update comment about which
7706         type has the filed descriptions.
7707
7708 2009-11-15  Doug Kwan  <dougkwan@google.com>
7709
7710         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7711         (Arm_relocate_functions::arm_branch_common): Change method defintion
7712         in class definition to a method declaration and update list of formal
7713         parameters.
7714         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7715         Arm_relocation_functions::jump24): Adjust call to
7716         Arm_relocate_functions::arm_branch_common.  Update list of formal
7717         parameters.
7718         (Arm_relocate_functions::xpc25): New method definition.
7719         (Arm_relocate_functions::arm_branch_common): Move method defintion
7720         out from class definition.  Use stubs for mode-switching and extending
7721         branch ranges.
7722         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7723         specially.  Change code to enable use of stubs in ARM branches.
7724
7725 2009-11-10  Doug Kwan  <dougkwan@google.com>
7726
7727         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7728         in method declaration.
7729         (Target_arm::relocate_stub): New method declaration.
7730         (Target_arm::default_target): Change to return a pointer instead of
7731         a const reference.
7732         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7733         Target_arm::default_target.
7734         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7735         method definition.
7736         (Target_arm::relocate_section): Adjust view.
7737         (Target_arm::relocate_stub): New method definition.
7738
7739 2009-11-10  Doug Kwan  <dougkwan@google.com>
7740
7741         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7742         a format warning.
7743         * incremental.cc (open_incremental_binary): Initialized local
7744         variables to avoid warnings.
7745         * object.cc (make_elf_object): Ditto.
7746         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7747         a format warning.
7748
7749 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7750
7751         PR gold/10930
7752         * testsuite/plugin_test.c: Include "config.h".
7753
7754 2009-11-09  Doug Kwan  <dougkwan@google.com>
7755
7756         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7757         (arm_symbol_value): Remove.
7758         (Arm_relocate_functions::arm_branch_common,
7759         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7760         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7761         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7762         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7763         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7764         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7765         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7766         Arm_relocate_functions::thm_mobw_abs_nc,
7767         Arm_relocate_functions::thm_mov_abs,
7768         Arm_relocate_functions::movw_prel_nc,
7769         Arm_relocate_functions::thm_movt_abs,
7770         Arm_relocate_functions::movt_prel,
7771         Arm_relocate_functions::thm_movw_prel_nc,
7772         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7773         (Target_arm::Relocate::relocate): Only decompose address into two
7774         parts if relocation type uses the thumb-bit and pass the actual
7775         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7776         calls to methods in Arm_relocate_functions for this change.
7777
7778 2009-11-08  Ian Lance Taylor  <iant@google.com>
7779
7780         PR 10925
7781         * reloc.cc: Instantiate
7782         Sized_relobj::initialize_input_to_output_maps and
7783         Sized_relobj:free_input_to_output_maps.
7784
7785 2009-11-06  Ian Lance Taylor  <iant@google.com>
7786
7787         PR 10876
7788         * defstd.cc (in_segment): Set only_if_ref true for "end".
7789
7790 2009-11-06  Doug Kwan  <dougkwan@google.com>
7791
7792         * arm.cc (class Reloc_stub): Correct a comment.
7793         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7794         (Target_arm::scan_section_for_stubs): New method declaration.
7795         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7796         Change methods from private to protected.
7797         (Target_arm::do_may_relax): New method definition.
7798         (Target_arm::do_relax, Target_arm::group_sections,
7799         Target_arm::scan_reloc_for_stub,
7800         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7801         (Target_arm::arm_input_section_map_): New data member declaration.
7802         (Target_arm::scan_reloc_for_stub,
7803         Target_arm::scan_reloc_section_for_stubs,
7804         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7805         Target_arm::do_relax): New method definitions.
7806
7807 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7808
7809         * configure.ac: Check for (struct stat)::st_mtim
7810         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7811         * config.in: Regenerate.
7812         * configure: Regenerate.
7813
7814 2009-11-05  Ian Lance Taylor  <iant@google.com>
7815
7816         PR 10910
7817         * output.cc (Output_segment::add_output_section): Add missing
7818         return statement.
7819
7820 2009-11-04  Ian Lance Taylor  <iant@google.com>
7821
7822         PR 10880
7823         * object.h (class Object): Add is_needed and set_is_needed
7824         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7825         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7826         defined in a dynamic object and referenced by a regular object,
7827         set is_needed for the dynamic object.
7828         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7829         if the file is marked with as_needed and it is not needed.
7830
7831 2009-11-04  Ian Lance Taylor  <iant@google.com>
7832
7833         PR 10887
7834         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7835         tags if data is discarded by linker script.
7836         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7837         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7838         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7839         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7840
7841 2009-11-04  Ian Lance Taylor  <iant@google.com>
7842
7843         * layout.cc (Layout::get_output_section): Add is_interp and
7844         is_dynamic_linker_section parameters.  Change all callers.
7845         (Layout::choose_output_section): Likewise.
7846         (Layout::make_output_section): Likewise.
7847         (Layout::add_output_section_data): Add is_dynamic_linker_section
7848         parameter.  Change all callers.
7849         * layout.h (class Layout): Update declarations.
7850         * output.h (class Output_section): Add is_interp, set_is_interp,
7851         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7852         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7853         generate_code_fills_at_write_ to a bitfield.
7854         * output.cc (Output_section::Output_sections): Initialize new
7855         fields.
7856         (Output_segment::add_output_section): Add do_sort parameter.
7857         Change all callers.
7858
7859 2009-11-03  Ian Lance Taylor  <iant@google.com>
7860
7861         PR 10860
7862         * options.h (class General_options): Add --warn-common.
7863         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7864         merging two common symbols.
7865         (Symbol_table::should_override): Handle --warn-common when merging
7866         a common symbol with a defined symbol.  Use report_resolve_problem
7867         for multiple definitions.
7868         (Symbol_table::report_resolve_problem): New function.
7869         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7870
7871 2009-11-03  Doug Kwan  <dougkwan@google.com>
7872
7873         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7874         stub_factory_.
7875         (Target_arm::stub_factory): New method definition.
7876         (Target_arm::new_arm_input_section,
7877         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7878         Target_arm::reloc_uses_thumb_bit): New method declarations.
7879         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7880         New type definitions.
7881         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7882         member declarations.
7883         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7884         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7885         New method definitions.
7886
7887 2009-11-03  Ian Lance Taylor  <iant@google.com>
7888
7889         * options.h (class General_options): Add --warn_constructors.
7890
7891 2009-11-03  Ian Lance Taylor  <iant@google.com>
7892
7893         PR 10893
7894         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7895         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7896
7897 2009-11-03  Ian Lance Taylor  <iant@google.com>
7898
7899         PR 10895
7900         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7901         --msgid-bugs-address.
7902         (install-pdf): New target.
7903         (install-data_yes): Look up one directory to find mkinstalldirs.
7904
7905 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7906
7907         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7908         tree.
7909
7910 2009-10-30  Doug Kwan  <dougkwan@google.com>
7911
7912         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7913
7914 2009-10-30  Doug Kwan  <dougkwan@google.com>
7915
7916         * arm.cc (Stub_addend_reader): New struct template definition
7917         and partial specializations.
7918         (Stub_addend_reader::operator()): New method definition for a
7919         partially specialized template.
7920
7921 2009-10-30  Doug Kwan  <dougkwan@google.com>
7922
7923         * arm.cc (Arm_relobj::processor_specific_flags): New method
7924         definition.
7925         (Arm_relobj::do_read_symbols): New method declaration.
7926         (Arm_relobj::processor_specific_flags_): New data member declaration.
7927         (Arm_dynobj): New class definition.
7928         (Target_arm::do_finalize_sections): Add input_objects parameter.
7929         (Target_arm::do_adjust_elf_header): New method declaration.
7930         (Target_arm::are_eabi_versions_compatible,
7931         (Target_arm::merge_processor_specific_flags): New method declaration.
7932         (Target_arm::do_make_elf_object): New overloaded method definitions
7933         and declaration.
7934         (Arm_relobj::do_read_symbols): New method definition.
7935         (Arm_dynobj::do_read_symbols): Ditto.
7936         (Target_arm::do_finalize_sections): Add input_objects parameters.
7937         Merge processor-specific flags from all input objects.
7938         (Target_arm::are_eabi_versions_compatible,
7939         Target_arm::merge_processor_specific_flags,
7940         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7941         New method definitions.
7942         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7943         Input_objects pointer type parameter.
7944         * layout.cc (Layout::finalize): Pass input objects to target's.
7945         finalize_sections function.
7946         * output.cc (Output_file_header::do_sized_write): Set ELF file
7947         header's processor-specific flags.
7948         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7949         Input_objects pointer type parameter.
7950         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7951         * target.h (Input_objects): New forward class declaration.
7952         (Target::processor_specific_flags,
7953         Target::are_processor_specific_flags_sect): New method definitions.
7954         (Target::finalize_sections): Add input_objects parameter.
7955         (Target::Target): Initialize processor_specific_flags_ and
7956         are_processor_specific_flags_set_.
7957         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7958         parameter.
7959         (Target::set_processor_specific_flags): New method definition.
7960         (Target::processor_specific_flags_,
7961         Target::are_processor_specific_flags_set_): New data member
7962         declarations.
7963         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7964         Input_objects pointer type parameter.
7965
7966 2009-10-30  Doug Kwan  <dougkwan@google.com>
7967
7968         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7969
7970 2009-10-28  Ian Lance Taylor  <iant@google.com>
7971
7972         * object.h (class Relobj): Drop options parameter from
7973         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7974         do_scan_relocs, do_relocate.  Change all callers.
7975         (class Sized_relobj): Drop options parameters from
7976         do_gc_process_relocs, do_scan_relocs, do_relocate,
7977         do_relocate_sections, relocate_sections, emit_relocs_scan,
7978         emit_relocs_scan_reltype.  Change all callers.
7979         (struct Relocate_info): Remove options field and all references to
7980         it.
7981         * reloc.h (class Read_relocs): Remove options constructor
7982         parameter and options_ field.  Change all callers.
7983         (class Gc_process_relocs, class Scan_relocs): Likewise.
7984         (class Relocate_task): Likewise.
7985         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7986         all callers.
7987         (scan_relocatable_relocs): Likewise.
7988         * target.h (class Sized_target): Remove options parameter from
7989         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7990         all callers.
7991         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7992         callers.
7993         * arm.cc: Update functions to remove options parameters.
7994         * i386.cc: Likewise.
7995         * powerpc.cc: Likewise.
7996         * sparc.cc: Likewise.
7997         * x86_64.cc: Likewise.
7998         * testsuite/testfile.cc: Likewise.
7999
8000 2009-10-28  Doug Kwan  <dougkwan@google.com>
8001
8002         * arm.cc (Arm_relobj): New class definition.
8003         (Arm_relobj::scan_sections_for_stubs,
8004         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8005         New method definitions.
8006
8007 2009-10-28  Cary Coutant  <ccoutant@google.com>
8008
8009         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8010         (Plugin::cleanup_done_): New member.
8011         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8012         (Plugin_manager::cleanup_done_): Remove.
8013         (Plugin_manager::add_input_file): Edit error message.
8014         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8015         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8016
8017 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8018
8019         * fileread.cc: (File_read::View::~View): Use the new
8020         data_ownership_ filed.
8021         (File_read::~File_read): Dispose the new whole_file_view_.
8022         (File_read::open): Mmap the whole file if needed.
8023         (File_read::open): Use whole_file_view_ instead of contents_.
8024         (File_read::find_view): Use whole_file_view_ if applicable.
8025         (File_read::do_read): Use whole_file_view_ instead of contents_.
8026         (File_read::make_view): Use whole_file_view_ instead of contents_,
8027         update File_read::View::View call.
8028         (File_read::find_or_make_view): Update File_read::View::View
8029         call.
8030         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8031         remove contents_
8032         (File_read::View::Data_ownership): New enum.
8033         (File_read::View::View): Replace bool mapped_ with Data_ownership
8034         argument.
8035         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8036         (File_read::View::data_ownership_): New field.
8037         (File_read::contents_): Remove (replaced by whole_file_view_).
8038         (File_read::whole_file_view_): New field.
8039         * options.h (class General_options): Add --keep-files-mapped.
8040
8041 2009-10-27  Cary Coutant  <ccoutant@google.com>
8042
8043         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8044         * testsuite/Makefile.am (plugin_test_5): New test case.
8045         * testsuite/Makefile.in: Regenerate.
8046
8047 2009-10-25  Doug Kwan  <dougkwan@google.com>
8048
8049         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8050         from private to protected to allow access by child class.
8051         (Sized_relobj::do_relocate_sections): New method declaration.
8052         (Sized_relobj::relocate_sections): Virtualize.
8053         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8054         Sized_relobj::relocate_sections.  Instantiate template explicitly
8055         for different target sizes and endianity.
8056
8057 2009-10-24  Doug Kwan  <dougkwan@google.com>
8058
8059         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8060         (Arm_input_section::as_arm_input_section): New method.
8061         (Arm_output_section): New class definition.
8062         (Arm_output_section::create_stub_group,
8063         Arm_output_section::group_sections): New method definitions.
8064
8065 2009-10-22  Doug Kwan  <dougkwan@google.com>
8066
8067         * arm.cc (Arm_input_section): New class definition.
8068         (Arm_input_section::init, Arm_input_section:do_write,
8069         Arm_input_section::set_final_data_size,
8070         Arm_input_section::do_reset_address_and_file_offset): New method
8071         definitions.
8072
8073 2009-10-21  Doug Kwan  <dougkwan@google.com>
8074
8075         * arm.cc (Stub_table, Arm_input_section): New forward class
8076         declarations.
8077         (Stub_table): New class defintion.
8078         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8079         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8080         New method definition.
8081
8082 2009-10-21  Doug Kwan  <dougkwan@google.com>
8083
8084         * arm.cc: Update copyright comments.
8085         (Target_arm): New forward class template declaration.
8086         (Arm_address): New type.
8087         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8088         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8089         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8090         constants.
8091         (Insn_template): Same.
8092         (DEF_STUBS): New macro.
8093         (Stub_type): New enum type.
8094         (Stub_template): New class definition.
8095         (Stub): Same.
8096         (Reloc_stub): Same.
8097         (Stub_factory): Same.
8098         (Target_arm::Target_arm): Initialize may_use_blx_ and
8099         should_force_pic_veneer_.
8100         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8101         Target_arm::should_force_pic_veneer,
8102         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8103         Target_arm::using_thumb_only, Target_arm:;default_target): New
8104         method defintions.
8105         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8106         New data member declarations.
8107         (Insn_template::size, Insn_template::alignment): New method defintions.
8108         (Stub_template::Stub_template): New method definition.
8109         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8110         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8111         (Stub_factory::Stub_factory): New method definition.
8112         * gold.h (string_hash): New template.
8113         * output.h (Input_section_specifier::hash_value): Use
8114         gold::string_hash.
8115         (Input_section_specifier::string_hash): Remove.
8116         * stringpool.cc (Stringpool_template::string_hash): Use
8117         gold::string_hash.
8118
8119 2009-10-20  Doug Kwan  <dougkwan@google.com>
8120
8121         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8122         symbols of relaxed input sections.
8123         * output.h (Output_section::find_relaxed_input_section): Make
8124         method public.
8125
8126 2009-10-16  Doug Kwan  <dougkwan@google.com>
8127
8128         * dynobj.cc (Versions::Versions): Initialize version_script_.
8129         Only insert base version symbol definition for a shared object
8130         if version script defines any version versions.
8131         (Versions::define_base_version): New method definition.
8132         (Versions::add_def): Check that base version is not needed.
8133         (Versions::add_need): Define base version lazily.
8134         * dynobj.h (Versions::define_base_version): New method declaration.
8135         (Versions::needs_base_version_): New data member declaration.
8136         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8137         (check_DATA): Add no_version_test.stdout.
8138         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8139         New make rules.
8140         * testsuite/Makefile.in: Regenerate.
8141         * testsuite/no_version_test.c: New file.
8142         * testsuite/no_version_test.sh: Ditto.
8143
8144 2009-10-16  Doug Kwan  <dougkwan@google.com>
8145
8146         * expression.cc (class Segment_start_expression): New class definition.
8147         (Segment_start_expression::value): New method definition.
8148         (script_exp_function_segment_start): Return a new
8149         Segment_start_expression.
8150         * gold/script-c.h (script_saw_segment_start_expression): New function
8151         prototype.
8152         * script-sections.cc (Script_sections::Script_sections): Initialize
8153         SAW_SEGMENT_START_EXPRESSION_ to false.
8154         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8155         and -Tbbs options to specify section addresses if given in
8156         command line and no SEGMENT_START expression is seen in a script.
8157         * script-sections.h (Script_sections::saw_segment_start_expression,
8158         Script_sections::set_saw_segment_start_expression): New method
8159         definition.
8160         (Script_sections::saw_segment_start_expression_): New data member
8161         declaration.
8162         * script.cc (script_saw_segment_start_expression): New function.
8163         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8164         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8165         script_test_7.sh and script_test_8.sh.
8166         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8167         script_test_8.stdout.
8168         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8169         (script_test_6, script_test_6.stdout, script_test_7,
8170         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8171         * Makefile.in: Regenerate.
8172         * testsuite/script_test_6.sh: New file.
8173         * testsuite/script_test_6.t: Same.
8174         * testsuite/script_test_7.sh: Same.
8175         * testsuite/script_test_7.t: Same.
8176         * testsuite/script_test_8.sh: Same.
8177
8178 2009-10-16  Doug Kwan  <dougkwan@google.com>
8179
8180         * output.cc (Output_segment::set_section_list_address): Cast
8181         expressions to unsigned long long type to avoid format warnings.
8182
8183 2009-10-15  Ian Lance Taylor  <iant@google.com>
8184
8185         * script.cc (Script_options::add_symbol_assignment): Always add a
8186         dot assignment to script_sections_.
8187         * script-sections.cc (Script_sections::add_dot_assignment):
8188         Initialize if necessary.
8189
8190         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8191         program headers with no load segment if there is a linker script.
8192
8193         * layout.cc (Layout::set_segment_offsets): Align the file offset
8194         to the segment aligment for -N or -n with no load segment.
8195         * output.cc (Output_segment::add_output_section): Don't crash if
8196         the first section is a TLS section.
8197         (Output_segment::set_section_list_addresses): Print an error
8198         message if the address moves backward in a linker script.
8199         * script-sections.cc
8200         (Output_section_element_input::set_section_addresses): Don't
8201         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8202         (Orphan_output_section::set_section_addresses): Likewise.
8203
8204 2009-10-15  Doug Kwan  <dougkwan@google.com>
8205
8206         * layout.cc (Layout::finish_dynamic_section): Generate tags
8207         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8208         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8209         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8210
8211 2009-10-14  Ian Lance Taylor  <iant@google.com>
8212
8213         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8214         fields.
8215         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8216         data_shdr fields of relinfo.
8217         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8218         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8219         R_386_TLS_LDO_32, adjust based on section flags.
8220         (Target_i386::Relocate::fix_up_ldo): Remove.
8221
8222 2009-10-13  Ian Lance Taylor  <iant@google.com>
8223
8224         Add support for -pie.
8225         * options.h (class General_options): Add -pie and
8226         --pic-executable.
8227         (General_options::output_is_position_independent): Test -pie.
8228         (General_options::output_is_executable): Return true if not shared
8229         and not relocatable.
8230         (General_options::output_is_pie): Remove.
8231         * options.cc (General_options::finalize): Reject incompatible uses
8232         of -pie.
8233         * gold.cc (queue_middle_tasks): A -pie link is not static.
8234         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8235         * symtab.cc (Symbol::final_value_is_known): Return false if
8236         output_is_position_independent.
8237         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8238         output_is_position_independent.
8239         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8240         output_is_position_independent.
8241         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8242         output_is_position_independent.
8243         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8244         two_file_pie_test.
8245         (basic_pie_test.o, basic_pie_test): New targets.
8246         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8247         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8248         (two_file_pie_test): New target.
8249         * testsuite/Makefile.in: Rebuild.
8250         * README: Remove note saying that -pie is not supported.
8251
8252 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8253
8254         * options.h (class General_options): Add -init and -fini.
8255         * layout.cc (Layout::finish_dynamic_section): Emit
8256         given init and fini functions.
8257
8258 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8259
8260         * gc.h (gc_process_relocs): Check if icf is enabled using new
8261         function.
8262         * gold.cc (queue_initial_tasks): Likewise.
8263         (queue_middle_tasks): Likewise.
8264         * object.cc (do_layout): Likewise.
8265         * symtab.cc (is_section_folded): Likewise.
8266         * main.cc (main): Likewise.
8267         * reloc.cc (Read_relocs::run): Likewise.
8268         (Sized_relobj::do_scan_relocs): Likewise.
8269         * icf.cc (is_function_ctor_or_dtor): New function.
8270         (Icf::find_identical_sections): Check if function is ctor or dtor when
8271         safe icf is chosen.
8272         * options.h (General_options::icf): Change option to be an enum.
8273         (Icf_status): New enum.
8274         (icf_enabled): New method.
8275         (icf_safe_folding): New method.
8276         (set_icf_status): New method.
8277         (icf_status_): New variable.
8278         * (options.cc) (General_options::finalize): Set icf_status_.
8279         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8280         icf_test and icf_keep_unique_test to use the --icf enum flag.
8281         * testsuite/icf_safe_test.sh: New file.
8282         * testsuite/icf_safe_test.cc: New file.
8283
8284 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8285
8286         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8287         includes to gc.h and icf.h.
8288         * arm.cc: Include gc.h.
8289         * gold.cc: Likewise.
8290         * i386.cc: Likewise.
8291         * powerpc.cc: Likewise.
8292         * sparc.cc: Likewise.
8293         * x86_64.cc: Likewise.
8294         * gc.h: Include icf.h.
8295
8296 2009-10-11  Ian Lance Taylor  <iant@google.com>
8297
8298         * plugin.cc: Include "gold.h" before other header files.
8299
8300 2009-10-10  Chris Demetriou  <cgd@google.com>
8301
8302         * options.h (Input_file_argument::Input_file_type): New enum.
8303         (Input_file_argument::is_lib_): Replace with...
8304         (Input_file_argument::type_): New member.
8305         (Input_file_argument::Input_file_argument): Take Input_file_type
8306         'type' rather than boolean 'is_lib' as second argument.
8307         (Input_file_argument::is_lib): Use type_.
8308         (Input_file_argument::is_searched_file): New function.
8309         (Input_file_argument::may_need_search): Handle is_searched_file.
8310         * options.cc (General_options::parse_library): Support -l:filename.
8311         (General_options::parse_just_symbols): Update for Input_file_argument
8312         changes.
8313         (Command_line::process): Likewise.
8314         * archive.cc (Archive::get_file_and_offset): Likewise.
8315         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8316         * script.cc (read_script_file, script_add_file): Likewise.
8317         * fileread.cc (Input_file::Input_file): Likewise.
8318         (Input_file::will_search_for): Handle is_searched_file.
8319         (Input_file::open): Likewise.
8320         * readsyms.cc (Read_symbols::get_name): Likewise.
8321         * testsuite/Makefile.am (searched_file_test): New test.
8322         * testsuite/Makefile.in: Regenerate.
8323         * testsuite/searched_file_test.cc: New file.
8324         * testsuite/searched_file_test_lib.cc: New file.
8325
8326 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8327             Ian Lance Taylor  <iant@google.com>
8328
8329         * descriptor.cc: Include <cstdio> and "binary-io.h".
8330         (Descriptors::open): Open the files in binary mode always.
8331         * script.cc (Lex::get_token): Treat \r as whitespace.
8332
8333 2009-10-09  Ian Lance Taylor  <iant@google.com>
8334
8335         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8336
8337 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8338             Ian Lance Taylor  <iant@google.com>
8339
8340         * configure.ac: Check for readv function also.
8341         * fileread.cc (readv): Define if not HAVE_READV.
8342         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8343         does not exist.
8344         * config.in: Regenerate.
8345         * configure: Regenerate.
8346
8347 2009-10-09  Doug Kwan  <dougkwan@google.com>
8348
8349         * layout.cc (Layout::make_output_section): Call target hook to make
8350         ordinary output section.
8351         (Layout::finalize): Adjust parameter list of call the
8352         Target::may_relax().
8353         * layout.h (class Layout::section_list): New method.
8354         * merge.h (Output_merge_base::entsize): Change visibility to public.
8355         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8356         New methods.
8357         (Output_merge_string::do_is_string): New method.
8358         * object.cc (Sized_relobj::do_setup): renamed from
8359         Sized_relobj::set_up.
8360         * object.h (Sized_relobj::adjust_shndx,
8361         Sized_relobj::initializ_input_to_output_maps,
8362         Sized_relobj::free_input_to_output_maps): Change visibilities to
8363         protected.
8364         (Sized_relobj::setup): Virtualize.
8365         (Sized_relobj::do_setup): New method declaration.
8366         (Sized_relobj::invalidate_section_offset,
8367         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8368         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8369         * options.cc (parse_int): New function.
8370         * options.h (parse_int): New declaration.
8371         (DEFINE_int): New macro.
8372         (stub_group_size): New option.
8373         * output.cc (Output_section::Output_section): Initialize memebers
8374         merge_section_map_, merge_section_by_properties_map_,
8375         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8376         (Output_section::add_input_section): Handled deferred code-fill
8377         generation and remove an old comment.
8378         (Output_section::add_relaxed_input_section): New method definition.
8379         (Output_section::add_merge_input_section): Use merge section by
8380         properties map to speed to search.  Update merge section maps
8381         as appropriate.
8382         (Output_section::build_relaxation_map): New method definition.
8383         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8384         Same.
8385         (Output_section::relax_input_section): Renamed to
8386         Output_section::convert_input_sections_to_relaxed_sections and change
8387         interface to take a vector of pointers to relaxed sections.
8388         (Output_section::find_merge_section,
8389         Output_section::find_relaxed_input_section): New method definitions.
8390         (Output_section::is_input_address_mapped,
8391         Output_section::output_offset, Output_section::output_address):
8392         Use output section data maps to speed up searching.
8393         (Output_section::find_starting_output_address): Add comments.
8394         (Output_section::do_write,
8395         Output_section::write_to_postprocessing_buffer): Do code-fill
8396         generation as appropriate.
8397         (Output_section::get_input_sections): Invalidate relaxed input section
8398         map.
8399         (Output_section::restore_states): Adjust type of checkpoint .
8400         Invalidate relaxed input section map.
8401         * output.h (Output_merge_base): New class declaration.
8402         (Input_section_specifier): New class defintion.
8403         (class Output_relaxed_input_section) Change base class to
8404         Output_section_data_build.
8405         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8406         base class initializer.
8407         (Output_section::add_relaxed_input_section): New method declaration.
8408         (Output_section::Input_section): Change visibility to protected.
8409         (Output_section::Input_section::relobj,
8410         Output_section::Input_section::shndx): Handle relaxed input sections.
8411         Output_section::input_sections) Change visibility to protected.  Also
8412         define overload to return a non-const pointer.
8413         (Output_section::Merge_section_properties): New class defintion.
8414         (Output_section::Merge_section_by_properties_map,
8415         Output_section::Output_section_data_by_input_section_map,
8416         Output_section::Relaxation_map): New types.
8417         (Output_section::relax_input_section): Rename method to
8418         Output_section::convert_input_sections_to_relaxed_sections and change
8419         interface to take a vector of relaxed section pointers.
8420         (Output_section::find_merge_section,
8421         Output_section::find_relaxed_input_section,
8422         Output_section::build_relaxation_map,
8423         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8424         New method declarations.
8425         (Output_section::merge_section_map_
8426         Output_section::merge_section_by_properties_map_,
8427         Output_section::relaxed_input_section_map_,
8428         Output_section::is_relaxed_input_section_map_valid_,
8429         Output_section::generate_code_fills_at_write_): New data members.
8430         * script-sections.cc
8431         (Output_section_element_input::set_section_addresses): Call
8432         current_data_size and addralign methods of relaxed input sections.
8433         (Orphan_output_section::set_section_addresses): Call current_data_size
8434         and addralign methods of relaxed input sections.
8435         * symtab.cc (Symbol_table::compute_final_value): Extract template
8436         from the body of Symbol_table::sized_finalize_symbol.
8437         (Symbol_table::sized_finalized_symbol): Call
8438         Symbol_table::compute_final_value.
8439         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8440         (Symbol_table::compute_final_value): New templated method declaration.
8441         * target.cc (Target::do_make_output_section): New method defintion.
8442         * target.h (Target::make_output_section): New method declaration.
8443         (Target::relax): Add more parameters for input objects, symbol table
8444         and layout.  Adjust call to do_relax.
8445         (Target::do_make_output_section): New method declaration.
8446         (Target::do_relax): Add parameters for input objects, symbol table
8447         and layout.
8448
8449 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8450
8451         * pread.c: Include stdio.h.
8452
8453 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8454
8455         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8456         defined.
8457
8458 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8459
8460         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8461         Change read_shndx type to unsigned int.
8462         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8463         int.
8464         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8465         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8466         Change read_shndx type to unsigned int.
8467         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8468         int.
8469         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8470         * layout.cc (Layout::create_symtab_sections): Cast the result of
8471         local_symcount * symsize to off_t in the gold_assert.
8472
8473 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8474
8475         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8476         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8477         R_ARM_BASE_ABS.
8478         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8479         (Arm_relocate_functions::thm_abs5): New function.
8480         (Arm_relocate_functions::abs12): New function.
8481         (Arm_relocate_functions::abs16): New function.
8482         (Arm_relocate_functions::base_abs): New function.
8483         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8484         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8485         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8486         R_ARM_BASE_ABS.
8487         (Scan::global): Likewise.
8488         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8489         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8490         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8491         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8492         R_ARM_BASE_ABS.
8493
8494 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8495
8496         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8497         (Arm_relocate_functions::movt_prel): New function.
8498         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8499         (Arm_relocate_functions::thm_movt_prel): New function.
8500         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8501         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8502         (Scan::global, Relocate::relocate): Likewise.
8503         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8504
8505 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8506
8507         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8508         Incremental_checker.
8509         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8510         unsigned int.
8511         (class Incremental_inputs_header): New class.
8512         (Incremental_inputs_header_writer): Edit comment.
8513         (Incremental_inputs_entry): New class.
8514         (Incremental_inputs_entry_writer): Edit comment.
8515         (Sized_incremental_binary::do_find_incremental_inputs_section):
8516         Add *strtab_shndx parameter, fill it.
8517         (Sized_incremental_binary::do_check_inputs): New method.
8518         (Incremental_checker::can_incrementally_link_output_file): Use
8519         Sized_incremental_binary::check_inputs.
8520         (Incremental_inputs::report_command_line): Save command line in
8521         command_line_.
8522         * incremental.h:
8523         (Incremental_binary::find_incremental_inputs_section): New
8524         method.
8525         (Incremental_binary::do_find_incremental_inputs_section): Add
8526         strtab_shndx parameter.
8527         (Incremental_binary::do_check_inputs): New pure virtual method.
8528         (Sized_incremental_binary::do_check_inputs): Declare.
8529         (Incremental_checker::Incremental_checker): Add incremental_inputs
8530         parameter, use it to initialize incremental_inputs_.
8531         (Incremental_checker::incremental_inputs_): New field.
8532         (Incremental_checker::command_line): New method.
8533         (Incremental_checker::inputs): New method.
8534         (Incremental_checker::command_line_): New field.
8535
8536 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8537
8538         * incremental.cc: Include <cstdarg> and "target-select.h".
8539         (vexplain_no_incremental): New function.
8540         (explain_no_incremental): New function.
8541         (Incremental_binary::error): New method.
8542         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8543         method.
8544         (make_sized_incremental_binary): New function.
8545         (open_incremental_binary): New function.
8546         (can_incrementally_link_file): Add checks if output is ELF and has
8547         inputs section.
8548         * incremental.h: Include "elfcpp_file.h" and "output.h".
8549         (Incremental_binary): New class.
8550         (Sized_incremental_binary): New class.
8551         (open_incremental_binary): Declare.
8552         * object.cc (is_elf_object): Use
8553         elfcpp::Elf_recognizer::is_elf_file.
8554         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8555         * output.h (Output_file::filesize): New method.
8556
8557 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8558
8559         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8560         New function.
8561         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8562         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8563         function.
8564         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8565         function.
8566         (Arm_relocate_functions::movw_abs_nc): New function.
8567         (Arm_relocate_functions::movt_abs): New function.
8568         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8569         (Arm_relocate_functions::thm_movt_abs): New function.
8570         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8571         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8572         (Scan::global): Likewise.
8573         (Relocate::relocate): Likewise.
8574         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8575
8576 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8577
8578         * arm.cc (Arm_relocate_functions::got_prel) New function.
8579         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8580         (Relocate::relocate): Likewise.
8581         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8582
8583 2009-10-06  Ian Lance Taylor  <iant@google.com>
8584
8585         * options.h (class General_options): Define
8586         split_stack_adjust_size parameter.
8587         * object.h (class Object): Add uses_split_stack_ and
8588         has_no_split_stack_ fields.  Add uses_split_stack and
8589         has_no_split_stack accessor functions.  Declare
8590         handle_split_stack_section.
8591         (class Reloc_symbol_changes): Define.
8592         (class Sized_relobj): Define Function_offsets.  Declare
8593         split_stack_adjust, split_stack_adjust_reltype, and
8594         find_functions.
8595         * object.cc (Object::handle_split_stack_section): New function.
8596         (Sized_relobj::do_layout): Call handle_split_stack_section.
8597         * dynobj.cc (Sized_dynobj::do_layout): Call
8598         handle_split_stack_section.
8599         * reloc.cc (Sized_relobj::relocate_sections): Call
8600         split_stack_adjust for executable sections in split_stack
8601         objects.  Pass reloc_map to relocate_section.
8602         (Sized_relobj::split_stack_adjust): New function.
8603         (Sized_relobj::split_stack_adjust_reltype): New function.
8604         (Sized_relobj::find_functions): New function.
8605         * target-reloc.h: Include "object.h".
8606         (relocate_section): Add reloc_symbol_changes parameter.  Change
8607         all callers.
8608         * target.h (class Target): Add calls_non_split method.  Declare
8609         do_calls_non_split virtual method.  Declare match_view and
8610         set_view_to_nop.
8611         * target.cc: Include "elfcpp.h".
8612         (Target::do_calls_non_split): New function.
8613         (Target::match_view): New function.
8614         (Target::set_view_to_nop): New function.
8615         * gold.cc (queue_middle_tasks): Give an error if mixing
8616         split-stack and non-split-stack objects with -r.
8617         * i386.cc (Target_i386::relocate_section): Add
8618         reloc_symbol_changes parameter.
8619         (Target_i386::do_calls_non_split): New function.
8620         * x86_64.cc (Target_x86_64::relocate_section): Add
8621         reloc_symbol_changes parameter.
8622         (Target_x86_64::do_calls_non_split): New function.
8623         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8624         parameter.
8625         * powerpc.cc (Target_powerpc::relocate_section): Add
8626         reloc_symbol_changes parameter.
8627         * sparc.cc (Target_sparc::relocate_section): Add
8628         reloc_symbol_changes parameter.
8629         * configure.ac: Call AM_CONDITIONAL for the default target.
8630         * configure: Rebuild.
8631         * testsuite/Makefile.am (TEST_AS): New variable.
8632         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8633         (check_DATA): Add split_i386 and split_x86_64 files.
8634         (SPLIT_DEFSYMS): Define.
8635         (split_i386_[1234n].o): New targets.
8636         (split_i386_[124]): New targets.
8637         (split_i386_[1234r].stdout): New targets.
8638         (split_x86_64_[1234n].o): New targets.
8639         (split_x86_64_[124]): New targets.
8640         (split_x86_64_[1234r].stdout): New targets.
8641         (MOSTLYCLEANFILES): Add new executables.
8642         * testsuite/split_i386.sh: New file.
8643         * testsuite/split_x86_64.sh: New file.
8644         * testsuite/split_i386_1.s: New file.
8645         * testsuite/split_i386_2.s: New file.
8646         * testsuite/split_i386_3.s: New file.
8647         * testsuite/split_i386_4.s: New file.
8648         * testsuite/split_i386_n.s: New file.
8649         * testsuite/split_x86_64_1.s: New file.
8650         * testsuite/split_x86_64_2.s: New file.
8651         * testsuite/split_x86_64_3.s: New file.
8652         * testsuite/split_x86_64_4.s: New file.
8653         * testsuite/split_x86_64_n.s: New file.
8654         * testsuite/testfile.cc (Target_test): Update relocation_section
8655         function.
8656         * testsuite/Makefile.in: Rebuild.
8657
8658 2009-10-06  Ian Lance Taylor  <iant@google.com>
8659
8660         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8661         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8662         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8663         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8664         the address on ldo_addrs_.
8665         (Target_i386::Relocate::fix_up_ldo): New function.
8666
8667 2009-10-06   Rafael Espindola  <espindola@google.com>
8668
8669         * plugin.cc (add_input_library): New.
8670         (Plugin::load): Add add_input_library to tv.
8671         (Plugin_manager::add_input_file): Add the is_lib argument.
8672         (add_input_file): Update call to Plugin_manager::add_input_file.
8673         (add_input_library): New.
8674         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8675
8676 2009-09-30  Doug Kwan  <dougkwan@google.com>
8677
8678         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8679         symbol and call Symbol::may_need_copy_reloc to determine if
8680         a copy reloc is needed.
8681         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8682         nocopyreloc is given in command line.
8683         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8684         given in command line.
8685         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8686         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8687         of the removed Target_i386::may_need_copy_reloc.
8688         * options.h (copyreloc): New option with default value false.
8689         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8690         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8691         instead of the removed Target_powerpc::may_need_copy_reloc.
8692         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8693         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8694         instead of the removed Target_sparc::may_need_copy_reloc.
8695         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8696         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8697         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8698         instead of the removed Target_x86_64::may_need_copy_reloc.
8699
8700 2009-09-30  Ian Lance Taylor  <iant@google.com>
8701
8702         * object.h (class Object): Remove target_ field, and target,
8703         sized_target, and set_target methods.
8704         (Object::sized_target): Remove.
8705         (class Sized_relobj): Update declarations.  Remove sized_target.
8706         * object.cc (Sized_relobj::setup): Remove target parameter.
8707         Change all callers.
8708         (Input_objects::add_object): Don't do anything with the target.
8709         (make_elf_sized_object): Add punconfigured parameter.  Change all
8710         callers.  Set or test parameter target.
8711         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8712         Change all callers.
8713         * parameters.cc (Parameters::set_target): Change parameter type to
8714         be non-const.
8715         (Parameters::default_target): Remove.
8716         (set_parameters_target): Change parameter type to be non-const.
8717         (parameters_force_valid_target): New function.
8718         (parameters_clear_target): New function.
8719         * parameters.h (class Parameters): Update declarations.  Remove
8720         default_target method.  Add sized_target and clear_target
8721         methods.  Change target_ to be non-const.
8722         (set_parameters_target): Update declaration.
8723         (parameters_force_valid_target): Declare.
8724         (parameters_clear_target): Declare.
8725         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8726         as NULL if we aren't searching.
8727         (Add_symbols::run): Don't check for compatible target.
8728         * fileread.cc (Input_file::open_binary): Call
8729         parameters_force_valid_target.
8730         * gold.cc (queue_middle_tasks): Likewise.
8731         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8732         set_target on object.
8733         * dynobj.h (class Sized_dynobj): Update declarations.
8734         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8735         make_elf_object returns NULL.
8736         (Archive::include_member): Don't check whether object target is
8737         compatible.
8738         * output.cc (Output_section::add_input_section): Get target from
8739         parameters.
8740         (Output_section::relax_input_section): Likewise.
8741         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8742         parameters.
8743         (Sized_relobj::do_scan_relocs): Likewise.
8744         (Sized_relobj::relocate_sections): Likewise.
8745         * resolve.cc (Symbol_table::resolve): Likewise.
8746         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8747         parameter.  Change all callers.
8748         (Symbol_table::add_from_object): Get target from parameters.
8749         (Symbol_table::add_from_relobj): Don't check object target.
8750         (Symbol_table::add_from_dynobj): Likewise.
8751         (Symbol_table::define_special_symbol): Get target from
8752         parameters.
8753         * symtab.h (class Symbol_table): Update declaration.
8754         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8755         parameter.  Change all callers.  Clear parameter target.
8756         (Binary_test): Test target here.
8757         * testsuite/object_unittest.cc (gold_testsuite): Remove
8758         target_test_pointer parameter.  Change all callers.
8759         (Object_test): Test target here.
8760
8761 2009-09-26  Ian Lance Taylor  <iant@google.com>
8762
8763         * testsuite/initpri1.c: Don't try to use constructor priorities if
8764         compiling with gcc before 4.3.
8765
8766 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8767
8768         * testsuite/retain_symbols_file_test.sh (check_present): Change
8769         output file name to retain_symbols_file_test.stdout.
8770         (check_absent): Likewise.
8771
8772 2009-09-18  Craig Silverstein  <csilvers@google.com>
8773
8774         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8775         * options.cc: Include <cerrno> and <fstream>.
8776         (General_options::finalize): Parse -retain-symbols-file tag.
8777         * options.h: New flag.
8778         (General_options): New method should_retain_symbol, new
8779         variable symbols_to_retain.
8780         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8781         should_retain_symbol map.
8782         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8783         * testsuite/Makefile.in: Regenerate.
8784         * testsuite/retain_symbols_file_test.sh: New file.
8785
8786 2009-09-18  Nick Clifton  <nickc@redhat.com>
8787
8788         * po/es.po: Updated Spanish translation.
8789
8790 2009-09-17  Doug Kwan  <dougkwan@google.com>
8791
8792         * debug.h (DEBUG_RELAXATION): New constant.
8793         (DEBUG_ALL): Add DEBUG_RELAXATION.
8794         (debug_string_to_enum): Add relaxation debug option.
8795         * layout.cc
8796         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8797         Layout::Relaxation_debug_check::read_sections,
8798         Layout::Relaxation_debug_check::read_sections): New method definitions.
8799         (Layout::Layout): Initialize data members
8800         record_output_section_data_from_scrips_,
8801         script_output_section_data_list_ and relaxation_debug_check_.
8802         (Layout::save_segments, Layout::restore_segments,
8803         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8804         Layout::relaxation_loop_body): New method definitions.
8805         (Layout::finalize): Support relaxation.  Move section layout code to
8806         Layout::relaxation_loop_body.
8807         (Layout::set_asection_address_from_script): Move code for orphan
8808         section placement out.
8809         (Layout::place_orphan_sections_in_script): New method definition.
8810         * layout.h (Output_segment_headers, Output_file_header):
8811         New forward class declarations.
8812         (Layout::~Layout): Define.
8813         (Layout::new_output_section_data_from_script): New method definition.
8814         (Layout::place_orphan_sections_in_script): New method declaration.
8815         (Layout::Segment_states): New type declaration.
8816         (Layout::save_segments, Layout::restore_segments,
8817         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8818         Layout::relaxation_loop_body): New method declarations.
8819         (Layout::Output_section_data_list): New type declaration.
8820         (Layout::Relaxation_debug_check): New class definition.
8821         (Layout::record_output_section_data_from_script_,
8822         Layout::script_output_section_data_list_, Layout::segment_states_,
8823         Layout::relaxation_debug_check_): New data members.
8824         * output.cc: (Output_section_headers::do_size): New method definition.
8825         (Output_section_headers::Output_section_headers): Move size
8826         computation to Output_section_headers::do_size.
8827         (Output_segment_headers::do_size): New method definition.
8828         (Output_file_header::Output_file_header): Move size computation to
8829         Output_file_header::do_size and call it.
8830         (Output_file_header::do_size): New method definition.
8831         (Output_data_group::Output_data_group): Adjust call to
8832         Output_section_data.
8833         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8834         (Output_symtab_xindex::do_write): Add array bound check.
8835         (Output_section::Input_section::print_to_mapfile): Handle
8836         RELAXED_INPUT_SECTION_CODE.
8837         (Output_section::Output_section): Initialize data member checkpoint_.
8838         (Output_section::~Output_section): Delete checkpoint object pointed
8839         by checkpoint_.
8840         (Output_section::add_input_section): Always add an Input_section if
8841         relaxing.
8842         (Output_section::add_merge_input_section): Add assert.
8843         (Output_section::relax_input_section): New method definition.
8844         (Output_section::set_final_data_size): Set load address to zero for
8845         an unallocated section.
8846         (Output_section::do_address_and_file_offset_have_reset_values):
8847         New method definition.
8848         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8849         Handle relaxed input section.
8850         (Output_section::sort_attached_input_sections): Checkpoint input
8851         section list lazily.
8852         (Output_section::get_input_sections): Change type of input_sections to
8853         list of Simple_input_section pointers.  Checkpoint input section list
8854         lazily.  Also handle relaxed input sections.
8855         (Output_section::add_input_section_for_script): Take a reference to
8856         a Simple_input_section object instead of Relobj pointer and section
8857         index as parameter.  Handle relaxed input sections.
8858         (Output_section::save_states, Output_section::restore_states): New
8859         method definitions.
8860         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8861         (Output_data::is_data_size_fixed): New method definition.
8862         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8863         if it is fixed.
8864         (Output_data::address_and_file_offset_have_reset_values): New method
8865         definition.
8866         (Output_data::do_address_and_file_offset_have_reset_values): New method
8867         definition.
8868         (Output_data::set_data_size): Check that data size is not fixed.
8869         (Output_data::fix_data_size): New method definition.
8870         (Output_data::is_data_size_fixed_): New data member.
8871         (Output_section_headers::set_final_data_size): New method definition.
8872         (Output_section_headers::do_size): New method declaration.
8873         (Output_segment_headers::set_final_data_size): New method definition.
8874         (Output_segment_headers::do_size): New method declaration.
8875         (Output_file_header::set_final_data_size)::New method definition.
8876         (Output_file_header::do_size)::New method declaration.
8877         (Output_section_data::Output_section_data): Add new parameter
8878         is_data_size_fixed and use it to fix data size.
8879         (Output_data_const::Output_data_const): Adjust call to base class
8880         constructor and fix data size.
8881         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8882         base class constructor and fix data size.
8883         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8884         base class constructor and fix data size.
8885         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8886         class constructor and fix data size.
8887         (Output_data_group::set_final_data_size): New method definition.
8888         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8889         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8890         class constructor and fix data size.
8891         (Output_relaxed_input_section): New class definition.
8892         (Output_section::Simple_input_section): New class definition.
8893         (Output_section::get_input_sections): Adjust parameter list.
8894         (Output_section::add_input_section_for_script): Same.
8895         (Output_section::save_states, Output_section::restore_states,
8896         Output_section::do_address_and_file_offset_have_reset_values,
8897         (Output_section::Input_section::Input_section): Handle
8898         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8899         Output_relaxed_input_section.
8900         (Output_section::Input_section::is_input_section,
8901         Output_section::Input_section::set_output_section): Handle relaxed
8902         input section.
8903         (Output_section::Input_section::is_relaxed_input_section,
8904         Output_section::Input_section::output_section_data,
8905         Output_section::Input_section::relaxed_input_section): New method
8906         definitions.
8907         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8908         value.
8909         (Output_section::Input_section::u1_): Update comments.
8910         (Output_section::Input_section::u2_): Add new union member poris.
8911         (Output_section::Checkpoint_output_section): New classs definition.
8912         (Output_section::relax_input_section): New method declaration.
8913         (Output_section::checkpoint_): New data member.
8914         (Output_segment): Update comments.
8915         (Output_segment::Output_segment): Un-privatize copy constructor.
8916         (Output_segment::operator=): Un-privatize.
8917         * script-sections.cc (Output_section_element::Input_section_list):
8918         Change element type to Output_section::Simple_input_section.
8919         (Output_section_element_dot_assignment::set_section_addresses):
8920         Register output section data for relaxation clean up.
8921         (Output_data_exression::Output_data_expression): Adjust call to base
8922         constructor to fix data size.
8923         (Output_section_element_data::set_section_addresses): Register
8924         Output_data_expression object for relaxation clean up.
8925         (struct Input_section_info): Replace Relobj pointer and section index
8926         pair with Output_section::Simple_input_section and Convert struct to a
8927         class.
8928         (Input_section_sorter::operator()): Adjust access to
8929         Input_section_info data member to use accessors.
8930         (Output_section_element_input::set_section_addresses): Use layout
8931         parameter.  Adjust code to use Output_section::Simple_input_section
8932         and Input_secction_info classes.  Register filler for relaxation
8933         clean up.
8934         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8935         and section index pair with Output_section::Simple_input_section
8936         class.  Adjust code accordingly.
8937         (Phdrs_element::release_segment): New method definition.
8938         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8939         segment list.
8940         (Script_sections::release_segments): New method definition.
8941         * gold/script-sections.h (Script_sections::release_segments): New
8942         method declaration.
8943         * gold/target.h (Target::may_relax, Target::relax,
8944         Target::do_may_relax, Target::do_relax): New method definitions.
8945
8946 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8947
8948         * arm.cc (has_signed_unsigned_overflow): New function.
8949         (Arm_relocate_functions::abs8): New function.
8950         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8951         (Target_arm::Scan::global): Likewise.
8952         (Target_arm::relocate::relocate): Likewise.
8953         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8954         Likewise.
8955
8956 2009-09-16  Cary Coutant  <ccoutant@google.com>
8957
8958         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8959         * testsuite/Makefile.in: Regenerate.
8960
8961 2009-09-11  Nick Clifton  <nickc@redhat.com>
8962
8963         * po/gold.pot: Updated by the Translation project.
8964
8965 2009-09-08  Cary Coutant  <ccoutant@google.com>
8966
8967         * output.cc (Output_file::open): Add execute permission to empty file.
8968         * testsuite/Makefile.am (permission_test): New test.
8969         * testsuite/Makefile.in: Regenerate.
8970
8971 2009-09-02  Ian Lance Taylor  <iant@google.com>
8972
8973         * output.cc (Output_file::resize): Call map_no_anonymous rather
8974         than map.
8975
8976 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8977
8978         * gold.cc: Include "incremental.h".
8979         (queue_initial_tasks): Call Incremental_checker methods.
8980         * incremental.cc: Include "output.h".
8981         (Incremental_checker::can_incrementally_link_output_file): New
8982         method.
8983         * incremental.h (Incremental_checker): New class.
8984
8985         * output.cc (Output_file::open_for_modification): New method.
8986         (Output_file::map_anonymous): Changed return type to bool.  Record
8987         map in base_ field.
8988         (Output_file::map_no_anonymous): New method, broken out of map.
8989         (Output_file::map): Use map_no_anonymous and map_anonymous.
8990         * output.h (class Output_file): Update declarations.
8991
8992 2009-08-24  Cary Coutant  <ccoutant@google.com>
8993
8994         * options.h (Command_line::Pre_options): New class.
8995         (Command_line::pre_options): New member.
8996         * options.cc (gold::options::ready_to_register): New variable.
8997         (One_option::register_option): Do nothing if not registering options.
8998         Assert if same short option registered twice.
8999         (General_options::General_options): Turn off option registration when
9000         done constructing.
9001         (Command_line::Pre_options::Pre_options): New constructor.
9002
9003 2009-08-24  Cary Coutant  <ccoutant@google.com>
9004
9005         * options.h (General_options::no_keep_memory): Remove incorrect
9006         short option.
9007
9008 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9009
9010         * Makefile.am (am__skiplex, am__skipyacc): New.
9011         * Makefile.in: Regenerate.
9012
9013 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9014
9015         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9016         (INCLUDES): ... this.
9017         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9018         (AM_CPPFLAGS): Renamed from ...
9019         (INCLUDE): ... this.
9020         * Makefile.in, testsuite/Makefile.in: Regenerate.
9021
9022         * Makefile.in: Regenerate.
9023         * aclocal.m4: Likewise.
9024         * config.in: Likewise.
9025         * configure: Likewise.
9026         * testsuite/Makefile.in: Likewise.
9027
9028         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9029         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9030         * Makefile.in: Regenerate.
9031         * testsuite/Makefile.in: Regenerate.
9032
9033 2009-08-19  Cary Coutant  <ccoutant@google.com>
9034
9035         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9036         symbols in shared libraries overridden by hidden or internal symbols
9037         in the main program.
9038
9039 2009-08-19  Chris Demetriou  <cgd@google.com>
9040
9041         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9042         checking source file names in error messages.
9043
9044 2009-08-18  Doug Kwan  <dougkwan@google.com>
9045
9046         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9047         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9048         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9049         an elfcpp::Ehdr as parameter.
9050         * object.cc (Object::set_target): Remove the version that looks up
9051         a target and sets it.
9052         (Sized_relobj::setup): Take a Target object instead of
9053         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9054         (make_elf_sized_object): Find target and ask target to
9055         make an ELF object.
9056         * object.h: (Object::set_target): Remove the version that looks up
9057         a target and sets it.
9058         (Sized_relobj::setup): Take a Target object instead of
9059         an elfcpp:Ehdr as parameter.
9060         * target.cc: Include dynobj.h.
9061         (Target::do_make_elf_object_implementation): New.
9062         (Target::do_make_elf_object): New.
9063         * target.h (Target::make_elf_object): New template declaration.
9064         (Target::do_make_elf_object): New method declarations.
9065         (Target::do_make_elf_object_implementation): New template declaration.
9066
9067 2009-08-14  Ian Lance Taylor  <iant@google.com>
9068
9069         * gold.h (FUNCTION_NAME): Define.
9070         (gold_unreachable): Use FUNCTION_NAME.
9071
9072 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9073
9074         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9075         symbol in the --keep-unique list is not found.
9076
9077 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9078
9079         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9080         been maked as --keep-unique.
9081         (Icf::unfold_section): New function.
9082         * icf.h (Icf::unfold_section): New function.
9083         * options.h (General_options::keep_unique): New option.
9084         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9085         * testsuite/Makefile.in: Regenerate.
9086         * testsuite/icf_keep_unique_test.sh: New file.
9087         * testsuite/icf_keep_unique_test.cc: New file.
9088
9089 2009-08-12  Cary Coutant  <ccoutant@google.com>
9090
9091         PR 10471
9092         * resolve.cc (Symbol_table::resolve): Check for references from
9093         dynamic objects to hidden and internal symbols.
9094         * testsuite/Makefile.am (hidden_test.sh): New test.
9095         * testsuite/Makefile.in: Regenerate.
9096         * testsuite/hidden_test.sh: New script.
9097         * testsuite/hidden_test_1.c: New test source.
9098         * testsuite/hidden_test_main.c: New test source.
9099
9100 2009-08-11  Doug Kwan  <dougkwan@google.com>
9101
9102         * arm.cc: Update comments.
9103         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9104         segment to locate the .ARM.exidx section if present.
9105
9106 2009-08-09  Doug Kwan  <dougkwan@google.com>
9107
9108         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9109         patch.
9110
9111 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9112         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9113         compiler warnings.
9114
9115 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9116
9117         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9118         valid tls_segment only for non-debug-section relocations.
9119         * testsuite/Makefile.am: Add gc_tls_test.
9120         * testsuite/Makefile.in: Regenerate.
9121         * testsuite/gc_tls_test.cc: New file.
9122         * testsuite/gc_tls_test.sh: New file.
9123
9124 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9125
9126         * icf.cc: New file.
9127         * icf.h: New file.
9128         * Makefile.am (CCFILES): Add icf.cc.
9129         (HFILES): Add icf.h
9130         * Makefile.in: Regenerate.
9131         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9132         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9133         section, symbol and addend information for the relocs.
9134         * gold.cc (queue_middle_tasks): Call identical code folding.
9135         * gold.h: Add defines for multimap.
9136         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9137         to the call of finalize_local_symbols.
9138         * main.cc (main): Create object of class Icf.
9139         * object.cc (Sized_relobj::do_layout): Allow this function to be
9140         called twice during icf.
9141         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9142         to sections marked as identical by icf.
9143         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9144         when available.
9145         (Sized_relobj::do_section_entsize): New function.
9146         * object.h (Object::section_entsize): New function.
9147         (Object::do_section_entsize): New pure virtual function.
9148         (Relobj::finalize_local_symbols): Add new parameter.
9149         (Relobj::do_section_entsize): New function.
9150         * options.h (General_options::icf): New option.
9151         (General_options::icf_iterations): New option.
9152         (General_options::print_icf_sections): New option.
9153         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9154         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9155         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9156         icf.
9157         * symtab.cc (Symbol_table::is_section_folded): New function.
9158         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9159         to sections marked as identical by icf.
9160         * symtab.h (Symbol_table::set_icf): New function.
9161         (Symbol_table::icf): New function.
9162         (Symbol_table::is_section_folded): New function.
9163         (Symbol_table::icf_): New data member.
9164         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9165         * testsuite/Makefile.am: Add commands to build icf_test.
9166         * testsuite/Makefile.in: Regenerate.
9167         * testsuite/icf_test.sh: New file.
9168         * testsuite/icf_test.cc: New file.
9169
9170 2009-07-24  Chris Demetriou  <cgd@google.com>
9171
9172         * layout.cc (is_compressible_debug_section): Fix incorrect
9173         comment about compressed section names.
9174
9175 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9176
9177         PR 10419
9178         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9179
9180 2009-07-16  Ian Lance Taylor  <iant@google.com>
9181
9182         PR 10400
9183         * layout.h: #include <map>.
9184         (class Kept_section): Change from struct to class.  Add accessors
9185         and setters.  Add section size to Comdat_group mapping.  Change
9186         Comdat_group to std::map.  Add is_comdat_ field.  Add
9187         linkonce_size field in union.
9188         (class Layout): Update declaration of find_or_add_kept_section.
9189         Don't declare find_kept_object.
9190         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9191         parameter.  Add object, shndx, is_comdat, and is_group_name
9192         parameters.  Change all callers.  Adjust for new Kept_section.
9193         (Layout::find_kept_object): Remove.
9194         * object.cc (Sized_relobj::include_section_group): Update use of
9195         Kept_section.  Rename secnum to shndx.  Only record
9196         Kept_comdat_section if sections are the same size.
9197         (Sized_relobj::include_linkonce_section): Update use of
9198         Kept_section.  Only record Kept_comdat_section if sections are the
9199         same size.  Set size of linkonce section.
9200         (Sized_relobj::map_to_kept_section): Update call to
9201         get_kept_comdat_section.
9202         * object.h (class Sized_relobj): Rename fields in
9203         Kept_comdat_section to drop trailing underscores; change object
9204         field to Relobj*.  Change Kept_comdat_section_table to store
9205         struct rather than pointer.
9206         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9207         Add kept_object and kept_shndx parameters.  Change all callers.
9208         (Sized_relobj::get_kept_comdat_section): Change return type to
9209         bool.  Add kept_object and kept_shndx parameters.  Change all
9210         callers.
9211         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9212         Layout::find_or_add_kept_section.
9213
9214 2009-07-09  Ian Lance Taylor  <iant@google.com>
9215
9216         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9217         Reserve space in the hash table.
9218
9219 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9220
9221         * fileread.cc (File_read::get_mtime): New method.
9222         * fileread.h (Timespec): New structure.
9223         (File_read::get_mtime): New method.
9224         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9225         Renamed from timestamp_nsec.
9226         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9227         Elf_Xword.
9228         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9229         timestamp_nsec.
9230         (Incremental_inputs::report_archive): Save mtime; style fix.
9231         (Incremental_inputs::report_obejct): Save mtime; style fix.
9232         (Incremental_inputs::report_script): Save mtime; style fix.
9233         (Incremental_inputs::finalize_inputs): Style fix.
9234         (Incremental_inputs::finalize): Style fix.
9235         (Incremental_inputs::create_input_section_data): Store inputs
9236         mtime.
9237         * incremental.h (Incremental_inputs::report_script): Add mtime
9238         argument.
9239         (Incremental_inputs::Input_info::Input_info): Intialize only one
9240         union member.
9241         (Incremental_inputs::Input_info::archive): Move to nameless
9242         union.
9243         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9244         (Incremental_inputs::Input_info::script): Move to nameless union.
9245         (Incremental_inputs::mtime): New field.
9246         * script.cc (read_input_script): Pass file mtime to
9247         Incremental_input.
9248         * script.h (Script_info::inputs): Style fix.
9249
9250 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9251
9252         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9253         instead of 32.
9254
9255 2009-06-24  Ian Lance Taylor  <iant@google.com>
9256
9257         PR 10156
9258         * layout.cc (Layout::choose_output_section): If we find an
9259         existing section, update the flags.
9260         (Layout::create_notes): New function, broken out of
9261         Layout::finalize.
9262         (Layout::finalize): Don't create note sections.
9263         (Layout::create_note): Don't crash if linker script discards
9264         section.
9265         (Layout::create_gold_note): Likewise.
9266         (Layout::create_build_id): Likewise.  Don't set
9267         after_input_sections on the section.
9268         (Layout::create_executable_stack_info): Remove target parameter.
9269         Change caller.
9270         * layout.h (class Layout): Declare create_notes.  Update
9271         declaration of create_executable_stack_info.
9272         * gold.cc (queue_middle_tasks): Call create_notes.
9273         * output.cc (Output_section::update_flags_for_input_section): Move
9274         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9275         invalid.
9276         * output.h (Output_data::mark_address_invalid): New function.
9277         (class Output_section): Only declare, not define,
9278         update_flags_for_input_section.  Remove set_flags.
9279
9280 2009-06-24  Ian Lance Taylor  <iant@google.com>
9281
9282         * script-sections.cc (Output_section_definition::
9283         set_section_addresses): Rename shadowing local load_address to
9284         laddr.
9285
9286 2009-06-24  Ian Lance Taylor  <iant@google.com>
9287
9288         PR 10244
9289         * reloc.cc (relocate_sections): Skip empty relocation sections.
9290
9291 2009-06-23  Ian Lance Taylor  <iant@google.com>
9292
9293         PR 10156
9294         * layout.cc (Layout::create_note): Use choose_output_section
9295         rather than make_output_section.
9296
9297 2009-06-23  Ian Lance Taylor  <iant@google.com>
9298
9299         PR 10237
9300         * options.cc (General_options::parse_V): Set printed_version_.
9301         (General_options::General_options): Initialize printed_version_.
9302         * options.h (class General_options): Add printed_version_ field.
9303         * gold.cc (queue_initial_tasks): If there are no input files,
9304         don't give a fatal error if we printed the version information.
9305         (queue_middle_tasks): If using -r with a shared object, give a
9306         fatal error rather than an ordinary error.
9307
9308 2009-06-23  Ian Lance Taylor  <iant@google.com>
9309
9310         PR 10219
9311         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9312         (Layout::make_output_section): Set have_stabstr_section_ if we see
9313         a .stab*str section.
9314         (Layout::finalize): Call link_stabs_sections.
9315         (Layout::link_stabs_sections): New file.
9316         * layout.h (class Layout): Add have_stabstr_section_ field.
9317         Declare link_stabs_sections.
9318
9319 2009-06-23  Doug Kwan  <dougkwan@google.com>
9320
9321         * Makefile.am (libgold_a_LIBADD): New.
9322         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9323         * Makefile.in: Regenerate.
9324         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9325         * configure: Regenerate.
9326         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9327         * fileread.cc: Include sys/state.h
9328         * gold.h: Declare memmem and strndup if found missing.
9329         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9330
9331 2009-06-23  Ian Lance Taylor  <iant@google.com>
9332
9333         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9334         * configure: Rebuild.
9335
9336 2009-06-23  Ian Lance Taylor  <iant@google.com>
9337
9338         PR 10147
9339         * object.cc (Object::section_contents): Don't try to get a view if
9340         the section has length zero.
9341         (Object::handle_gnu_warning_section): If the section is empty, use
9342         the name of the section as the warning.
9343
9344 2009-06-23  Ian Lance Taylor  <iant@google.com>
9345
9346         PR 10133
9347         * stringpool.h (class Stringpool_template): Add optimize_ field.
9348         (Stringpool_template::set_optimize): New function.
9349         * stringpool.cc (Stringpool_template::Stringpool_template):
9350         Initialize optimize_ field.
9351         (Stringpool_template::set_string_offsets): Test local optimize
9352         fild rather than parameter.
9353         * layout.cc (Layout::Layout): Call set_optimize on the section
9354         name stringpool.
9355
9356 2009-06-22  Ian Lance Taylor  <iant@google.com>
9357
9358         PR 10030
9359         * yyscript.y: Parse TARGET.
9360         * script.cc (script_set_target): New function.
9361         * script-c.h (script_set_target): Declare.
9362         * options.cc (General_options::string_to_object_format): Rename
9363         from string_to_object_format in anonymous namespace.  Change
9364         callers.
9365         * options.h (class General_options): Declare
9366         string_to_object_format.
9367
9368 2009-06-22  Ian Lance Taylor  <iant@google.com>
9369
9370         * script-sections.cc (Script_sections::create_segments): Don't put
9371         program headers in a PT_LOAD segment if -n or -N.
9372
9373 2009-06-22  Ian Lance Taylor  <iant@google.com>
9374
9375         PR 10141
9376         * options.h (class General_options): Add -z lazy and -z now.  Sort
9377         -z options into alphabetical order.
9378         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9379
9380 2009-06-21  Ian Lance Taylor  <iant@google.com>
9381
9382         * layout.cc (Layout::make_output_section): Call
9383         Target::new_output_section.
9384         (Layout::attach_allocated_section_to_segment): Put large section
9385         sections in a separate load segment with the large segment flag
9386         set.
9387         (Layout::segment_precedes): Sort large data segments after other
9388         load segments.
9389         (align_file_offset): New static function.
9390         (Layout::set_segment_offsets): Use align_file_offset.
9391         * output.h (class Output_section): Add is_small_section_ and
9392         is_large_section_ fields.
9393         (Output_section::is_small_section): New function.
9394         (Output_section::set_is_small_section):  New function.
9395         (Output_section::is_large_section): New function.
9396         (Output_section::set_is_large_section): New function.
9397         (Output_section::is_large_data_section): New function.
9398         (class Output_segment): Add is_large_data_segment_ field.
9399         (Output_segment::is_large_data_segment): New function.
9400         (Output_segment::set_is_large_data_segment): New function.
9401         * output.cc (Output_section::Output_section): Initialize new
9402         fields.
9403         (Output_segment::Output_segment): Likewise.
9404         (Output_segment::add_output_section): Add assertion that large
9405         data sections always go in large data segments.  Force small data
9406         sections to the end of the list of data sections.  Force small BSS
9407         sections to the start of the list of BSS sections.  For large BSS
9408         sections to the end of the list of BSS sections.
9409         * symtab.h (class Symbol): Declare is_common_shndx.
9410         (Symbol::is_defined): Check Symbol::is_common_shndx.
9411         (Symbol::is_common): Likewise.
9412         (class Symbol_table): Define enum Commons_section_type.  Update
9413         declarations.  Add small_commons_ and large_commons_ fields.
9414         * symtab.cc (Symbol::is_common_shndx): New function.
9415         (Symbol_table::Symbol_table): Initialize new fields.
9416         (Symbol_table::add_from_object): Put small and large common
9417         symbols in the right list.
9418         (Symbol_table::sized_finalized_symbol): Check
9419         Symbol::is_common_shndx.
9420         (Symbol_table::sized_write_globals): Likewise.
9421         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9422         common symbol lists.  Don't call do_allocate_commons_list if the
9423         list is empty.
9424         (Symbol_table::do_allocate_commons_list): Remove is_tls
9425         parameter.  Add comons_section_type parameter.  Change all
9426         callers.  Handle small and large common symbols.
9427         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9428         Symbol::is_common_shndx.
9429         * resolve.cc (symbol_to_bits): Likewise.
9430         * target.h (Target::small_common_shndx): New function.
9431         (Target::small_common_section_flags): New function.
9432         (Target::large_common_shndx): New function.
9433         (Target::large_common_section_flags): New function.
9434         (Target::new_output_section): New function.
9435         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9436         small_common_section_flags, and large_common_section_flags
9437         fields.
9438         (Target::do_new_output_section): New virtual function.
9439         * arm.cc (Target_arm::arm_info): Initialize new fields.
9440         * i386.cc (Target_i386::i386_info): Likewise.
9441         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9442         Likewise.
9443         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9444         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9445         (Target_x86_64::do_new_output_section): New function.
9446         * configure.ac: Define conditional MCMODEL_MEDIUM.
9447         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9448         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9449         (large_LDFLAGS): Define.
9450         * testsuite/large.c: New file.
9451         * testsuite/testfile.cc (Target_test::test_target_info):
9452         Initialize new fields.
9453         * configure, testsuite/Makefile.in: Rebuild.
9454
9455 2009-06-05  Doug Kwan  <dougkwan@google.com>
9456
9457         * Makefile.am (CCFILES): Add target.cc.
9458         * Makefile.in: Regenerate.
9459         * i386.cc (class Target_i386): Define new virtual method to
9460         override do_is_local_label_name in parent.
9461         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9462         local symbols if --discard-locals or -X is given.
9463         * options.h (class General_options): Declare new options
9464         '--discard-locals' and '-X' for discarding locals.
9465         * target.h (class Target): Define new methods is_local_label_name.
9466         Declare new virtual method do_is_local_label_name.
9467         * target.cc: New file.
9468         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9469         (check_SCRIPTS): Add discard_locals_test.sh.
9470         (check_DATA): Add discard_local_tests.syms.
9471         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9472         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9473         * testsuite/Makefile.in: Regenerate.
9474         * testsuite/discard_locals_test.c: New file.
9475         * testsuite/discard_locals_test.sh: Same.
9476
9477 2009-06-05  Doug Kwan  <dougkwan@google.com>
9478
9479         * object.cc (Sized_relobj::Sized_relobj): Initialize
9480         discarded_eh_frame_shndx_ to -1U.
9481         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9482         section.
9483         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9484         a discarded .eh_frame section.
9485         (Sized_relobj::do_finalize_local_symbols): Ditto.
9486         * object.h (class Sized_relobj): Declare new member
9487         discarded_eh_frame_shndx_.
9488         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9489         (local_labels_test.o, local_labels_test): New rules.
9490         * testsuite/Makefile.in: Regenerate.
9491
9492 2009-06-04  Doug Kwan  <dougkwan@google.com>
9493
9494         * layout.cc (Layout::section_name_mapping): Add mapping for
9495         special ARM sections.
9496
9497 2009-06-03  Doug Kwan  <dougkwan@google.com>
9498
9499         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9500         (utils::has_overflow): Same.
9501
9502 2009-06-03  Ian Lance Taylor  <iant@google.com>
9503
9504         * layout.cc (Layout::section_name_mapping): New array, replacing
9505         Layout::linkonce_mapping.
9506         (Layout::section_name_mapping_count): New variable, replacing
9507         Layout::linkonce_mapping_count.
9508         (Layout::linkonce_output_name): Remove.
9509         (Layout::output_section_name): Rewrite.
9510         * layout.h (class Layout): Rename Linkonce_mapping to
9511         Section_name_mapping, linkonce_mapping to section_name_mapping,
9512         linkonce_mapping_count to section_name_mapping_count.  Don't
9513         declare linkonce_output_name.
9514
9515 2009-06-03  Doug Kwan  <dougkwan@google.com>
9516
9517         * gold/arm.cc (namespace utils): New.
9518         (Target_arm::reloc_is_non_pic): Define new method.
9519         (class Arm_relocate_functions): New.
9520         (Target_arm::Relocate::relocate): Handle relocation types used by
9521         Android.
9522
9523 2009-06-03  Ian Lance Taylor  <iant@google.com>
9524
9525         * arm.cc (Target_arm::scan::global): Use || instead of |.
9526
9527 2009-06-02  Doug Kwan  <dougkwan@google.com>
9528
9529         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9530         issued_non_pic_error_.
9531         (class Target_arm::Scan): Declare new method check_non_pic.
9532         Define new method symbol_needs_plt_entry.
9533         Declare new data member issued_non_pic_error_.
9534         (class Target_arm::Relocate): Declare new method
9535         should_apply_static_reloc.
9536         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9537         (Target_arm::Scan::check_non_pic): Define new method.
9538         (Target_arm::Scan::local): Handle a small subset of reloc types used
9539         by Android.
9540         (Target_arm::Scan::local): Same.
9541         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9542
9543 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9544
9545         * incremental.cc (Incremental_inputs::report_command_line): Filter
9546         out --incremental-* options.
9547
9548 2009-05-29  Doug Kwan  <dougkwan@google.com>
9549
9550         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9551         template class.
9552         (class Target_arm): Update comment.
9553         (Target_arm::Target_arm): Initialize new data members GOT_,
9554         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9555         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9556         and Target_arm::rel_dyn_section.
9557         Declare new_enum Target_arm::Got_type.
9558         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9559         and DYNBSS_.
9560         Update commments for member do_dynsym_value.
9561         (Target_arm::got_size, Target_arm::plt_section,
9562         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9563         new methods inside class defintion.
9564         (Target_arm::got_section): Define new method.
9565         (Target_arm::rel_dyn_section): Same.
9566         (Output_data_plt_arm): New template class.
9567         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9568         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9569         (Output_data_plt_arm::add_entry): Same.
9570         (Output_data_plt_arm::first_plt_entry): Define new
9571         static data member for PLT instruction template.
9572         (Output_data_plt_arm::plt_entry): Same.
9573         (Output_data_plt_arm::do_write): Define new method.
9574         (Target_arm::make_plt_entry): Same.
9575         (Target_arm::do_finalize_sections): Same.
9576         (Target_arm::do_dynsym_value): Same.
9577
9578 2009-05-28  Doug Kwan  <dougkwan@google.com>
9579
9580         * Makefile.am (TARGETSOURCES): Add arm.cc.
9581         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9582         * Makefile.in: Regenerate.
9583         * arm.cc: New file.
9584         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9585
9586 2009-05-26  Doug Kwan  <dougkwan@google.com>
9587
9588         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9589         (General_options::check_excluded_libs): Strip off directories in
9590         archive name before matching like GNU ld does.
9591         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9592         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9593         (exclude_libs_test_LDFLAGS): Add linker option
9594         -Wl,--exclude-libs,libexclude_libs_test_3
9595         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9596         an explicit archive without using -l.
9597         (alt/libexclude_libs_test_3.a): New make rule.
9598         * testsuite/Makefile.in: Regenerate.
9599         * testsuite/exclude_libs_test.c : Declare lib3_default().
9600         (main): Call it.
9601         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9602         * exclude_libs_test_3.c: New file.
9603
9604 2009-05-26  Nick Clifton  <nickc@redhat.com>
9605
9606         * po/id.po: New Indonesian translation.
9607         * po/gold.pot: Updated template file.
9608
9609 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9610
9611         * testsuite/Makefile.am: Add -ffunction-sections to compile
9612         gc_comdat_test files.  Add -Wl,--gc-sections to build
9613         gc_comdat_test.
9614         * testsuite/Makefile.in: Regenerate.
9615         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9616
9617 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9618
9619         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9620         kept comdat section was garbage collected.
9621         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9622         * testsuite/Makefile.in: Regenerate.
9623         * testsuite/gc_comdat_test.sh: New file.
9624         * testsuite/gc_comdat_test_1.cc: New file.
9625         * testsuite/gc_comdat_test_2.cc: New file.
9626
9627 2009-05-19  Doug Kwan  <dougkwan@google.com>
9628
9629         * archive.cc (Archive::Archive): Move constructor from archive.h
9630         to here.  Initialize no_export_.
9631         (Archive::get_elf_object_for_member): Set no_export flag of object.
9632         * archive.h (Archive::Archive): Move constructor body to
9633         archive.cc.
9634         (Archive::no_export): New method.
9635         (Archive::no_export_): New field.
9636         * object.h (Object::Object): Initialize no_export_ to false.
9637         (Object::no_export, Object::set_no_export): New methods.
9638         (Object::no_export_): New field.
9639         * options.cc (General_options::parse_exclude_libs): New method.
9640         (General_options::check_excluded_libs) Same.
9641         * options.h (exclude_libs): New option.
9642         (General_options::check_excluded_libs): New method declaration.
9643         (General_options::excluded_libs_): New field.
9644         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9645         default or protected visibility if an object has no-export flag set.
9646         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9647         (check_SCRIPTS): Add exclude_libs_test.sh.
9648         (check_DATA): Add exclude_libs_test.syms.
9649         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9650         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9651         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9652         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9653         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9654         libexclude_libs_test_2.a): New rules.
9655         * testsuite/Makefile.in: Regenerate.
9656         * testsuite/exclude_libs_test.c: New file.
9657         * testsuite/exclude_libs_test.sh: Ditto.
9658         * testsuite/exclude_libs_test_1.c: Ditto.
9659         * testsuite/exclude_libs_test_2.c: Ditto.
9660
9661 2009-05-15  Ian Lance Taylor  <iant@google.com>
9662
9663         * configure.ac: Check for declarations for cases where libiberty.h
9664         checks HAVE_DECL_xxx.
9665         * configure, config.in: Rebuild.
9666
9667 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9668
9669         * gold.h (Incremental_argument_list): Remove (invalid) forward
9670         declaration.
9671         * incremental.cc (Incremental_inputs::report_achive): New method.
9672         (Incremental_inputs::report_object): New method.
9673         (Incremental_inputs::report_script): New method.
9674         (Incremental_inputs::finalize_inputs): New method.
9675         (Incremental_inputs::finalize): Call finalize_inputs().
9676         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9677         Create inputs entries.
9678         * incremental.h (Incremental_input_type): New enum.
9679         (Incremental_inputs::Incremental_input): Initialize new fields.
9680         (Incremental_inputs::report_inputs): New method.
9681         (Incremental_inputs::report_achive): New method.
9682         (Incremental_inputs::report_object): New method.
9683         (Incremental_inputs::report_script): New method.
9684         (Incremental_inputs::finalize_inputs): New method.
9685         (Incremental_inputs::Input_info): New struct.
9686         (Incremental_inputs::Input_info_map): New typedef.
9687         (Incremental_inputs::lock_): New field.
9688         (Incremental_inputs::Inputs_): New field.
9689         (Incremental_inputs::Inputs_map): New field.
9690         * main.cc (main): Call Incremental_input::report_inputs.
9691         * options.h (Input_argument_list): Typedef moved from
9692         Input_arguments.
9693         (Input_file_group::Files): Remove, use ::Input_argument_list.
9694         (Input_file_group::Input_argument_list): Remove, use
9695         ::Input_argument_list.
9696         * plugin.cc (Plugin_manager::add_input_file): Add error in
9697         incremental build.
9698         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9699         functions.
9700         * script.cc (read_input_script): Call
9701         Incremental_input::report_script.
9702         * script.h (Script_info): New class.
9703
9704 2009-04-27  Ian Lance Taylor  <iant@google.com>
9705
9706         * x86_64.cc (do_adjust_output_section): Set entsize to
9707         plt_entry_size.
9708
9709 2009-04-23  Elliott Hughes  <enh@google.com>
9710
9711         * output.cc (Output_file::close): After short writes, continue
9712         writing from the correct offset in the buffer being written.
9713
9714 2009-04-23  Chris Demetriou  <cgd@google.com>
9715
9716         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9717         * configure: Regenerate.
9718         * config.in: Regenerate.
9719         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9720         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9721
9722 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9723
9724         * incremental.cc (Incremental_inputs_header_data): Renamed from
9725         Incremental_input_header_data.
9726         (Incremental_inputs_header_data::data_size): New field.
9727         (Incremental_inputs_header_data::put_input_file_count): Renamed
9728         from input_file_count.
9729         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9730         from command_line_offset.
9731         (Incremental_inputs_header_data::put_reserved): Renamed from
9732         put_reserved.
9733         (Incremental_inputs_entry_data): Renamed from
9734         Incremental_input_entry_data.
9735         (Incremental_inputs_entry_data::data_size): New field.
9736         (Incremental_inputs::report_command_line): New method.
9737         (Incremental_inputs::finalize): New method.
9738         (Incremental_inputs::create_incremental_inputs_data): New method.
9739         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9740         * incremental.h: New file.
9741         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9742        (Layout::finalize): Create incremental inputs section in
9743         incremental builds.
9744        (Layout::create_incremental_info_sections): New method.
9745         * layout.h (Layout::incremental_inputs): New method.
9746        (Layout::create_incremental_info_sections): New method.
9747        (Layout::incremental_inputs_): New field.
9748         * main.cc (main): Notify Incremental_input of the command line.
9749
9750 2009-04-01  Ian Lance Taylor  <iant@google.com>
9751             Mikolaj Zalewski  <mikolajz@google.com>
9752
9753         * gold.h (reserve_unordered_map): Define, three versions, one for
9754         each version of Unordered_map.
9755         * layout.cc (Layout::Layout): Remove options parameter.  Add
9756         number_of_input_files parameter.  Don't initialize options_.
9757         Initialize number_of_input_files_ and resized_signatures_.  Move
9758         sections_are_attached_.
9759         (Layout::layout_group): Reserve space for group_signatures_.
9760         (Layout::find_or_add_kept_section): Change name parameter to be a
9761         reference.  Resize signatures_ map when it gets large enough.
9762         (Layout::layout_eh_frame): Use parameters->options() instead of
9763         this->options_.
9764         (Layout::make_output_section): Likewise.
9765         (Layout::attach_allocated_section_to_segment): Likewise.
9766         (Layout::finalize, Layout::create_executable_stack): Likewise.
9767         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9768         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9769         * layout.h (class Layout): Update declarations.  Remove options_
9770         field.  Add number_of_input_files_ and resized_signatures_
9771         fields.  Move sections_are_attached_ field.
9772         * main.cc (main): Pass number of input files to Layout
9773         constructor.  Don't pass options.
9774
9775 2009-03-30  Ian Lance Taylor  <iant@google.com>
9776
9777         * ffsll.c (ffsll): Correct implementation.
9778
9779 2009-03-27  Ian Lance Taylor  <iant@google.com>
9780
9781         * ffsll.c: New file.
9782         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9783         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9784         * ftruncate.c (ftruncate): Declare before definition.
9785         * mremap.c (mremap): Likewise.
9786         * pread.c (pread): Likewise.
9787         * configure, Makefile.in, config.in: Rebuild.
9788
9789         * mremap.c: New file.
9790         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9791         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9792         (mremap): Declare if HAVE_MREMAP is not defined.
9793         * configure, Makefile.in, config.in: Rebuild.
9794
9795 2009-03-27  Cary Coutant  <ccoutant@google.com>
9796
9797         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9798         position independent.
9799         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9800         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9801
9802 2009-03-24  Cary Coutant  <ccoutant@google.com>
9803
9804         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9805         an executable.
9806         (needs_dynamic_reloc): Likewise.
9807
9808 2009-03-24  Ian Lance Taylor  <iant@google.com>
9809
9810         * yyscript.y (file_cmd): Recognize EXTERN.
9811         (extern_name_list, extern_name_list_body): New nonterminals.
9812         * script.cc (script_add_extern): Define.
9813         * script-c.h (script_add_extern): Declare.
9814
9815 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9816
9817         * object.cc (is_elf_object): Define.
9818         * object.h (is_elf_object): Declare.
9819         * archive.cc (Archive::get_elf_object_for_member): Call
9820         is_elf_object.
9821         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9822
9823 2009-03-24  Elliott Hughes  <enh@google.com>
9824
9825         * output.cc (Output_file::map_anonymous): Define.
9826         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9827         try an anonymous one.  Report the size if the mmap fails.
9828         * output.h (class Output_file): Declare map_anonymous.
9829
9830 2009-03-24  Ian Lance Taylor  <iant@google.com>
9831
9832         * target-select.cc (instantiate_target): Don't acquire the lock if
9833         the instantiated_target_ field has already been set.
9834
9835 2009-03-23  Ian Lance Taylor  <iant@google.com>
9836
9837         * gold-threads.h (class Initialize_lock): Define.
9838         * gold-threads.cc (class Initialize_lock_once): Define.
9839         (initialize_lock_control): New static variable.
9840         (initialize_lock_pointer): New static variable.
9841         (initialize_lock_once): New static function.
9842         (Initialize_lock::Initialize_lock): Define.
9843         (Initialize_lock::initialize): Define.
9844         * target-select.h: Include "gold-threads.h".
9845         (class Target_selector): Add lock_ and initialize_lock_ fields.
9846         Don't define instantiate_target, just declare it.
9847         * target-select.cc (Target_selector::Target_selector): Initialize
9848         new fields.
9849         (Target_selector::instantiate_target): Define.
9850         * descriptors.h: Include "gold-threads.h".
9851         (class Descriptors): Add initialize_lock_ field.
9852         * descriptors.cc (Descriptors::Descriptors): Initialize new
9853         field.
9854         (Descriptors::open): Use initialize_lock_ field
9855         * errors.h (class Errors): Add initialize_lock_ field.
9856         * errors.cc (Errors::Errors): Initialize new field.
9857         (Errors::initialize_lock): Use initialize_lock_ field.
9858         * powerpc.cc (class Target_selector_powerpc): Remove
9859         instantiated_target_ field.  In do_recognize call
9860         instantiate_target rather than do_instantiate_target.  In
9861         do_instantiate_target just allocate a new target.
9862         * sparc.cc (class Target_selector_sparc): Likewise.
9863
9864         * freebsd.h: New file.
9865         * i386.cc: Include "freebsd.h".
9866         (Target_i386): Derive from Target_freebsd rather than
9867         Sized_target.
9868         (Target_selector_i386): Derive from Target_selector_freebsd rather
9869         than Target_selector.
9870         * x86_64.cc: Include "freebsd.h".
9871         (Target_x86_64): Derive from Target_freebsd rather than
9872         Sized_target.
9873         (Target_selector_x86_64): Derive from Target_selector_freebsd
9874         rather than Target_selector.
9875         * target.h (class Target): Add adjust_elf_header and
9876         do_adjust_elf_header.
9877         * output.cc (Output_file_header:: do_sized_write): Call target
9878         adjust_elf_header routine.
9879         * configure.tgt: Set targ_osabi.
9880         * configure.ac: Define GOLD_DEFAULT_OSABI.
9881         * parameters.cc (Parameters::default_target): Pass
9882         GOLD_DEFAULT_OSABI to select_target.
9883         * target-select.h (class Target_selector): Make instantiate_target
9884         protected rather than private.
9885         * Makefile.am (HFILES): Add freebsd.h.
9886         * configure, Makefile.in, config.in: Rebuild.
9887
9888         * merge.cc (do_add_input_section): Correct pend value.  Change
9889         message about last entry not being null terminated from error to
9890         warning.
9891
9892 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9893
9894         * incremental.cc: New file.
9895         * Makefile.am (CCFILES): Add incremental.cc.
9896         * Makefile.in: Rebuild.
9897
9898 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9899
9900         * layout.cc (Layout::output_section_name): Preserve names
9901         of '.note.' sections.
9902
9903 2009-03-19  Ian Lance Taylor  <iant@google.com>
9904
9905         * descriptors.cc (Descriptors::open): Check that the options are
9906         valid before using them.
9907
9908 2009-03-18  Ian Lance Taylor  <iant@google.com>
9909
9910         * script-sections.h: Include <list>.
9911         (class Script_sections): Change Sections_elements from std::vector
9912         to std::list.  Typedef public Elements_iterator.  Add
9913         orphan_section_placement_, data_segment_align_start_, and
9914         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9915         field.
9916         * script-sections.cc (class Orphan_section_placement): New class.
9917         (class Sections_element): Add virtual functions is_relro and
9918         orphan_section_init.  Remove virtual function place_orphan_here.
9919         (class Output_section_definition): Add is_relro and
9920         orphan_section_init.  Remove place_orphan_here.
9921         (class Orphan_output_section): Likewise.
9922         (Script_sections::Script_sections): Update for field changes.
9923         (Script_sections::data_segment_align): Set saw_data_segment_align_
9924         and data_segment_align_start_, not data_segment_align_index.
9925         (Script_sections::data_segment_relro_end): Check
9926         saw_data_segment_align_.  Use data_segment_align_start_ rather
9927         than data_segment_align_index_.
9928         (Script_sections::place_orphan): Rewrite to use
9929         Orphan_section_placement.
9930
9931 2009-03-17  Ian Lance Taylor  <iant@google.com>
9932
9933         * archive.cc (Archive::add_symbols): Check for a version attached
9934         to the symbol name in the archive map.
9935         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9936         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9937         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9938         (ver_test_11.a): New target.
9939         * testsuite/Makefile.in: Rebuild.
9940
9941         * configure.ac: Check for chsize and posix_fallocate.  Replace
9942         ftruncate.
9943         * ftruncate.c: New file, from gnulib.
9944         * output.cc (posix_fallocate): Define dummy version if not
9945         HAVE_POSIX_FALLOCATE.
9946         (Output_file::map): Call posix_fallocate rather than lseek and
9947         write.
9948         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9949         * configure, Makefile.in, config.in: Rebuild.
9950
9951 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9952
9953         * layout.h (Layout::create_note): Add section_name parameter.
9954         * layout.cc (Layout::create_note): Likewise.
9955         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9956
9957 2009-03-17  Ian Lance Taylor  <iant@google.com>
9958
9959         * descriptors.cc: Include "options.h".
9960         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9961         (Descriptors::open): Always use O_CLOEXEC when opening a new
9962         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9963         then set FD_CLOEXEC.
9964
9965         * sparc.cc (class Target_sparc): Add has_got_section.
9966         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9967         make sure we have a GOT section.
9968
9969         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9970         (Target_sparc::Scan::local): Likewise.
9971         (Target_sparc::Scan::global): Likewise.
9972         (Target_sparc::Relocate::relocate): Likewise.
9973         (Target_sparc::Relocate::relocate_tls): Likewise.
9974
9975         * symtab.cc (Symbol_table::define_default_version): New function,
9976         broken out of add_from_object.
9977         (Symbol_table::add_from_object): Call define_default_version.
9978         (Symbol_table::define_special_symbol): Add resolve_oldsym
9979         parameter.  Change all callers.  If the version for a symbol comes
9980         from a version script, resolve it with the symbol with the same
9981         name with no version.  Also add the symbol without a version if
9982         appropriate.
9983         (do_define_in_output_data): If resolving with oldsym, don't delete
9984         sym.
9985         (do_define_in_output_segment): Likewise.
9986         (do_define_as_constant): Likewise.
9987         * symtab.h (class Symbol_table): Update declarations.
9988
9989 2009-03-13  Ian Lance Taylor  <iant@google.com>
9990
9991         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9992         (Read_symbols::requeue): New function.
9993         (Read_symbols::do_read_symbols): If make_elf_object fails because
9994         the target type is not configured, and the file was searched for,
9995         issue a warning and retry with the next directory.
9996         (Add_symbols::run): If the file has an incompatible format, and
9997         it was searched for, requeue the Read_symbols task.  On error,
9998         release the object.
9999         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10000         dirindex parameter to constructor.  Change all callers.  Declare
10001         incompatible_warning and requeue.
10002         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10003         input_argument_ and input_group_ fields.  Add them to
10004         constructor.  Change all callers.
10005         (class Read_script): Add dirindex_ field.  Add it to constructor.
10006         Change all callers.
10007         * archive.cc (Archive::setup): Remove input_objects parameter.
10008         Change all callers.
10009         (Archive::get_file_and_offset): Likewise.
10010         (Archive::read_all_symbols): Likewise.
10011         (Archive::read_symbols): Likewise.
10012         (Archive::get_elf_object_for_member): Remove input_objects
10013         parameter.  Add punconfigured parameter.  Change all callers.
10014         (Archive::add_symbols): Change return type to bool.  Check return
10015         value of include_member.
10016         (Archive::include_all_members): Likewise.
10017         (Archive::include_member): Change return type to bool.  Return
10018         false if first included object has incompatible target.  Set
10019         included_member_ field.
10020         (Add_archive_symbols::run): If add_symbols returns false, requeue
10021         Read_symbols task.
10022         * archive.h (class Archive): Add included_member_ field.
10023         Initialize it in constructor.  Add input_file and searched_for
10024         methods.  Update declarations.
10025         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10026         input_argument_ fields.  Add them to constructor.  Change all
10027         callers.
10028         * script.cc: Include "target-select.h".
10029         (class Parser_closure): Add skip_on_incompatible_target_ and
10030         found_incompatible_target_ fields.  Add
10031         skip_on_incompatible_target parameter to constructor.  Change all
10032         callers.  Add methods skip_on_incompatible_target,
10033         clear_skip_on_incompatible_target, found_incompatible_target, and
10034         set_found_incompatible_target.
10035         (read_input_script): Add dirindex parameter.  Change all callers.
10036         If parser finds an incompatible target, requeue Read_symbols
10037         task.
10038         (script_set_symbol): Clear skip_on_incompatible_target in
10039         closure.
10040         (script_add_assertion, script_parse_option): Likewise.
10041         (script_start_sections, script_add_phdr): Likewise.
10042         (script_check_output_format): New function.
10043         * script.h (read_input_script): Update declaration.
10044         * script-c.h (script_check_output_format): Declare.
10045         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10046         (ignore_cmd): Remove OUTPUT_FORMAT.
10047         * fileread.cc (Input_file::Input_file): Add explicit this.
10048         (Input_file::will_search_for): New function.
10049         (Input_file::open): Add pindex parameter.  Change all callers.
10050         * fileread.h (class Input_file): Add input_file_argument method.
10051         Declare will_search_for.  Update declarations.
10052         * object.cc (make_elf_object): Add punconfigured parameter.
10053         Change all callers.
10054         * object.h (class Object): Make input_file public.  Add
10055         searched_for method.
10056         (make_elf_object): Update declaration.
10057         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10058         restart search.
10059         * dirsearch.h (class Dirsearch): Update declaration.
10060         * options.h (class General_options): Add --warn-search-mismatch.
10061         * parameters.cc (Parameters::is_compatible_target): New function.
10062         * parameters.h (class Parameters): Declare is_compatible_target.
10063         * workqueue.cc (Workqueue::add_blocker): New function.
10064         * workqueue.h (class Workqueue): Declare add_blocker.
10065
10066         * fileread.cc (Input_file::open): Remove options parameter.
10067         Change all callers.
10068         (Input_file::open_binary): Likewise.
10069         * script.cc (read_input_script): Likewise.
10070         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10071         options parameter from constructor.  Change all callers.
10072         (class Read_script): Likewise.
10073         * fileread.h (class Input_file): Update declarations.
10074         * script.h (read_input_script): Update declaration.
10075
10076 2009-03-10  Nick Clifton  <nickc@redhat.com>
10077
10078         * po/es.po: New Spanish translation.
10079
10080 2009-03-06  Cary Coutant  <ccoutant@google.com>
10081
10082         * options.cc (parse_short_option): Keep dash_z from registering itself.
10083
10084 2009-03-03  Ian Lance Taylor  <iant@google.com>
10085
10086         PR 9918
10087         * target-reloc.h (relocate_section): Pass output_section to
10088         relocate.
10089         * i386.cc (Target_i386::should_apply_static_reloc): Add
10090         output_section parameter.  Change all callers.
10091         (Target_i386::Relocate::relocate): Add output_section parameter.
10092         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10093         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10094         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10095         * testsuite/two_file_shared.sh: New script.
10096         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10097         (check_DATA): Add two_file_shared.dbg.
10098         (two_file_shared.dbg): New target.
10099         * testsuite/Makefile.in: Rebuild.
10100
10101 2009-03-01  Ian Lance Taylor  <iant@google.com>
10102
10103         * configure.ac: Check for byteswap.h.
10104         * configure: Rebuild.
10105         * config.in: Rebuild.
10106
10107 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10108
10109         * layout.cc (Layout::find_or_add_kept_section): New function.
10110         (Layout::add_comdat): Removed.
10111         * layout.h (struct Kept_section): Move out of class Layout.
10112         Remove trailing underscores from field names.  Add group_sections
10113         field.  Rename group_ field to is_group.  Change all uses.
10114         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10115         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10116         comdat_groups_ field.
10117         (Sized_relobj::include_section_group): Use
10118         find_or_add_kept_section and Kept_section::group_sections.
10119         (Sized_relobj::include_linkonce_section): Likewise.
10120         * object.cc (class Sized_relobj): Don't define Comdat_group or
10121         Comdat_group_table.  Remove find_comdat_group and
10122         add_comdat_group.  Remove comdat_groups_ field.
10123         * plugin.cc (include_comdat_group): Use
10124         Layout::find_or_add_kept_section.
10125
10126 2009-02-28  Ian Lance Taylor  <iant@google.com>
10127
10128         * README: --gc-sections and map files are now supported.  Document
10129         some build requirements.
10130
10131         PR 6992
10132         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10133         relocatable link set the value of the section symbol to zero.
10134         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10135         relocatable link don't include the section address in the local
10136         symbol value.
10137
10138 2009-02-27  Ian Lance Taylor  <iant@google.com>
10139
10140         PR 6811
10141         * options.h (class Search_directory): Add is_system_directory.
10142         (class General_options): Declare is_in_system_directory.
10143         * options.cc (get_relative_sysroot): Make static.
10144         (get_default_sysroot): Make static.
10145         (General_optoins::is_in_system_directory): New function.
10146         * fileread.cc (Input_file::is_in_system_directory): New function.
10147         * fileread.h (class Input_file): Declare is_in_system_directory.
10148         * object.h (class Object): Add is_in_system_directory.
10149         (class Input_objects): Remove system_library_directory_ field.
10150         * object.cc (Input_objects::add_object): Don't set
10151         system_library_directory_.
10152         (input_objects::found_in_system_library_directory): Remove.
10153         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10154         parameter.  Change all callers.
10155         (Symbol_table::sized_write_globals): Likewise.
10156         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10157         Call Object::is_in_system_directory.
10158         * symtab.h (class Symbol_table): Update declarations.
10159
10160         PR 5990
10161         * descriptors.h (Open_descriptor): Add is_on_stack field.
10162         * descriptors.cc (Descriptors::open): If the descriptor is on the
10163         top of the stack, remove it.  Initialize is_on_stack field.
10164         (Descriptors::release): Only add pod to stack if it is not on the
10165         stack already.
10166         (Descriptors::close_some_descriptor): Clear stack_next and
10167         is_on_stack fields.
10168
10169         PR 7091
10170         * output.cc (Output_section::find_starting_output_address): Rename
10171         from starting_output_address; add PADDR parameter; change return
10172         type.
10173         * output.h (class Output_section): Declare
10174         find_starting_output_address instead of starting_output_address.
10175         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10176         section symbol for which we can't find a merge section.
10177
10178         PR 9836
10179         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10180         hidden or internal, force the symbol to be local.
10181         * resolve.cc (Symbol::override_visibility): Define.
10182         (Symbol::override_base): Use override_visibility.
10183         (Symbol_table::resolve): Likewise.
10184         (Symbol::override_base_with_special): Likewise.
10185         (Symbol_table::override_with_special): If the visibility is hidden
10186         or internal, force the symbol to be local.
10187         * symtab.h (class Symbol): Add set_visibility and
10188         override_visibility.
10189         * testsuite/ver_test_1.sh: New file.
10190         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10191         (check_DATA): Add ver_test_1.syms.
10192         (ver_test_1.syms): New target.
10193         * testsuite/Makefile.in: Rebuild.
10194
10195 2009-02-25  Cary Coutant  <ccoutant@google.com>
10196
10197         * layout.cc (Layout::choose_output_section): Don't rename sections
10198         when using a linker script that has a SECTIONS clause.
10199         * Makefile.in: Regenerate.
10200
10201         * testsuite/Makefile.am (script_test_5.sh): New test case.
10202         * testsuite/Makefile.in: Regenerate.
10203         * testsuite/script_test_5.cc: New file.
10204         * testsuite/script_test_5.sh: New file.
10205         * testsuite/script_test_5.t: New file.
10206
10207 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10208
10209         * archive.cc (Archive::include_member): Update calls to add_symbols.
10210         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10211         the Layout argument.
10212         * dynobj.h (do_add_symbols): Add the Layout argument.
10213         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10214         Layout argument.
10215         * object.h (Object::add_symbols): Add the Layout argument.
10216         (Object::do_add_symbols): Add the Layout argument.
10217         (Sized_relobj::do_add_symbols): Add the Layout argument.
10218         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10219         Unify the two versions.
10220         (Add_plugin_symbols): Remove.
10221         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10222         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10223         (Add_plugin_symbols): Remove.
10224         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10225         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10226         (Add_symbols::run): Make it work with Pulginobj.
10227
10228 2009-02-06  Ian Lance Taylor  <iant@google.com>
10229
10230         * object.cc (Sized_relobj::do_layout): Make info message start
10231         with lower case letter.
10232
10233 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10234
10235         * binary.cc: Fix file comment.
10236
10237         * options.h (enum Incremental_disposition): Define.
10238         (class General_options): Add new options: --incremental,
10239         --incremental_changed, --incremental_unchanged,
10240         --incremental_unknown.  Add incremental_disposition_ and
10241         implicit_incremental_ fields.
10242         (General_options::incremental_disposition): New function.
10243         (class Position_dependent_options): Add incremental_disposition
10244         option.
10245         (Position_dependent_options::copy_from_options): Set incremental
10246         dispositions.
10247         * options.cc (General_options::parse_incremental_changed): New
10248         function.
10249         (General_options::parse_incremental_unchanged): New function.
10250         (General_options::parse_incremental_unknown): New function.
10251         (General_options::General_options): Initialize new fields
10252         incremental_disposition_ and implicit_incremental_.
10253         (General_options::finalize): Check for uasge of --incremental-*
10254         without --incremental.
10255
10256 2009-02-06  Chris Demetriou  <cgd@google.com>
10257
10258         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10259         pointer and to report location as the file name associated with
10260         the symbol.
10261         (gold_undefined_symbol_at_location): New function to replace the
10262         old gold_undefined_symbol functionality.
10263         * target-reloc.h (relocate_section): Update to use
10264         gold_undefined_symbol_at_location.
10265         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10266         Call gold_undefined_symbol function rather than gold_error.
10267         * errors.h (Errors::undefined_symbol): Take location as a
10268         string, rather than calculating it from a relocation.
10269         * errors.cc (Errors::fatal): Print "fatal error:" before the
10270         formatted message.
10271         (Errors::error, Errors::error_at_location): Print "error: "
10272         before the formatted message.
10273         (Errors::undefined_symbol): Take location as a string, rather
10274         than calculating it from a relocation.
10275         (gold_undefined_symbol_at_location): New function akin to
10276         old gold_undefined_symbol, calculates location from relocation.
10277         (gold_undefined_symbol): Change to take only a Symbol pointer
10278         and to report location as the file name associated with the symbol.
10279         * testsuite/debug_msg.sh: Update for changed error messages.
10280         * testsuite/undef_symbol.sh: Likewise.
10281
10282 2009-02-04  Duncan Sands  <baldrick@free.fr>
10283
10284         PR 9812
10285         * reduced_debug_output.h
10286         (Output_reduced_debug_abbrev_section::failed): Use format for
10287         gold_warning.
10288         (Output_reduced_debug_info_section::faild): Likewise.
10289
10290 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10291
10292         * script.cc (Lazy_demangler): New class.
10293         (Version_script_info::get_symbol_version_helper): Demangle a
10294         symbol only once.
10295
10296 2009-01-29  Cary Coutant  <ccoutant@google.com>
10297
10298         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10299         to __tls_get_addr.
10300         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10301
10302 2009-01-28  Ian Lance Taylor  <iant@google.com>
10303
10304         * version.cc (version_string): Bump to 1.9.
10305
10306         * gold.h: Include <cstring> and <stdint.h>.
10307         * version.cc: Include <cstdio>.
10308         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10309         warning.
10310         * reduced_debug_output.cc (insert_into_vector): Rename from
10311         Insert_into_vector; change all callers.  Use Swap_unaligned to
10312         avoid aliasing issue; remove union since it is unnecessary.
10313
10314 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10315
10316         * Makefile.am (CCFILES): Add gc.cc.
10317         (HFILES): Add gc.h.
10318         * Makefile.in: Regenerate.
10319         * gold.cc (Gc_runner): New class.
10320         (queue_initial_tasks): Call garbage collection related tasks
10321         when corresponding options are invoked.
10322         (queue_middle_gc_tasks): New function.
10323         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10324         processed early before laying out sections during garbage collection.
10325         * gold.h (queue_middle_gc_tasks): New function.
10326         (is_prefix_of): Move from "layout.cc".
10327         * i386.cc (Target_i386::gc_process_relocs): New function.
10328         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10329         * main.cc (main): Create object of class "Garbage_collection".
10330         * object.cc (Relobj::copy_symbols_data): New function.
10331         (Relobj::is_section_name_included): New function.
10332         (Sized_relobj::do_layout): Allow this function to be called twice
10333         during garbage collection and defer layout of section during the
10334         first call.
10335         * object.h (Relobj::get_symbols_data): New function.
10336         (Relobj::is_section_name_included): New function.
10337         (Relobj::copy_symbols_data): New function.
10338         (Relobj::set_symbols_data): New function.
10339         (Relobj::get_relocs_data): New function.
10340         (Relobj::set_relocs_data): New function.
10341         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10342         (Relobj::gc_process_relocs): New function.
10343         (Relobj::do_gc_process_relocs): New pure virtual function.
10344         (Relobj::sd_): New data member.
10345         (Sized_relobj::is_output_section_offset_invalid): New function.
10346         (Sized_relobj::do_gc_process_relocs): New function.
10347         * options.h (General_options::gc_sections): Modify to not be a no-op.
10348         (General_options::print_gc_sections): New option.
10349         * plugin.cc (Plugin_finish::run): Remove function call to
10350         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10351         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10352         * reloc.cc (Read_relocs::run): Add task to process relocs and
10353         determine unreferenced sections when doing garbage collection.
10354         (Gc_process_relocs): New class.
10355         (Sized_relobj::do_gc_process_relocs): New function.
10356         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10357         sections that are garbage collected.
10358         * reloc.h (Gc_process_relocs): New class.
10359         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10360         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10361         symbols whose corresponding sections are garbage collected.
10362         (Symbol_table::Symbol_table): Add new parameter for the garbage
10363         collection object.
10364         (Symbol_table::gc_mark_undef_symbols): New function.
10365         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10366         (Symbol_table::gc_mark_dyn_syms): New function.
10367         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10368         as garbage.
10369         (Symbol_table::add_from_object): Likewise.
10370         (Symbol_table::add_from_relobj): When building shared objects, do not
10371         treat externally visible symbols as garbage.
10372         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10373         table information for static and relocatable links.
10374         * symtab.h (Symbol_table::set_gc): New function.
10375         (Symbol_table::gc): New function.
10376         (Symbol_table::gc_mark_undef_symbols): New function.
10377         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10378         (Symbol_table::gc_mark_dyn_syms): New function.
10379         (Symbol_table::gc_): New data member.
10380         * target.h (Sized_target::gc_process_relocs): New pure virtual
10381         function.
10382         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10383         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10384
10385 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10386
10387         * options.h (General_options::gc_sections): Define as a no-op for now.
10388         (General_options::no_keep_memory): Ditto.
10389         (General_options::Bshareable): Define.
10390         * options.cc (General_options::finalize): Honor -Bshareable.
10391
10392 2009-01-20  Andreas Schwab  <schwab@suse.de>
10393
10394         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10395         read the value in the contents, since we don't use it.  Use the
10396         template endianness when writing.
10397         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10398
10399 2009-01-19  Andreas Schwab  <schwab@suse.de>
10400
10401         * configure.tgt (powerpc64-*): Fix targ_obj.
10402
10403 2009-01-15  Ian Lance Taylor  <iant@google.com>
10404
10405         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10406         local symbols when stripping all symbols.
10407
10408 2009-01-14  Cary Coutant  <ccoutant@google.com>
10409
10410         * output.cc (Output_reloc): Add explicit instantiations.
10411
10412 2009-01-14  Cary Coutant  <ccoutant@google.com>
10413
10414         * archive.cc (Archive::get_elf_object_for_member): Remove call
10415         to File_read::claim_for_plugin.
10416         * descriptors.cc (Descriptors::open): Remove reference to
10417         is_claimed.
10418         (Descriptors::claim_for_plugin): Remove.
10419         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10420         (Descriptors::is_claimed): Remove.
10421         (claim_descriptor_for_plugin): Remove.
10422         * fileread.cc (File_read::claim_for_plugin): Remove.
10423         * fileread.h (File_read::claim_for_plugin): Remove.
10424         (File_read::descriptor): Reopen descriptor if necessary.
10425         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10426         (Plugin_manager::all_symbols_read): Add task parameter. Change
10427         all callers.
10428         (Plugin_manager::get_input_file): New function.
10429         (Plugin_manager::release_input_file): New function.
10430         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10431         corresponding data member.
10432         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10433         and pass to base constructor. Change all callers.
10434         (get_input_file, release_input_file): New functions.
10435         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10436         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10437         (Plugin_manager::all_symbols_read): Add task parameter.
10438         (Plugin_manager::get_input_file): New function.
10439         (Plugin_manager::release_input_file): New function.
10440         (Plugin_manager::task_): New data member.
10441         (Pluginobj::Pluginobj): Add filesize parameter.
10442         (Pluginobj::filename): New function.
10443         (Pluginobj::descriptor): New function.
10444         (Pluginobj::filesize): New function.
10445         (Pluginobj::filesize_): New data member.
10446         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10447         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10448         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10449
10450         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10451         with archive libraries.
10452         * testsuite/Makefile.in: Regenerate.
10453         * testsuite/plugin_test.c (struct sym_info): New type.
10454         (get_input_file, release_input_file): New static variables.
10455         (onload): Capture new transfer vector entries.
10456         (claim_file_hook): Stop reading at end of file according to filesize.
10457         Factor out parsing of readelf output into separate function.
10458         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10459         APIs and get the source file name from the symbol table.  Convert
10460         source file name to corresponding object file name.  Print info
10461         message when adding new input files.
10462         (parse_readelf_line): New function.
10463         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10464         * testsuite/plugin_test_2.sh: Likewise.
10465         * testsuite/plugin_test_3.sh: Likewise.
10466         * testsuite/plugin_test_4.sh: New test case.
10467
10468 2009-01-07  Ian Lance Taylor  <iant@google.com>
10469
10470         * version.cc (version_string): Bump to 1.8.
10471
10472 2008-12-23  Cary Coutant  <ccoutant@google.com>
10473
10474         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10475         * plugin.cc (Plugin_manager::finish): Rename as
10476         layout_deferred_objects.  Move cleanup to separate function.
10477         (Plugin_manager::cleanup): New function.
10478         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10479         separately.
10480         * plugin.h (Plugin_manager::finish): Rename as
10481         layout_deferred_objects.
10482         (Plugin_manager::cleanup): New function.
10483         (Plugin_manager::cleanup_done): New field.
10484
10485 2008-12-23  Cary Coutant  <ccoutant@google.com>
10486
10487         * plugin.cc (is_visible_from_outside): New function.
10488         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10489         so we don't return "IR only" status for exported symbols or -r links.
10490
10491         * testsuite/Makefile.am (plugin_test_3): New test case.
10492         * testsuite/Makefile.in: Regenerate.
10493         * testsuite/plugin_test_3.sh: New file.
10494
10495 2008-12-22  Cary Coutant  <ccoutant@google.com>
10496
10497         * object.cc (Sized_relobj::layout_section): New function.
10498         (Sized_relobj::do_layout): Defer layout of input sections until after
10499         plugin has provided replacement files.
10500         (Sized_relobj::do_layout_deferred_sections): New function.
10501         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10502         (Relobj::layout_deferred_sections): New function.
10503         (Relobj::do_layout_deferred_sections): New function.
10504         (Sized_relobj::do_layout_deferred_sections): New function.
10505         (Sized_relobj::layout_section): New function.
10506         (Sized_relobj::Deferred_layout): New structure.
10507         (Sized_relobj::deferred_layout_): New field.
10508         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10509         Change all callers.  Layout deferred sections.
10510         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10511         references.
10512         (Plugin_hook::run): Move code from do_plugin_hook inline.
10513         (Plugin_hook::do_plugin_hook): Remove.
10514         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10515         (Plugin_manager::finish): Renamed, was cleanup.
10516         (Plugin_manager::should_defer_layout): New function.
10517         (Plugin_manager::add_deferred_layout_object): New function.
10518         (Plugin_manager::Deferred_layout_list): New type.
10519         (Plugin_manager::deferred_layout_objects_): New field.
10520         (Plugin_hook::do_plugin_hook): Remove.
10521
10522 2008-12-17  Ian Lance Taylor  <iant@google.com>
10523
10524         * options.h (class General_options): Add --no case for
10525         --export-dynamic.
10526
10527 2008-12-16  Cary Coutant  <ccoutant@google.com>
10528
10529         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10530         vector.
10531         (Plugin_manager::claim_file): Create plugin object even if
10532         plugin did not call the add_symbols callback.
10533         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10534         asking for more symbols than were added.
10535         * testsuite/Makefile.am (plugin_test_1): Add test case with
10536         no global symbols.
10537         (empty.syms): New target.
10538         * testsuite/Makefile.in: Regenerate.
10539         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10540         message. Don't call add_symbols if no globals.
10541         (all_symbols_read_hook): Don't provide replacement for empty
10542         claimed file.
10543
10544 2008-12-12  Ian Lance Taylor  <iant@google.com>
10545
10546         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10547         r_type == 0 for a local symbol with r_sym == 0.
10548         (scan_relocatable_relocs): Pass r_sym to
10549         local_non_section_strategy.
10550         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10551         r_sym parameter.
10552
10553         * configure.ac: Update test for TLS descriptors: they are
10554         supported as of glibc 2.9.
10555         * configure: Rebuild.
10556
10557 2008-12-11  Ian Lance Taylor  <iant@google.com>
10558
10559         PR 7091
10560         * target-reloc.h (Default_scan_relocatable_relocs): For each
10561         function, map r_type == 0 to RELOC_DISCARD.
10562
10563 2008-12-10  Cary Coutant  <ccoutant@google.com>
10564
10565         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10566         object to override a kept COMDAT group from a plugin object.
10567
10568 2008-12-09  Ian Lance Taylor  <iant@google.com>
10569
10570         PR 7088
10571         * yyscript.y (file_cmd): Handle INPUT.
10572
10573         * testsuite/initpri1.c: Change all declarations to be full
10574         prototypes by adding void, to avoid compiler warnings.
10575
10576 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10577
10578         * options.cc (General_options::parse_plugin_opt): New.
10579         (General_options::add_plugin): The argument now is just the filename.
10580         (General_options::add_plugin_option): New.
10581         * options.h (plugin_opt): New.
10582         (add_plugin): Change argument name.
10583         (add_plugin_option): New.
10584         * plugin.cc (Plugin::load): Don't parse the plugin option.
10585         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10586         (Plugin::add_option): New.
10587         (Plugin::args_): Change type.
10588         (Plugin::filename_): New.
10589         (Plugin_manager::add_plugin_option): New.
10590         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10591         * testsuite/Makefile.in: Regenerate.
10592
10593 2008-12-05  Cary Coutant  <ccoutant@google.com>
10594
10595         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10596         Handle --strip-lto-sections option.
10597         * options.h (strip_lto_sections): New option.
10598
10599 2008-12-01  Cary Coutant  <ccoutant@google.com>
10600
10601         * plugin.cc (ld_plugin_message): Change format parameter to const.
10602         Fix mismatch between new[] and delete.
10603
10604 2008-11-14  Cary Coutant  <ccoutant@google.com>
10605
10606         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10607         instead of -1U.
10608
10609 2008-11-05  Craig Silverstein  <csilvers@google.com>
10610
10611         * options.cc (General_options::parse_dynamic_list): New function.
10612         * options.h (General_options): New flags dynamic_list,
10613         dynamic_list_data, dynamic_list_cpp_new, and
10614         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10615         (General_options::in_dynamic_list): New function.
10616         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10617         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10618         (Lex::can_continue_name): Likewise.
10619         (yylex): Likewise.
10620         (read_script_file): New parameter script_options.
10621         (read_dynamic_list): New function.
10622         (Script_options::define_dynamic_list): New function.
10623         (dynamic_list_keyword_parsecodes): New variable.
10624         (dynamic_list_keywords): New variable.
10625         * script.h (Script_options::define_dynamic_list): New function
10626         prototype.
10627         (read_dynamic_list): New function prototype.
10628         * symtab.cc (strprefix): New macro.
10629         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10630         dynamic_list_data, dynamic_list_cpp_new, and
10631         dynamic_list_cpp_typeinfo.
10632         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10633         (dynamic_list_expr): New rule.
10634         (dynamic_list_nodes): Likewise.
10635         (dynamic_list_node): Likewise.
10636         * testsuite/Makefile.am (dynamic_list): New test.
10637         * testsuite/Makefile.in: Regenerated.
10638         * testsuite/dynamic_list.t: New file.
10639         * testsuite/dynamic_list.sh: New file.
10640
10641 2008-11-05  Craig Silverstein  <csilvers@google.com>
10642
10643         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10644         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10645         (t11_last): Likewise.
10646         * testsuite/ver_test_6.c (main): Likewise.
10647
10648 2008-10-07  Cary Coutant  <ccoutant@google.com>
10649
10650         * options.c (General_options::finalize): Add check for -static and
10651         -shared.
10652         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10653         is not empty.
10654
10655 2008-10-02  Cary Coutant  <ccoutant@google.com>
10656
10657         * plugin.cc (make_sized_plugin_object): Fix conditional
10658         compilation to work when not all targets are enabled.
10659
10660 2008-09-29  Cary Coutant  <ccoutant@google.com>
10661
10662         * archive.cc (Archive::get_file_and_offset): Use filename instead
10663         of name to get library path.
10664         (Archive::include_member): Unlock external member of a thin archive.
10665
10666         * testsuite/Makefile.am (TEST_AR): New variable.
10667         (thin_archive_test_1): New test.
10668         (thin_archive_test_2): New test.
10669         * testsuite/Makefile.in: Regenerate.
10670         * testsuite/thin_archive_main.cc: New file.
10671         * testsuite/thin_archive_test_1.cc: New file.
10672         * testsuite/thin_archive_test_2.cc: New file.
10673         * testsuite/thin_archive_test_3.cc: New file.
10674         * testsuite/thin_archive_test_4.cc: New file.
10675
10676 2008-09-29  Cary Coutant  <ccoutant@google.com>
10677
10678         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10679         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10680         instead of -1U.
10681         (Sized_relobj::do_finalize_local_symbols): Likewise.
10682         (Sized_relobj::map_to_kept_section): Likewise.
10683         * object.h (Sized_relobj::invalid_address): New constant.
10684         (Sized_relobj::do_output_section_offset): Check for invalid_address
10685         and return -1ULL.
10686         * output.cc (Output_reloc::local_section_offset): Use constant
10687         invalid_address instead of -1U.
10688         (Output_reloc::get_address): Likewise.
10689         (Output_section::output_address): Change -1U to -1ULL.
10690         * output.h (Output_reloc::invalid_address): New constant.
10691         * reloc.cc (Sized_relobj::write_sections): Use constant
10692         invalid_address instead of -1U.
10693         (Sized_relobj::relocate_sections): Likewise.
10694         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10695         values for merge sections.
10696         * target-reloc.h (relocate_for_relocatable): Use constant
10697         invalid_address instead of -1U.
10698
10699 2008-09-19  Cary Coutant  <ccoutant@google.com>
10700
10701         Add plugin functionality for link-time optimization (LTO).
10702         * configure.ac (plugins): Add --enable-plugins option.
10703         * configure: Regenerate.
10704         * config.in: Regenerate.
10705         * Makefile.am (LIBDL): New variable.
10706         (CCFILES): Add plugin.cc.
10707         (HFILES): Add plugin.h.
10708         (ldadd_var): Add LIBDL.
10709         * Makefile.in: Regenerate.
10710
10711         * archive.cc: Include "plugin.h".
10712         (Archive::setup): Don't preread archive symbols when using a plugin.
10713         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10714         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10715         files.
10716         (Archive::include_member): Add symbols from plugin objects.
10717         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10718         * descriptors.cc (Descriptors::open): Check for file descriptors
10719         abandoned by plugins.
10720         (Descriptors::claim_for_plugin): New function.
10721         * descriptors.h (Descriptors::claim_for_plugin): New function.
10722         (Open_descriptor::is_claimed): New field.
10723         (claim_descriptor_for_plugin): New function.
10724         * fileread.cc (File_read::claim_for_plugin): New function.
10725         * fileread.h (File_read::claim_for_plugin): New function.
10726         (File_read::descriptor): New function.
10727         * gold.cc: Include "plugin.h".
10728         (queue_initial_tasks): Add task to call plugin hooks for generating
10729         new object files.
10730         * main.cc: Include "plugin.h".
10731         (main): Load plugin libraries.
10732         * object.h (Pluginobj): Declare.
10733         (Object::pluginobj): New function.
10734         (Object::do_pluginobj): New function.
10735         (Object::set_target): New function.
10736         * options.cc: Include "plugin.h".
10737         (General_options::parse_plugin): New function.
10738         (General_options::General_options): Initialize plugins_ field.
10739         (General_options::add_plugin): New function.
10740         * options.h (Plugin_manager): Declare.
10741         (General_options): Add --plugin option.
10742         (General_options::has_plugins): New function.
10743         (General_options::plugins): New function.
10744         (General_options::add_plugin): New function.
10745         (General_options::plugins_): New field.
10746         * plugin.cc: New file.
10747         * plugin.h: New file.
10748         * readsyms.cc: Include "plugin.h".
10749         (Read_symbols::do_read_symbols): Check for archive before checking
10750         for ELF file.  Call plugin hooks to claim files.
10751         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10752         from a real object file; force override when processing replacement
10753         files.
10754         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10755         (Symbol::init_base_object): Likewise.
10756         (Symbol::init_base_output_data): Likewise.
10757         (Symbol::init_base_output_segment): Likewise.
10758         (Symbol::init_base_constant): Likewise.
10759         (Symbol::init_base_undefined): Likewise.
10760         (Symbol::output_section): Assert that object is not a plugin.
10761         (Symbol_table::add_from_pluginobj): New function.
10762         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10763         undefined.
10764         (Symbol_table::sized_write_globals): Likewise.
10765         (Symbol_table::add_from_pluginobj): Instantiate template.
10766         * symtab.h (Sized_pluginobj): Declare.
10767         (Symbol::in_real_elf): New function.
10768         (Symbol::set_in_real_elf): New function.
10769         (Symbol::in_real_elf_): New field.
10770         (Symbol_table::add_from_pluginobj): New function.
10771
10772         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10773         (LIBDL): New variable.
10774         (LDADD): Add LIBDL.
10775         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10776         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10777         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10778         (MOSTLYCLEANFILES): Likewise.
10779         * testsuite/Makefile.in: Regenerate.
10780         * testsuite/plugin_test.c: New file.
10781         * testsuite/plugin_test_1.sh: New file.
10782         * testsuite/plugin_test_2.sh: New file.
10783
10784 2008-09-16  Ian Lance Taylor  <iant@google.com>
10785
10786         * target-reloc.h (relocate_section): Check whether a symbol is
10787         defined by the ABI before reporting an undefined symbol error.
10788         * target.h (Target::is_defined_by_abi): Make parameter const.
10789         (Target::do_is_defined_by_abi): Likewise.
10790         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10791         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10792         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10793         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10794         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10795         * testsuite/Makefile.in: Rebuild.
10796
10797         * fileread.cc (make_view): Add casts to avoid warning.
10798
10799 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10800
10801         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10802         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10803
10804 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10805
10806         * options.h (General_options::output_is_executable): New.
10807         (General_options::output_is_pie): New.
10808         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10809         for shared libraries.
10810         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10811
10812 2008-09-11  Chris Demetriou  <cgd@google.com>
10813
10814         * options.h (origin): New -z option.
10815         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10816         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10817         in DT_FLAGS_1.
10818
10819 2008-09-05  Cary Coutant  <ccoutant@google.com>
10820
10821         * fileread.cc (File_read::make_view): Add check for attempt to map
10822         beyond end of file.
10823
10824 2008-09-05  Cary Coutant  <ccoutant@google.com>
10825
10826         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10827         explicit instantiations.
10828
10829 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10830
10831         PR gold/6858
10832         * options.cc (General_options::finalize): Allow undefined symbols
10833         in shlibs if linking -shared.
10834
10835         PR gold/6859
10836         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10837         symbols as not needing a dynsym entry.
10838
10839 2008-08-20  Craig Silverstein  <csilvers@google.com>
10840
10841         * fileread.cc (File_read::open): Do not lock the file unless it
10842         was successfully opened.
10843
10844 2008-08-14  Cary Coutant  <ccoutant@google.com>
10845
10846         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10847         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10848         * testsuite/tls_test.cc (struct int128): 128-bit struct
10849         for testing TLS relocs with non-zero addend.
10850         (v12): New TLS variable.
10851         (t12): New test.
10852         (t_last): Add check for v12.
10853         * testsuite/tls_test.h (t12): New function.
10854         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10855
10856 2008-08-13  Ian Lance Taylor  <iant@google.com>
10857
10858         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10859         set tls_segment_ or relro_segment_.
10860         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10861         when appropriate.
10862         * output.h (Output_section::clear_is_relro): New function.
10863         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10864         sections specially even when output_data_ is empty.
10865         (Output_segment::maximum_alignment): When first section is relro,
10866         only force alignment for PT_LOAD segments.
10867         * script.cc (script_data_segment_align): New function.
10868         (script_data_segment_relro_end): New function.
10869         * script-c.h (script_data_segment_align): Declare.
10870         (script_data_segment_relro_end): Declare.
10871         * script-sections.h (class Script_sections): Declare
10872         data_segment_align and data_segment_relro_end.  Add fields
10873         segment_align_index_ and saw_relro_end_.
10874         * script-sections.cc (class Sections_element): Add set_is_relro
10875         virtual function.  Add new bool* parameter to place_orphan_here.
10876         Add get_output_section virtual function.
10877         (class Output_section_definition): Add set_is_relro.  Add new
10878         bool* parameter to place_orphan_here.  Add get_output_section.
10879         Add is_relro_ field.
10880         (Output_section_definition::Output_section_definition): Initialize
10881         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10882         and is_relro_ fields.
10883         (Output_section_definition::place_orphan_here): Add is_relro
10884         parameter.
10885         (Output_section_definition::set_section_addresses): Set relro for
10886         output section.
10887         (Output_section_definition::alternate_constraint): Likewise.
10888         (class Orphan_output_section): Add new bool* parameter to
10889         place_orphan_here.  Add get_output_section.
10890         (Orphan_output_section::place_orphan_here): Add is_relro
10891         parameter.
10892         (Script_sections::Script_sections): Initialize
10893         data_segment_align_index_ and saw_relro_end_.
10894         (Script_sections::data_segment_align): New function.
10895         (Script_sections::data_segment_relro_end): New function.
10896         (Script_sections::place_orphan): Set or clear is_relro.
10897         (Script_sections::set_section_addresses): Force alignment of first
10898         TLS section.
10899         * yyscript.y (exp): Call script_data_segment_align and
10900         script_data_segment_relro_end.
10901         * testsuite/relro_script_test.t: New file.
10902         * testsuite/relro_test.cc (using_script): Declare.
10903         (t1, t2): Test using_script.
10904         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10905         (relro_script_test_SOURCES): Define.
10906         (relro_script_test_DEPENDENCIES): Define.
10907         (relro_script_test_LDFLAGS): Define.
10908         (relro_script_test_LDADD): Define.
10909         (relro_script_test.so): New target.
10910         * testsuite/Makefile.in: Rebuild.
10911
10912 2008-08-06  Cary Coutant <ccoutant@google.com>
10913
10914         * archive.cc (Archive::total_archives, Archive::total_members)
10915         (Archive::total_members_loaded): New variables.
10916         (Archive::setup): Add parameter.  Add option to preread
10917         archive symbols.
10918         (Archive::read_armap): Add counter.
10919         (Archive::get_file_and_offset): New function.
10920         (Archive::get_elf_object_for_member): New function.
10921         (Archive::read_all_symbols): New function.
10922         (Archive::read_symbols): New function.
10923         (Archive::add_symbols): Add counters.
10924         (Archive::include_all_members): Use armap to find members if it's
10925         already built.
10926         (Archive::include_member): Skip reading symbols if already read.
10927         Factored code into Archive::get_file_and_offset and
10928         Archive::get_elf_object_for_member.  Changed call to
10929         Mapfile::report_include_archive_member.
10930         (Archive::print_stats): New function.
10931         * archive.h: Declare Object and Read_symbols_data classes.
10932         (Archive::Archive): Add initializers for new members.
10933         (Archive::setup): Add parameter.
10934         (Archive::print_stats): New function.
10935         (Archive::total_archives, Archive::total_members)
10936         (Archive::total_members_loaded): New variables.
10937         (Archive::get_file_and_offset): New function.
10938         (Archive::get_elf_object_for_member): New function.
10939         (Archive::read_all_symbols): New function.
10940         (Archive::read_symbols): New function.
10941         (Archive::Archive_member): New class.
10942         (Archive::members_): New member.
10943         (Archive::num_members_): New member.
10944         * main.cc: Include archive.h.
10945         (main): Call Archive::print_stats.
10946         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10947         archive parameter; member_name is now the fully-decorated name.
10948         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10949         * options.h: (General_options): Add --preread-archive-symbols option.
10950         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10951         Archive::setup.
10952
10953 2008-08-04  Ian Lance Taylor  <iant@google.com>
10954
10955         * symtab.h (Symbol::use_plt_offset): New function.
10956         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10957         * powerpc.cc (Relocate::relocate): Likewise.
10958         * sparc.cc (Relocate::relocate): Likewise.
10959         * x86_64.cc (Relocate::relocate): Likewise.
10960         * testsuite/weak_plt.sh: New test.
10961         * testsuite/weak_plt_main.cc: New test.
10962         * testsuite/weak_plt_shared.cc: New test.
10963         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10964         (check_PROGRAMS): Add weak_plt.
10965         (check_DATA): Add weak_plt_shared.so.
10966         (weak_plt_main_pic.o, weak_plt): New targets.
10967         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10968         * testsuite/Makefile.in: Rebuild.
10969
10970         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10971         gcctestdir/ld.
10972         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10973         * testsuite/Makefile.in: Rebuild.
10974
10975 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10976
10977         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10978         * Makefile.in: Regenerate.
10979         * po/POTFILES.in: Regenerate.
10980
10981 2008-07-29  Ian Lance Taylor  <iant@google.com>
10982
10983         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10984         symbols before other symbols.
10985         * testsuite/script_test_2.cc (test_addr): Declare.
10986         (test_addr_alias): Declare.
10987         (main): Check that test_addr and test_addr_alias have the right
10988         values.
10989         * testsuite/script_test_2.t: Define test_addr_alias and
10990         test_addr.
10991
10992 2008-07-24  Ian Lance Taylor  <iant@google.com>
10993
10994         PR 5990
10995         * descriptors.cc: New file.
10996         * descriptors.h: New file.
10997         * gold-threads.h (class Hold_optional_lock): New class.
10998         * fileread.cc: Include "descriptors.h".
10999         (File_read::~File_read): Release descriptor rather than closing
11000         it.
11001         (File_read::open) [file]: Call open_descriptor rather than open.
11002         Set is_descriptor_opened_.
11003         (File_read::open) [memory]: Assert that descriptor is not open.
11004         (File_read::reopen_descriptor): New function.
11005         (File_read::release): Release descriptor.
11006         (File_read::do_read): Make non-const.  Reopen descriptor.
11007         (File_read::read): Make non-const.
11008         (File_read::make_view): Reopen descriptor.
11009         (File_read::do_readv): Likewise.
11010         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11011         Update declarations.
11012         * layout.cc: Include "descriptors.h".
11013         (Layout::create_build_id): Use open_descriptor rather than open.
11014         * output.cc: Include "descriptors.h".
11015         (Output_file::open): Use open_descriptor rather than open.
11016         * archive.cc (Archive::const_iterator): Change Archive to be
11017         non-const.
11018         (Archive::begin, Archive::end): Make non-const.
11019         (Archive::count_members): Likewise.
11020         * archive.h (class Archive): Update declarations.
11021         * object.h (Object::read): Make non-const.
11022         * Makefile.am (CCFILES): Add descriptors.cc.
11023         (HFILES): Add descriptors.h.
11024         * Makefile.in: Rebuild.
11025
11026         PR 6716
11027         * gold.h: Always include <clocale>.  Add Solaris workarounds
11028         following code in binutils/sysdep.h.
11029
11030         PR 6048
11031         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11032         this->eh_frame_hdr_ is NULL before using it.
11033
11034         * dynobj.cc (Versions::Versions): Update comment.
11035
11036         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11037         the base version name.
11038
11039         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11040         array size plus one.
11041         (Stringpool_template::set_string_offsets): Subtract one from key
11042         before using it as an array index.
11043         (Stringpool_template::get_offset_with_length): Likewise.
11044         (Stringpool_template::write_to_buffer): Likewise.
11045         * stringpool.h (Stringpool_template::get_offset_from_key):
11046         Likewise.
11047
11048 2008-07-23  Ian Lance Taylor  <iant@google.com>
11049
11050         PR 6658
11051         * object.h (Merged_symbol_value::value): Do our best to handle a
11052         negative addend.
11053
11054         PR 6647
11055         * script.cc (Version_script_info::get_versions): Don't add empty
11056         version tag to return value.
11057         (Version_script_info::get_symbol_version_helper): Change return
11058         type to bool.  Add pversion parameter.  Change all callers.
11059         (script_register_vers_node): Don't require a non-NULL tag.
11060         * script.h (class Version_script_info): Update declarations.
11061         (Version_script_info::get_symbol_version): Change return type to
11062         bool.  Add version parameter.  Change all callers.
11063         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11064         handling.  Handle an empty version from a version script.
11065         (Symbol_table::define_special_symbol): Likewise.
11066         * testsuite/ver_test_10.script: New file.
11067         * testsuite/ver_test_10.sh: New file.
11068         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11069         (check_DATA): Add ver_test_10.syms.
11070         (ver_test_10.syms, ver_test_10.so): New target.
11071         * testsuite/Makefile.in: Rebuild.
11072
11073 2008-07-23  Simon Baldwin  <simonb@google.com>
11074
11075         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11076         to zero for undefined symbols from dynamic libraries.
11077
11078 2008-07-23  Ian Lance Taylor  <iant@google.com>
11079
11080         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11081         Change all callers.
11082         * symtab.h (class Symbol_table): Update declaration.
11083         * testsuite/ver_test_9.cc: New file.
11084         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11085         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11086         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11087         (ver_test_9.so, ver_test_9.o): New targets.
11088         * testsuite/Makefile.in: Rebuild.
11089
11090 2008-07-22  Ian Lance Taylor  <iant@google.com>
11091
11092         * options.h (class General_options): Define --check-sections.
11093         * layout.cc (Layout::set_segment_offsets): Handle
11094         --check-sections.
11095
11096         * options.h (class General_options): Define -n/--nmagic and
11097         -N/--omagic.
11098         * options.cc (General_options::finalize): For -n/--nmagic or
11099         -N/--omagic, set -static.
11100         * layout.cc (Layout::attach_allocated_section_to_segment): If
11101         -N/--omagic, don't put read-only and read-write sections in
11102         different segments.
11103         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11104         finding a read-only segment.
11105         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11106         don't set the minimum segment alignment to the common page size,
11107         and don't set the file offset to the address modulo the page size.
11108         * script-sections.cc (Script_sections::create_segments): If
11109         -n/--omagic, don't put read-only and read-write sections in
11110         different segments.
11111
11112         * cref.cc: New file.
11113         * cref.h: New file.
11114         * options.h (class General_options): Add --print-symbol-counts.
11115         * main.cc (main): Issue defined symbol report if requested.
11116         * archive.cc (Archive::interpret_header): Make into a const member
11117         function.
11118         (Archive::add_symbols): Call Input_objects::archive_start and
11119         archive_stop.
11120         (Archive::const_iterator): Define new class.
11121         (Archive::begin, Archive::end): New functions.
11122         (Archive::include_all_members): Rewrite to use iterator.
11123         (Archive::count_members): New function.
11124         * archive.h (class Archive): Update declarations.
11125         (Archive::filename): New function.
11126         * object.cc: Include "cref.h".
11127         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11128         (Sized_relobj::do_get_global_symbol_counts): New function.
11129         (Input_objects::add_object): Add object to cross-referencer.
11130         (Input_objects::archive_start): New function.
11131         (Input_objects::archive_stop): New function.
11132         (Input_objects::print_symbol_counts): New function.
11133         * object.h: Declare Cref and Archive.
11134         (Object::get_global_symbol_counts): New function.
11135         (Object::do_get_global_symbol_counts): New pure virtual function.
11136         (class Sized_relobj): Add defined_count_ field.  Update
11137         declarations.
11138         (class Input_objects): Add cref_ field.  Update constructor.
11139         Update declarations.
11140         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11141         defined_count_.
11142         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11143         symbol counts.
11144         (Sized_dynobj::do_get_global_symbol_counts): New function.
11145         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11146         defined_count_.  Update declarations.  Define Symbols typedef.
11147         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11148         parameter.  Change all callers.
11149         (Symbol_table::add_from_dynobj): Add sympointers and defined
11150         parameters.  Change all callers.
11151         * symtab.h (class Symbol_table): Update declarations.
11152         * Makefile.am (CCFILES): Add cref.cc.
11153         (HFILES): Add cref.h.
11154         * Makefile.in: Rebuild.
11155
11156 2008-07-22  Simon Baldwin  <simonb@google.com>
11157
11158         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11159         to zero when writing undefined symbols.
11160
11161 2008-07-22  Ian Lance Taylor  <iant@google.com>
11162
11163         * output.cc (Output_section::add_input_section): Don't try to
11164         merge empty merge sections.
11165
11166 2008-07-21  Craig Silverstein  <csilvers@google.com>
11167
11168         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11169         Include symbol version in error message.
11170
11171 2008-07-20  Chris Demetriou  <cgd@google.com>
11172
11173         * configure.ac (gold_cv_c_random_seed): New configured variable.
11174         (RANDOM_SEED_CFLAGS): New substituted variable.
11175         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11176         * configure: Rebuild.
11177         * Makefile.in: Likewise.
11178         * testsuite/Makefile.in: Likewise.
11179
11180 2008-07-18  Ian Lance Taylor  <iant@google.com>
11181
11182         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11183         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11184         * testsuite/ver_test_main.cc (main): Call t4.
11185         (t4, t4_2a): Define.
11186         * testsuite/ver_test_2.cc (t4_2): Define.
11187         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11188         * testsuite/ver_test_4.cc (t4_2a): Define.
11189         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11190         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11191
11192 2008-07-17  Ian Lance Taylor  <iant@google.com>
11193
11194         * dynobj.cc (Versions::add_def): If we give an error about a
11195         missing version, go ahead and create the version anyhow.
11196
11197 2008-07-10  Ian Lance Taylor  <iant@google.com>
11198
11199         Handle output sections with more than 0x7fffffff bytes.
11200         * object.h (class Relobj): Change map_to_output_ to
11201         output_sections_, and just keep a section pointer.  Change all
11202         uses.  Move comdat group support to Sized_relobj.
11203         (Relobj::is_section_specially_mapped): Remove.
11204         (Relobj::output_section): Remove poff parameter.  Change all
11205         callers.
11206         (Relobj::output_section_offset): New function.
11207         (Relobj::set_section_offset): Rewrite.
11208         (Relobj::map_to_output): Remove.
11209         (Relobj::output_sections): New function.
11210         (Relobj::do_output_section_offset): New pure virtual function.
11211         (Relobj::do_set_section_offset): Likewise.
11212         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11213         group support from Relobj.  Update declarations.
11214         (Sized_relobj::get_output_section_offset): New function.
11215         (Sized_relobj::do_output_section_offset): New function.
11216         (Sized_relobj::do_set_section_offset): New function.
11217         * object.cc (Relobj::output_section_address): Remove.
11218         (Sized_relobj::Sized_relobj): Initialize new fields.
11219         (Sized_relobj::include_section_group): Cast find_kept_object to
11220         Sized_relobj.
11221         (Sized_relobj::include_linkonce_section): Likewise.
11222         (Sized_relobj::do_layout): Use separate arrays for output section
11223         and output offset.
11224         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11225         output_sections.
11226         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11227         output_sections and section_offsets.
11228         (Sized_relobj::write_local_symbols): Likewise.
11229         (map_to_kept_section): Compute output address directly.
11230         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11231         output_sections and section_offsets.
11232         (Sized_relobj::write_sections): Likewise.
11233         (Sized_relobj::relocate_sections): Likewise.
11234         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11235         * output.h (class Output_reloc): Update declarations.  Change
11236         u2_.relobj to Sized_relobj*.
11237         (class Output_data_reloc): Change add functions to use
11238         Sized_relobj*.
11239         * output.cc (Output_reloc::Output_reloc): Change relobj to
11240         Sized_relobj*.
11241         (Output_reloc::local_section_offset): Change return type to
11242         Elf_Addr.  Use get_output_section_offset.
11243         (Output_reloc::get_address): Likewise.
11244         (Output_section::is_input_address_mapped): Don't call
11245         is_section_specially_mapped.
11246         (Output_section::output_offset): Likewise.
11247         (Output_section::output_address): Likewise.
11248         (Output_section::starting_output_address): Likewise.
11249         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11250         parameter to Sized_relobj*.
11251         (Copy_relocs::need_copy_reloc): Likewise.
11252         (Copy_relocs::save): Likewise.
11253         * copy-relocs.h (class Copy_relocs): Update declarations.
11254         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11255         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11256         * target-reloc.h (relocate_for_relocatable): Change
11257         offset_in_output_section type to Elf_Addr.  Change code that uses
11258         it as well.
11259         * layout.cc (Layout::layout): Always set *off.
11260         * mapfile.cc (Mapfile::print_input_section): Use
11261         output_section_offset.
11262         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11263         Sized_relobj*.
11264         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11265         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11266         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11267
11268 2008-07-03  Ian Lance Taylor  <iant@google.com>
11269
11270         * layout.cc (Layout::include_section): Do not discard unrecognized
11271         SHT_STRTAB sections.
11272
11273 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11274
11275         * script.cc (Lex::can_continue_name): Make '?' allowable in
11276         version-script names.
11277         * testsuite/version_script.map: Change glob pattern to use '?'
11278
11279 2008-06-30  Manish Singh  <yosh@gimp.org>
11280
11281         PR 6585
11282         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11283         Correct typo.
11284
11285 2008-06-30  Ian Lance Taylor  <iant@google.com>
11286
11287         PR 6660
11288         PR 6682
11289         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11290         versions]: Don't try to read the value in the contents, since we
11291         don't use it.  Use the template endianness when writing.
11292
11293 2008-06-25  Cary Coutant  <ccoutant@google.com>
11294
11295         * fileread.cc (File_read::make_view): Assert on zero-length view.
11296         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11297         symbol table when there are no symbols to read.
11298
11299 2008-06-23  Craig Silverstein  <csilvers@google.com>
11300
11301         * version.cc (version_string): Bump to 1.7
11302
11303 2008-06-18  Craig Silverstein  <csilvers@google.com>
11304
11305         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11306         constant 0xFFFF to type Valtype.
11307         (Powerpc_relocate_functions::rel16_ha): Likewise.
11308
11309 2008-06-17  Ian Lance Taylor  <iant@google.com>
11310
11311         * output.h (Output_section::Input_section): Initialize p2align_ to
11312         zero for Output_section_data constructors.
11313         (Output_section::Input_section::addralign): If not an input
11314         section, return the alignment of the Output_section_data.
11315         * testsuite/copy_test.cc: New file.
11316         * testsuite/copy_test_1.cc: New file.
11317         * testsuite/copy_test_2.cc: New file.
11318         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11319         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11320         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11321         (copy_test_1_pic.o, copy_test_1.so): New targets.
11322         (copy_test_2_pic.o, copy_test_2.so): New targets.
11323         * testsuite/Makefile.in: Rebuild.
11324
11325         * script-sections.cc (Script_sections::place_orphan): Initialize
11326         local variable exact.
11327
11328 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11329
11330         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11331
11332 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11333             David S. Miller  <davem@davemloft.net>
11334
11335         * powerpc.cc: New file.
11336         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11337         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11338         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11339         * Makefile.in: Rebuild.
11340
11341 2008-06-09  Ian Lance Taylor  <iant@google.com>
11342
11343         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11344         <exception>.
11345         (throwing, orig_terminate): New static variables.
11346         (terminate_handler): New static function.
11347         (t2): Set terminate handler.
11348
11349 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11350
11351         PR 6584
11352         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11353         alignment.
11354
11355 2008-05-30  Cary Coutant  <ccoutant@google.com>
11356
11357         * archive.cc (Archive::include_all_members) Correct to step
11358         over symbol table and extended name table in thin archives.
11359
11360 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11361
11362         PR 6407
11363         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11364         calculation.
11365
11366 2008-05-28  Caleb Howe  <cshowe@google.com>
11367
11368         * reduced_debug_output.cc: New file.
11369         * reduced_debug_output.h: New file.
11370         * options.h (class General_options): Add --strip-debug-non-line.
11371         * options.cc (General_options::finalize): Add strip_debug_non_line
11372         to the strip heirarchy.
11373         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11374         fields.
11375         * layout.cc: Include "reduced_debug_output.h".
11376         (Layout::Layout): Initialize new fields.
11377         (line_only_debug_sections): New static array.
11378         (is_lines_only_debug_sections): New static inline function.
11379         (Layout::include_section): Handle --strip-debug-non-line.
11380         (Layout::make_output_section): If --strip-debug-non-line, build
11381         new output sections for .debug_abbrev and .debug_info.
11382         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11383         gold.  Warn about possible overflow.
11384         (read_signed_LEB_128): Likewise.
11385         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11386         (read_signed_LEB_128): Declare.
11387         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11388         (HFILES): Add reduced_debug_output.h.
11389         * Makefile.in: Rebuild.
11390
11391 2008-05-21  Ian Lance Taylor  <iant@google.com>
11392
11393         * mapfile.cc: New file.
11394         * mapfile.h: New file.
11395         * options.h (class General_options): Add -M/--print-map and -Map.
11396         * options.cc (General_options::finalize): Make -M equivalent to
11397         -Map -.
11398         * main.cc: Include <cstdio> and "mapfile.h".
11399         (main): Open mapfile if requested.
11400         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11401         constructor.  Change caller.
11402         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11403         (queue_middle_tasks): Likewise.
11404         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11405         declarations.
11406         * archive.cc: Include "mapfile.h".
11407         (Archive::add_symbols): Add mapfile parameter.  Change all
11408         callers.  Pass mapfile, symbol, and reason to include_member.
11409         (Archive::include_all_members): Add mapfile parameter.  Change all
11410         callers.
11411         (Archive::include_member): Add mapfile, sym, and why parameters.
11412         Change all callers.  Report inclusion to map file.
11413         * archive.h: Include "fileread.h".
11414         (class Archive): Update declarations.
11415         (Archive::file): New const method.
11416         (class Add_archive_symbols): Add mapfile_ field.  Update
11417         constructor.  Change all callers.
11418         * readsyms.h (class Read_symbols): Likewise.
11419         (class Finish_group): Likewise.
11420         (class Read_script): Likewise.
11421         * common.cc: Include "mapfile.h".
11422         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11423         all callers.
11424         (Symbol_table::do_allocate_commons): Likewise.
11425         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11426         symbol allocation to mapfile.
11427         * common.h (class Allocate_commons_task): Add mapfile_ field.
11428         Update constructor.  Change all callers.
11429         * symtab.h (class Symbol_table): Update declarations.
11430         * layout.cc: Include "mapfile.h".
11431         (Layout_task_runner::run): Print information to mapfile.
11432         (Layout::create_gold_note): Change Output_data_fixed_space to
11433         Output_data_zero_fill.
11434         (Layout::create_build_id): Likewise.
11435         (Layout::print_to_mapfile): New function.
11436         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11437         constructor.  Change caller.
11438         (class Layout): Declare print_to_mapfile.
11439         * output.cc (Output_section::Input_section::print_to_mapfile): New
11440         function.
11441         (Output_section::add_input_section): If producing a map, always
11442         add to input_sections_ list.
11443         (Output_section::do_print_to_mapfile): New function.
11444         (Output_segment::print_sections_to_mapfile): New function.
11445         (Output_segment::print_section_list_to_mapfile): New function.
11446         * output.h: Include "mapfile.h".
11447         (Output_data::print_to_mapfile): New function.
11448         (Output_data::do_print_to_mapfile): New virtual function.
11449         (Output_segment_headers::do_print_to_mapfile): New function.
11450         (Output_file_header::do_print_to_mapfile): New function.
11451         (Output_data_const::do_print_to_mapfile): New function.
11452         (class Output_data_const_buffer): Add map_name_ field.  Update
11453         constructor.  Change all callers.  Add do_print_to_mapfile
11454         function.
11455         (class Output_data_fixed_space): Likewise.
11456         (class Output_data_space): Likewise.
11457         (class Output_data_zero_fill): New class.
11458         (Output_data_strtab::do_print_to_mapfile): New function.
11459         (Output_data_reloc_base::do_print_to_mapfile): New function.
11460         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11461         (Output_data_group::do_print_to_mapfile): New function.
11462         (Output_data_got::do_print_to_mapfile): New function.
11463         (Output_data_dynamic::do_print_to_mapfile): New function.
11464         (Output_symtab_xindex::do_print_to_mapfile): New function.
11465         (class Output_section): Declare do_print_to_mapflie.  Declare
11466         print_to_mapfile in Input_section.
11467         (class Output_segment): Declare new functions.
11468         * object.h (Sized_relobj::symbol_count): New function.
11469         * script-sections.cc
11470         (Output_section_element_dot_assignment::set_section_addresses):
11471         Change Output_data_fixed_space to Output_data_zero_fill.
11472         (Output_data_expression::do_print_to_mapfile): New function.
11473         * script.cc (read_input_script): Add mapfile parameter.  Change
11474         all callers.
11475         * script.h (read_input_script): Update declaration.
11476         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11477         (Eh_frame::do_print_to_mapfile): New function.
11478         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11479         (Output_merge_string::do_print_to_mapfile): New function.
11480         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11481         function.
11482         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11483         function.
11484         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11485         function.
11486         * Makefile.am (CCFILES): Add mapfile.cc.
11487         (HFILES): Add mapfile.h.
11488         * Makefile.in: Rebuild.
11489
11490 2008-05-19  Ian Lance Taylor  <iant@google.com>
11491
11492         * options.h (class General_options): Add -z relro.
11493         * layout.cc (Layout::Layout): Initialize relro_segment_.
11494         (Layout::add_output_section_data): Return the output section.
11495         (Layout::make_output_section): Rcognize relro sections and mark
11496         them appropriately.
11497         (Layout::attach_allocated_section_to_segment): Put relro sections
11498         in a PT_GNU_RELRO segment.
11499         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11500         section as relro.
11501         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11502         PT_TLS segments.
11503         (Layout::linkonce_mapping): Map d.rel.ro.local to
11504         .data.rel.ro.local.
11505         (Layout::output_section_name): Us .data.rel.ro.local for any
11506         section which begins with that.
11507         * layout.h (class Layout): Update add_output_section_data
11508         declaration.  Add relro_segment_ field.
11509         * output.cc (Output_section::Output_section): Initialize is_relro_
11510         and is_relro_local_ fields.
11511         (Output_segment::add_output_section): Group relro sections.
11512         (Output_segment::is_first_section_relro): New function.
11513         (Output_segment::maximum_alignment): If there is a relro section,
11514         align the segment to the common page size.
11515         (Output_segment::set_section_addresses): Track whether we are
11516         looking at relro sections.  If the last section is a relro
11517         section, align to the common page size.
11518         (Output_segment::set_section_list_addresses): Add in_relro
11519         parameter.  Change all callers.  Align to the page size when
11520         moving from relro to non-relro section.
11521         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11522         segment.
11523         * output.h (class Output_section): Add is_relro_ and
11524         is_relro_local_ fields.
11525         (Output_section::is_relro): New function.
11526         (Output_section::set_is_relro): New function.
11527         (Output_section::is_relro_local): New function.
11528         (Output_section::set_is_relro_local): New function.
11529         (class Output_segment): Update declarations.
11530         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11531         * sparc.cc (Target_sparc::got_section): Likewise.
11532         * x86_64.cc (Target_x86_64::got_section): Likewise.
11533         * testsuite/relro_test_main.cc: New file.
11534         * testsuite/relro_test.cc: New file.
11535         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11536         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11537         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11538         (relro_test.so, relro_test_pic.o): New targets.
11539         * testsuite/Makefile.in: Rebuild.
11540
11541 2008-05-16  Ian Lance Taylor  <iant@google.com>
11542
11543         * output.cc (Output_segment::add_output_section): Remove front
11544         parameter.
11545         * output.h (class Output_segment): Remove
11546         add_initial_output_section and overloaded add_output_section.
11547         Update declaration of remaining add_output_section.
11548         * layout.cc (Layout::create_interp): Call add_output_section
11549         rather than add_initial_output_section.
11550         (Layout::finish_dynamic_section): Likewise.
11551
11552         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11553         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11554         know the dynamic type.
11555         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11556         field.  Initialize it in constructor.
11557         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11558         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11559         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11560         reloc.
11561
11562         * output.cc (Output_reloc::get_address): Change return type to
11563         Elf_Addr.
11564         * output.h (class Output_reloc): Update get_address declaration.
11565         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11566         for section addresses.
11567
11568 2008-05-09  Ian Lance Taylor  <iant@google.com>
11569
11570         PR 6493
11571         * gold.cc (gold_nomem): Use return value of write.
11572
11573 2008-05-08  Ian Lance Taylor  <iant@google.com>
11574
11575         * symtab.c (Symbol::init_base_output_data): Add version
11576         parameter.  Change all callers.
11577         (Symbol::init_base_output_segment): Likewise.
11578         (Symbol::init_base_constant): Likewise.
11579         (Symbol::init_base_undefined): Likewise.
11580         (Sized_symbol::init_output_data): Likewise.
11581         (Sized_symbol::init_output_segment): Likewise.
11582         (Sized_symbol::init_constant): Likewise.
11583         (Sized_symbol::init_undefined): Likewise.
11584         (Symbol_table::do_define_in_output_data): If the new symbol has a
11585         version, mark it as the default.
11586         (Symbol_table::do_define_in_output_segment): Likewise.
11587         (Symbol_table::do_define_as_constant): Likewise.
11588         * symtab.h (class Symbol): Update declarations.
11589         (class Sized_symbol): Likewise.
11590         * resolve.cc (Symbol::override_version): New function.
11591         (Symbol::override_base): Call override_version.
11592         (Symbol::override_base_with_special): Likewise.
11593         * testsuite/ver_script_8.script: New file.
11594         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11595         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11596         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11597         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11598
11599 2008-05-06  Ian Lance Taylor  <iant@google.com>
11600
11601         PR 6049
11602         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11603         functions.
11604         (class General_options): Remove existing --undefined, and add
11605         --no-undefined instead.  Add new --undefined as synonym for -u.
11606         * archive.cc (Archive::add_symbols): Check whether symbol was
11607         named with -u.
11608         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11609         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11610         all uses.  Add IS_UNDEFINED.  Update declarations to split
11611         different versions of init_base.  Declare init_base_undefined.
11612         (Symbol::is_defined): Handle IS_UNDEFINED.
11613         (Symbol::is_undefined): Likewise.
11614         (Symbol::is_weak_undefined): Call is_undefined.
11615         (Symbol::is_absolute): Handle IS_CONSTANT.
11616         (class Sized_symbol): Update declarations to split different
11617         versions of init.  Declare init_undefined.
11618         (class Symbol_table): Declare new functions.
11619         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11620         Change all callers.
11621         (Symbol::init_base_output_data): Likewise.
11622         (Symbol::init_base_output_segment): Likewise.
11623         (Symbol::init_base_constant): Likewise.
11624         (Symbol::init_base_undefined): New function.
11625         (Sized_symbol::init_object): Rename from init.  Change all
11626         callers.
11627         (Sized_symbol::init_output_data): Likewise.
11628         (Sized_symbol::init_output_segment): Likewise.
11629         (Sized_symbol::init_constant): Likewise.
11630         (Sized_symbol::init_undefined): New function.
11631         (Symbol_table::add_undefined_symbols_from_command_line): New
11632         function.
11633         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11634         function.
11635         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11636         (Symbol::output_section): Likewise.
11637         (Symbol::set_output_section): Likewise.
11638         (Symbol_table::sized_finalize_symbol): Likewise.
11639         (Symbol_table::sized_write_globals): Likewise.
11640         * resolve.cc (Symbol_table::should_override): Likewise.
11641         (Symbol::override_base_with_special): Likewise.
11642
11643         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11644         symbol, change it to have default visibility.
11645         * testsuite/protected_1.cc: New file.
11646         * testsuite/protected_2.cc: New file.
11647         * testsuite/protected_3.cc: New file.
11648         * testsuite/protected_main_1.cc: New file.
11649         * testsuite/protected_main_2.cc: New file.
11650         * testsuite/protected_main_3.cc: New file.
11651         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11652         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11653         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11654         (protected_1.so): New target.
11655         (protected_1_pic.o, protected_2_pic.o): New targets.
11656         (protected_3_pic.o): New target.
11657         (check_PROGRAMS): Add protected_2.
11658         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11659         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11660         * testsuite/Makefile.in: Rebuild.
11661
11662         * options.h (DEFINE_var): Add set_user_set_##varname__.
11663         (DEFINE_bool_alias): New macro.
11664         (class General_options): Define -Bstatic using DEFINE_bool_alias
11665         rather than DEFINE_special.  Add --undefined as an alias for -z
11666         defs.
11667         * options.cc (General_options::parse_Bstatic): Remove.
11668
11669         * options.h (class General_options): Add --fatal-warnings.
11670         * main.cc (main): Implement --fatal-warnings.
11671         * errors.h (Errors::warning_count): New function.
11672
11673         * options.h (class General_options): Add -Bsymbolic-functions.
11674         * symtab.h (Symbol::is_preemptible): Check for
11675         -Bsymbolic-functions.
11676
11677 2008-05-05  Ian Lance Taylor  <iant@google.com>
11678
11679         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11680         as noVARNAME rather than no-VARNAME.
11681         (class General_options): Add option -z combreloc.
11682         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11683         get_address.
11684         (Output_reloc::sort_before) [SHT_REL]: New function.
11685         (Output_reloc::sort_before) [SHT_RELA]: New function.
11686         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11687         Sort_relocs_comparison.
11688         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11689         parameter.  Change all callers.
11690         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11691         sort_relocs parameter.  Change all callers.
11692         * output.cc (Output_reloc::get_address): New function, broken out
11693         of write_rel.
11694         (Output_reloc::write_rel): Call it.
11695         (Output_reloc::compare): New function.
11696         (Output_data_reloc_base::do_write): Optionally sort relocs.
11697
11698         * configure.ac: If targ_extra_obj is set, link it in.
11699         * configure.tgt: Initialize all variables.
11700         (x86_64*): Set targ_extra_obj and targ_extra_size.
11701         * configure: Rebuild.
11702
11703         * object.cc (Sized_relobj::include_section_group): Adjust section
11704         indexes read from group data.  Build vector to pass to
11705         layout_group.
11706         * layout.cc (Layout::layout_group): Add flags and shndxes
11707         parameters.  Remove contents parameter.  Change caller.  Update
11708         explicit instantiations.
11709         * layout.h (class Layout): Update layout_group declaration.
11710         * output.cc (Output_data_group::Output_data_group): Add flags and
11711         input_shndxes parameters.  Remove contents parameter.  Change
11712         caller.
11713         (Output_data_group::do_write): Change input_sections_ to
11714         input_shndxes_.
11715         * output.h (class Output_data_group): Update constructor
11716         declaration.  Rename input_sections_ to input_shndxes_.
11717         * testsuite/many_sections_test.cc: Add template.
11718
11719 2008-04-30  Cary Coutant  <ccoutant@google.com>
11720
11721         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11722
11723         * layout.cc (Layout::include_section): Refactored check for debug
11724         info section.
11725         (Layout::add_comdat): Add new parameters.  Change type
11726         of signature parameter.  Add object and shndx to signatures table.
11727         (Layout::find_kept_object): New function.
11728         * layout.h: Include <cstring>.
11729         (Layout::is_debug_info_section): New function.
11730         (Layout::add_comdat): Add new parameters.
11731         (Layout::find_kept_object): New function.
11732         (Layout::Kept_section): New struct.
11733         (Layout::Signatures): Change type of map range.
11734         * object.cc (Relobj::output_section_address): New function.
11735         (Sized_relobj::include_section_group): Add new parameters.  Change
11736         calls to Layout::add_comdat.  Change to build table of kept comdat
11737         groups and table mapping discarded sections to kept sections.
11738         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11739         (Sized_relobj::do_layout): Change calls to include_section_group and
11740         include_linkonce_section.
11741         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11742         value to zero when section is discarded.
11743         (Sized_relobj::map_to_kept_section): New function.
11744         * object.h (Relobj::output_section_address): New function.
11745         (Relobj::Comdat_group): New type.
11746         (Relobj::find_comdat_group): New function.
11747         (Relobj::Comdat_group_table): New type.
11748         (Relobj::Kept_comdat_section): New type.
11749         (Relobj::Kept_comdat_section_table): New type.
11750         (Relobj::add_comdat_group): New function.
11751         (Relobj::set_kept_comdat_section): New function.
11752         (Relobj::get_kept_comdat_section): New function.
11753         (Relobj::comdat_groups_): New field.
11754         (Relobj::kept_comdat_sections_): New field.
11755         (Symbol_value::input_value): Update comment.
11756         (Sized_relobj::map_to_kept_section) New function.
11757         (Sized_relobj::include_linkonce_section): Add new parameter.
11758         * target-reloc.h (Comdat_behavior): New type.
11759         (get_comdat_behavior): New function.
11760         (relocate_section): Add code to map a discarded section to the
11761         corresponding kept section when applying a relocation.
11762
11763 2008-04-30  Craig Silverstein  <csilvers@google.com>
11764
11765         * dwarf_reader.cc (next_generation_count): New static var.
11766         (Addr2line_cache_entry): New struct.
11767         (addr2line_cache): New static var.
11768         (Dwarf_line_info::one_addr2line): Added caching.
11769         (Dwarf_line_info::clear_addr2line_cache): New function.
11770         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11771         cache-size parameter.
11772         (Dwarf_line_info::one_addr2line_cache): New function.
11773         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11774         new cache-size argument to one_addr2line(), and clear cache.
11775
11776 2008-04-28  Cary Coutant  <ccoutant@google.com>
11777
11778         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11779         R_386_PC8 relocations.
11780
11781 2008-04-23  Ian Lance Taylor  <iant@google.com>
11782
11783         * object.cc (Sized_relobj::include_section_group): Check for
11784         invalid section group.
11785
11786         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11787         header size.
11788
11789         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11790         than read for file header.
11791         * archive.cc (Archive::include_member): Likewise.
11792
11793 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11794
11795         * aclocal.m4: Regenerate.
11796         * configure: Regenerate.
11797
11798 2008-04-19  Ian Lance Taylor  <iant@google.com>
11799
11800         * version.cc (version_string): Bump to 1.6.
11801
11802         * testsuite/Makefile.am (many_sections_r_test): New target.
11803         (many_sections_r_test_SOURCES): Remove.
11804         (many_sections_r_test_DEPENDENCIES): Remove.
11805         (many_sections_r_test_LDFLAGS): Remove.
11806         (many_sections_r_test_LDADD): Remove.
11807
11808         * object.cc (Sized_relobj::do_add_symbols): Always pass
11809         local_symbol_count_ to add_from_relobj.
11810
11811         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11812         every thousand variables.
11813         * testsuite/Makefile.in: Rebuild.
11814
11815         * object.cc (Xindex::initialize_symtab_xindex): New function.
11816         (Xindex::read_symtab_xindex): New function.
11817         (Xindex::sym_xindex_to_shndx): New function.
11818         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11819         available.
11820         (Sized_relobj::do_initialize_xindex): New function.
11821         (Sized_relobj::do_read_symbols): Adjust section links.
11822         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11823         parameter.  Change all callers.
11824         (Sized_relobj::include_section_group): Adjust section links and
11825         symbol section indexes.
11826         (Sized_relobj::do_layout): Adjust section links.
11827         (Sized_relobj::do_count_local_symbols): Adjust section links and
11828         symbol section indexes.
11829         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11830         ordinary and special symbols.
11831         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11832         dynsym_xindex parameters.  Change all callers.  Adjust section
11833         links.  Use SHN_XINDEX when needed.
11834         (Sized_relobj::get_symbol_location_info): Adjust section links.
11835         Don't get fooled by special symbols.
11836         * object.h (class Xindex): Define.
11837         (class Object): Add xindex_ parameter.  Declare virtual functoin
11838         do_initialize_xindex.
11839         (Object::adjust_sym_shndx): New function.
11840         (Object::set_xindex): New protected function.
11841         (class Symbol_value): Add is_ordinary_shndx_ field.
11842         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11843         (Symbol_value::value): Assert ordinary section.
11844         (Symbol_value::initialize_input_to_output_map): Likewise.
11845         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11846         Change all callers.
11847         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11848         all callers.
11849         (class Sized_relobj): Update declarations.
11850         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11851         parameter.  Change all callers.
11852         (Sized_relobj::adjust_shndx): New function.
11853         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11854         field.
11855         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11856         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11857         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11858         (Sized_dynobj::read_dynsym_section): Adjust section links.
11859         (Sized_dynobj::read_dynamic): Likewise.
11860         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11861         section links.
11862         (Sized_dynobj::do_initialize_xindex): New function.
11863         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11864         do_initialize_xindex.
11865         (Sized_dynobj::adjust_shndx): New function.
11866         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11867         dynsym_xindex_ fields.
11868         (Layout::finalize): Add a call to set_section_indexes before
11869         creating the symtab sections.
11870         (Layout::set_section_indexes): Don't do anything if the section
11871         already has a section index.
11872         (Layout::create_symtab_sections): Add shnum parameter.  Change
11873         caller.  Create .symtab_shndx section if needed.
11874         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11875         caller.
11876         (Layout::allocated_output_section_count): New function.
11877         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11878         needed.
11879         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11880         fields.  Update declarations.
11881         (Layout::symtab_xindex): New function.
11882         (Layout::dynsym_xindex): New function.
11883         (class Write_symbols_task): Add layout_ field.
11884         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11885         Change caller.
11886         * output.cc (Output_section_headers::Output_section_headers): Add
11887         shstrtab_section parameter.  Change all callers.
11888         (Output_section_headers::do_sized_write): Store overflow values
11889         for section count and section string table section index in
11890         section header zero.
11891         (Output_file_header::do_sized_write): Check for overflow of
11892         section count and section string table section index.
11893         (Output_symtab_xindex::do_write): New function.
11894         (Output_symtab_xindex::endian_do_write): New function.
11895         * output.h (class Output_section_headers): Add shstrtab_section_.
11896         Update declarations.
11897         (class Output_symtab_xindex): Define.
11898         (Output_section::has_out_shndx): New function.
11899         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11900         field.
11901         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11902         Change all callers.
11903         (Sized_symbol::init): Likewise.
11904         (Symbol::output_section): Check for ordinary symbol.
11905         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11906         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11907         callers.
11908         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11909         Change all callers.  Simplify handling of symbols from sections
11910         not included in the link.
11911         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11912         distinction.
11913         (Weak_alias_sorter::operator()): Assert that symbols are
11914         ordinary.
11915         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11916         distinction.
11917         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11918         parameters.  Change all callers.
11919         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11920         symbol distinction.  Use SHN_XINDEX when needed.
11921         (Symbol_table::write_section_symbol): Add symtab_xindex
11922         parameter.  Change all callers.
11923         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11924         SHN_XINDEX when needed.
11925         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11926         declarations.
11927         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11928         (Symbol::is_defined): Check is_ordinary.
11929         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11930         (Symbol::is_absolute, Symbol::is_common): Likewise.
11931         (class Sized_symbol): Update declarations.
11932         (class Symbol_table): Update declarations.
11933         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11934         parameters.  Change all callers.
11935         (Sized_symbol::override): Likewise.
11936         (Symbol_table::override): Likewise.
11937         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11938         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11939         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11940         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11941         to be in an ordinary section.
11942         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11943         object and is_ordinary parameters.  Change all callers.
11944         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11945         Change all callers.  Don't add undefined or non-ordinary symbols
11946         to reloc_map_.
11947         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11948         Change all callers.
11949         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11950         declarations.
11951         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11952         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11953         (Sized_relobj::relocate_sections): Likewise.
11954         * target-reloc.h (scan_relocs): Adjust section symbol index.
11955         (scan_relocatable_relocs): Likewise.
11956         * i386.cc (Scan::local): Check for ordinary symbols.
11957         * sparc.cc (Scan::local): Likewise.
11958         * x86_64.cc (Scan::local): Likewise.
11959         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11960         to symbol_section_and_value.
11961         * testsuite/many_sections_test.cc: New file.
11962         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11963         (check_PROGRAMS): Add many_sections_test.
11964         (many_sections_test_SOURCES): Define.
11965         (many_sections_test_DEPENDENCIES): Define.
11966         (many_sections_test_LDFLAGS): Define.
11967         (BUILT_SOURCES): Add many_sections_define.h.
11968         (many_sections_define.h): New target.
11969         (BUILT_SOURCES): Add many_sections_check.h.
11970         (many_sections_check.h): New target.
11971         (check_PROGRAMS): Add many_sections_r_test.
11972         (many_sections_r_test_SOURCES): Define.
11973         (many_sections_r_test_DEPENDENCIES): Define.
11974         (many_sections_r_test_LDFLAGS): Define.
11975         (many_sections_r_test_LDADD): Define.
11976         (many_sections_r_test.o): New target.
11977         * testsuite/Makefile.in: Rebuild.
11978
11979 2008-04-17  Cary Coutant  <ccoutant@google.com>
11980
11981         * errors.cc (Errors::info): New function.
11982         (gold_info): New function.
11983         * errors.h (Errors::info): New function.
11984         * gold.h (gold_info): New function.
11985         * object.cc (Input_objects::add_object): Print trace output.
11986         * options.cc (options::parse_set): New function.
11987         (General_options::parse_wrap): Deleted.
11988         (General_options::General_options): Deleted initializer.
11989         * options.h (options::String_set): New typedef.
11990         (options::parse_set): New function.
11991         (DEFINE_set): New macro.
11992         (General_options::wrap): Changed to use DEFINE_set. Changed
11993         callers of any_wrap_symbols and is_wrap_symbol.
11994         (General_options::trace, General_options::trace_symbol):
11995         New options.
11996         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11997         (General_options::wrap_symbols_): Deleted.
11998         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11999
12000 2008-04-17  David S. Miller  <davem@davemloft.net>
12001
12002         * options.cc (General_options::parse_V): New function.
12003         * options.h: Add entries for -V and -Qy.
12004
12005 2008-04-17  Ian Lance Taylor  <iant@google.com>
12006
12007         * common.cc (Symbol_table::allocate_commons): Remove options
12008         parameter.  Change caller.
12009         (Symbol_table::do_allocate_commons): Remove options parameter.
12010         Change caller.  Just call do_allocate_commons_list twice.
12011         (Symbol_table::do_allocate_commons_list): New function, broken out
12012         of do_allocate_commons.
12013         * common.h (class Allocate_commons_task): Remove options_ field.
12014         Update constructor.
12015         * symtab.cc (Symbol_table::Symbol_table): Initialize
12016         tls_commons_.
12017         (Symbol_table::add_from_object): Put TLS common symbols on
12018         tls_commons_ list.
12019         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12020         which are IN_OUTPUT_DATA.
12021         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12022         allocate_commons and do_allocate_commons declarations.  Declare
12023         do_allocate_commons_list.
12024         * gold.cc (queue_middle_tasks): Update creation of
12025         Allocate_commons_task to not pass options.
12026         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12027         (TLS_TEST_C_FLAGS): New variable.
12028         (tls_test_c_pic.o): New target.
12029         (tls_test_shared.so): Link in tls_test_c_pic.o.
12030         (tls_test_c_pic_ie.o): New target.
12031         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12032         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12033         (tls_test_c.o): New target.
12034         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12035         (tls_pic_test_LDADD): Likewise.
12036         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12037         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12038         (tls_test_c_gnu2.o): New target.
12039         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12040         tls_test_c_gnu2.o.
12041         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12042         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12043         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12044         * testsuite/tls_test.cc: Include "config.h".
12045         (t_last): Call t11_last.
12046         * testsuite/tls_test.h (t11, t11_last): Declare.
12047         * testsuite/tls_test_c.c: New file.
12048         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12049         * configure.ac: Check for OpenMP support.
12050         * configure, config.in, Makefile.in: Rebuild.
12051         * testsuite/Makefile.in: Rebuild.
12052
12053 2008-04-16  Cary Coutant  <ccoutant@google.com>
12054
12055         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12056         (Target_i386::tls_base_symbol_defined_): New field.
12057         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12058         (Target_i386::Scan::global): Likewise.
12059         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12060         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12061         (Target_x86_64::tls_base_symbol_defined_): New field.
12062         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12063         (Target_x86_64::Scan::global): Likewise.
12064
12065 2008-04-16  Cary Coutant  <ccoutant@google.com>
12066
12067         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12068         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12069         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12070         building shared libraries.
12071         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12072         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12073         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12074         * testsuite/Makefile.in: Rebuild.
12075         * testsuite/weak_undef.h: New file.
12076         * testsuite/weak_undef_file1.cc: Add extra test cases.
12077         * testsuite/weak_undef_file2.cc: Likewise.
12078         * testsuite/weak_undef_test.cc: Likewise.
12079
12080 2008-04-16  David S. Miller  <davem@davemloft.net>
12081
12082         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12083         Add issued_non_pic_error_ field.  Declare check_non_pic.
12084         (Target_sparc::Scan::check_non_pic): New function.
12085         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12086         (Target_sparc::Scan::global): Likewise.
12087
12088         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12089         * configure: Rebuild.
12090
12091         * options.h (DEFINE_enable): New macro.
12092         (new_dtags): New enable option.
12093         (initfirst, interpose, loadfltr, nodefaultlib,
12094         nodelete, nodlopen, nodump): New -z options.
12095         * layout.cc (Layout:finish_dynamic_section): If new
12096         dtags enabled, emit DT_RUNPATH.  Also, emit a
12097         DT_FLAGS_1 containing any specified -z flags.
12098
12099 2008-04-16  Ian Lance Taylor  <iant@google.com>
12100
12101         * copy-relocs.cc: New file.
12102         * copy-relocs.h: New file.
12103         * reloc.cc: Remove Copy_relocs code.
12104         * reloc.h: Likewise.
12105         * reloc-types.h (struct Reloc_types) [both versions]: Add
12106         get_reloc_addend_noerror.
12107         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12108         variants of add_global which take an addend which must be zero.
12109         * i386.cc: Include "copy-relocs.h".
12110         (class Target_i386): Change type of copy_relocs_ to variable,
12111         update initializer.
12112         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12113         Change all callers.
12114         (Target_i386::do_finalize_sections): Change handling of
12115         copy_relocs_.
12116         * sparc.cc: Include "copy-relocs.h".
12117         (class Target_sparc): Change type of copy_relocs_ to variable,
12118         update initializer.
12119         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12120         Change all callers.
12121         (Target_sparc::do_finalize_sections): Change handling of
12122         copy_relocs_.
12123         * x86_64.cc: Include "copy-relocs.h".
12124         (class Target_x86_64): Change type of copy_relocs_ to variable,
12125         update initializer.
12126         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12127         class.  Change all callers.
12128         (Target_x86_64::do_finalize_sections): Change handling of
12129         copy_relocs_.
12130         * Makefile.am (CCFILES): Add copy-relocs.cc.
12131         (HFILES): Add copy-relocs.h.
12132
12133         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12134
12135         * testsuite/script_test_4.sh: Permit leading zeroes.
12136
12137 2008-04-15  Ian Lance Taylor  <iant@google.com>
12138
12139         * script-sections.cc (Script_sections::create_segments): Use
12140         header_size_adjustment even when there is enough room for the
12141         headers.
12142         * testsuite/script_test_4.sh: New file.
12143         * testsuite/script_test_4.t: New file.
12144         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12145         (check_DATA): Add script_test_4.stdout.
12146         (MOSTLYCLEANFILES): Likewise.
12147         (script_test_4): New target.
12148         (script_test_4.stdout): New target.
12149         * testsuite/Makefile.in: Rebuild.
12150
12151         * sparc.cc: Add definitions for Output_data_plt_sparc class
12152         constants.
12153
12154 2008-04-14  David S. Miller  <davem@davemloft.net>
12155
12156         * sparc.cc: New file.
12157         * Makefile.am (TARGETSOURCES): Add sparc.cc
12158         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12159         * configure.tgt: Document targ_extra_size and
12160         targ_extra_big_endian.  Add entries for sparc-* and
12161         sparc64-*.
12162         * configure.ac: Handle targ_extra_size and
12163         targ_extra_big_endian.
12164         * Makefile.in: Rebuild.
12165         * configure: Likewise.
12166         * po/POTFILES.in: Likewise.
12167         * po/gold.pot: Likewise.
12168
12169 2008-04-14  Ian Lance Taylor  <iant@google.com>
12170
12171         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12172         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12173         in the name/type/flags to section mapping.  Don't call
12174         allocate_output_section.
12175         (Layout::choose_output_section): Change parameter from adjust_name
12176         to is_input_section.  Don't permit input sections after sections
12177         are attached to segments.  Don't call allocate_output_section.
12178         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12179         not write_enable_output_section.
12180         (Layout::make_output_section): Don't push to
12181         unattached_section_list_ nor call attach_to_segment.  Call
12182         attach_section_to_segment if sections are attached.
12183         (Layout::attach_sections_to_segments): New function.
12184         (Layout::attach_section_to_segment): New function.
12185         (Layout::attach_allocated_section_to_segment): Rename from
12186         attach_to_segment.  Remove flags parameter.
12187         (Layout::allocate_output_section): Remove function.
12188         (Layout::write_enable_output_section): Remove function.
12189         * layout.h (class Layout): Update for above changes.  Add new
12190         field sections_are_attached_.
12191         * output.h (Output_section::update_flags_for_input_section): New
12192         function.
12193         * output.cc (Output_section::add_input_section): Call
12194         update_flags_for_input_section.
12195         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12196
12197 2008-04-11  Cary Coutant  <ccoutant@google.com>
12198
12199         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12200         thought unnecessary.
12201         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12202
12203 2008-04-11  Ian Lance Taylor  <iant@google.com>
12204
12205         * output.h (class Output_section_data): Remove inline definition
12206         of set_addralign.
12207         * output.cc (Output_section_data::set_addralign): New function.
12208
12209 2008-04-11  Cary Coutant  <ccoutant@google.com>
12210
12211         Add support for TLS descriptors for i386 and x86_64.
12212         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12213         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12214         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12215         GOT_TYPE_TLS_DESC.
12216         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12217         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12218         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12219         relocations.
12220         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12221         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12222         Fix problem with initial-exec relocations.
12223         (Target_i386::Relocate::relocate_tls): Likewise.
12224         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12225         relaxation.
12226         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12227         support for section-plus-offset dynamic table entries.
12228         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12229         (Output_data_dynamic::Dynamic_entry): Add support for
12230         section-plus-offset dynamic table entries.
12231         (Output_data_dynamic::Classification): Likewise.
12232         (Output_data_dynamic::classification_): Renamed offset_.
12233         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12234         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12235         (Target_x86_64::make_plt_section): New function.
12236         (Target_x86_64::reserve_tlsdesc_entries): New function.
12237         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12238         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12239         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12240         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12241         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12242         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12243         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12244         add extra PLT entry for TLS descriptors.
12245         (Output_data_plt_x86_64::got_): New field.
12246         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12247         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12248         fields.
12249         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12250         descriptors.
12251         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12252         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12253         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12254         R_386_TLS_DESC_CALL relocations.
12255         (Target_x86_64::Scan::global): Likewise.
12256         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12257         for TLS descriptors.
12258         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12259         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12260         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12261         GD-to-IE relaxation.
12262         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12263         and TLS_DESCRIPTORS.
12264         * Makefile.in: Rebuild.
12265         * configure: Rebuild.
12266         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12267         (tls_test_shared2.so): New target.
12268         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12269         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12270         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12271         (tls_shared_gd_to_ie_test_LDADD): New variable.
12272         (tls_shared_gnu2_gd_to_ie_test): New target.
12273         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12274         New targets.
12275         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12276         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12277         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12278         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12279         (tls_shared_gnu2_test): New target.
12280         (tls_test_gnu2_shared.so): New target.
12281         (tls_shared_gnu2_test_SOURCES): New variable.
12282         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12283         (tls_shared_gnu2_test_LDFLAGS): New variable.
12284         (tls_shared_gnu2_test_LDADD): New variable.
12285         * testsuite/Makefile.in: Rebuild.
12286         * testsuite/Makefile.
12287
12288 2008-04-11  Ian Lance Taylor  <iant@google.com>
12289
12290         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12291         justsyms.t.
12292         * testsuite/Makefile.in: Rebuild.
12293
12294         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12295         long.
12296         * testsuite/script_test_2.cc (main): Adjust test.
12297
12298 2008-04-11  David S. Miller  <davem@davemloft.net>
12299             Ian Lance Taylor  <iant@google.com>
12300
12301         * options.h (General_options): Add entries for '-Y' and
12302         '-relax'.
12303         * options.cc (General_options:finalize): If -Y was used, add those
12304         entries to the library path instead of the default "/lib" and
12305         "/usr/lib".
12306
12307 2008-04-11  David S. Miller  <davem@davemloft.net>
12308
12309         * testsuite/justsyms.t: Start at 0x100.
12310         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12311         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12312         long.
12313         * testsuite/script_test_2.cc: Adjust string and section length
12314         checks.
12315
12316 2008-04-09  Ian Lance Taylor  <iant@google.com>
12317
12318         PR gold/5996
12319         * script-sections.cc (Sections_element::allocate_to_segment): Add
12320         orphan parameter.
12321         (Output_section_definition::allocate_to_segment): Likewise.
12322         (Orphan_output_section::allocate_to_segment): Likewise.
12323         (Script_sections::attach_sections_using_phdrs_clause): Don't
12324         propagate non-PT_LOAD segments to orphan sections.
12325         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12326         readelf rather than objdump.
12327         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12328         .interp section and PT_INTERP segment are the same size.
12329         * testsuite/Makefile.in: Rebuild.
12330
12331         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12332         aliases for symbols defined in the same object.
12333         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12334         (weak_alias_test_SOURCES): New variable.
12335         (weak_alias_test_DEPENDENCIES): New variable.
12336         (weak_alias_test_LDFLAGS): New variable.
12337         (weak_alias_test_LDADD): New variable.
12338         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12339         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12340         (weak_alias_test_3.o): New target.
12341         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12342         * testsuite/weak_alias_test_main.cc: New file.
12343         * testsuite/weak_alias_test_1.cc: New file.
12344         * testsuite/weak_alias_test_2.cc: New file.
12345         * testsuite/weak_alias_test_3.cc: New file.
12346
12347 2008-04-08  Ian Lance Taylor  <iant@google.com>
12348
12349         * options.h (class General_options): Add --noinhibit-exec option.
12350         * main.cc (main): Check --noinhibit-exec.
12351
12352         * options.h (class General_options): Define --wrap as a special
12353         option.  Add wrap_symbols_ field.
12354         (General_options::any_wrap_symbols): New function.
12355         (General_options::is_wrap_symbol): New function.
12356         * options.cc (General_options::parse_wrap): New function.
12357         (General_options::General_options): Initialize wrap_symbols_.
12358         * symtab.cc (Symbol_table::wrap_symbol): New function.
12359         (Symbol_table::add_from_object): Handle --wrap.
12360         * symtab.h (class Symbol_table): Declare wrap_symbol.
12361         * target.h (Target::wrap_char): New function.
12362         (Target::Target_info): Add wrap_char field.
12363         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12364         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12365         * testsuite/testfile.cc (Target_test::test_target_info):
12366         Likewise.
12367
12368         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12369         there is one.
12370
12371         * layout.h (class Layout): Add added_eh_frame_data_ field.
12372         * layout.cc (Layout::Layout): Initialize new field.
12373         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12374         output section until we find a section we merged successfully.
12375         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12376         that the size be non-zero.
12377
12378         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12379         qualifier.
12380
12381 2008-04-08  Craig Silverstein  <csilvers@google.com>
12382
12383         * configure.ac: Export new conditional variable HAVE_ZLIB.
12384         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12385         on HAVE_ZLIB.
12386         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12387         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12388
12389 2008-04-07  Ian Lance Taylor  <iant@google.com>
12390
12391         * version.cc (version_string): Set to "1.5".
12392
12393         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12394         Add issued_non_pic_error_ field.  Declare check_non_pic.
12395         (Target_x86_64::Scan::check_non_pic): New function.
12396         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12397         (Target_x86_64::Scan::global): Likewise.
12398
12399         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12400         addend parameter.  Change caller.  Handle merge sections.
12401         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12402         Address to Addend.  Don't add in the result of
12403         local_section_offset, pass down the addend and use the returned
12404         value.
12405         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12406         Update declarations of local_section_offset and symbol_value.
12407         * testsuite/two_file_test_1.cc (t18): New function.
12408         * testsuite/two_file_test_2.cc (f18): New function.
12409         * testsuite/two_file_test_main.cc (main): Call t18.
12410         * testsuite/two_file_test.h (t18, f18): Declare.
12411
12412         * configure.ac: Don't test for objdump, c++filt, or readelf.
12413         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12414         conditionals.
12415         (TEST_READELF): New variable.
12416         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12417         (check_PROGRAMS): Add two_file_strip_test.
12418         (two_file_strip_test): New target.
12419         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12420         (two_file_same_shared_strip_test_SOURCES): New variable.
12421         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12422         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12423         (two_file_same_shared_strip_test_LDADD): New variable.
12424         (two_file_shared_strip.so): New target.
12425         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12426         (ver_test_5.syms, ver_test_7.syms): Likewise.
12427         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12428         (strip_test_3.stdout): Use TEST_OBJDUMP.
12429         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12430
12431 2008-04-04  Cary Coutant  <ccoutant@google.com>
12432
12433         * symtab.h (Symbol::is_weak_undefined): New function.
12434         (Symbol::is_strong_undefined): New function.
12435         (Symbol::is_absolute): New function.
12436         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12437         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12438         absolute symbols.
12439         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12440         (weak_undef_test): New target.
12441         * testsuite/Makefile.in: Rebuild.
12442         * testsuite/weak_undef_file1.cc: New file.
12443         * testsuite/weak_undef_file2.cc: New file.
12444         * testsuite/weak_undef_test.cc: New file.
12445
12446 2008-04-03  Craig Silverstein  <csilvers@google.com>
12447
12448         * compressed_output.h (class Output_compressed_section): Use
12449         unsigned buffer.
12450         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12451         add zlib header.
12452         (zlib_compressed_suffix): Removed.
12453         (Output_compressed_section::set_final_data_size): Use unsigned
12454         buffers.
12455         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12456         Fix linker invocation.
12457         (flagstest_o_specialfile_and_compress_debug_sections):
12458         Likewise.
12459         * testsuite/Makefile.in: Regenerated.
12460
12461 2008-04-02  David S. Miller  <davem@davemloft.net>
12462
12463         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12464         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12465
12466 2008-04-02  Craig Silverstein  <csilvers@google.com>
12467
12468         * TODO: New file.
12469
12470 2008-04-02  Ian Lance Taylor  <iant@google.com>
12471
12472         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12473         parameters.  Update for new key type to views_.  Change all
12474         callers.
12475         (File_read::read): Adjust for byteshift in returned view.
12476         (File_read::add_view): New function, broken out of
12477         find_and_make_view.
12478         (File_read::make_view): New function, broken out of
12479         find_and_make_view.
12480         (File_read::find_or_make_view): Add offset and aligned
12481         parameters.  Rewrite accordingly.  Change all callers.
12482         (File_read::get_view): Add offset and aligned parameters.  Adjust
12483         for byteshift in return value.
12484         (File_read::get_lasting_view): Likewise.
12485         * fileread.h (class File_read): Update declarations.
12486         (class File_read::View): Add byteshift_ field.  Add byteshift to
12487         constructor.  Add byteshift method.
12488         * archive.h (Archive::clear_uncached_views): New function.
12489         (Archive::get_view): Add aligned parameter.  Change all callers.
12490         * object.h (Object::get_view): Add aligned parameter.  Change all
12491         callers.
12492         (Object::get_lasting_view): Likewise.
12493
12494         * fileread.cc (File_read::release): Don't call clear_views if
12495         there are multiple objects.
12496         * fileread.h (File_read::clear_uncached_views): New function.
12497         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12498         on the archive.
12499
12500 2008-03-31  Cary Coutant  <ccoutant@google.com>
12501
12502         Add thin archive support.
12503         * archive.cc (Archive::armagt): New const.
12504         (Archive::setup): Remove task parameter and calls to unlock.
12505         (Archive::unlock_nested_archives): New function.
12506         (Archive::read_header): Add nested_off parameter. Change
12507         all callers.
12508         (Archive::interpret_header): Likewise.
12509         (Archive::include_all_members): Change to handle thin
12510         archives.
12511         (Archive::include_member): Likewise.
12512         * archive.h (Archive::Archive): Add new parameters and
12513         initializers.
12514         (Archive::armagt): New const.
12515         (Archive::setup): Remove task parameter.
12516         (Archive::unlock_nested_archives): New function.
12517         (Archive::read_header): Add nested_off parameter.
12518         (Archive::interpret_header): Likewise.
12519         (Archive::Nested_archive_table): New typedef.
12520         (Archive::is_thin_archive_): New field.
12521         (Archive::nested_archives_): New field.
12522         (Archive::options_): New field.
12523         (Archive::dirpath_): New field.
12524         (Archive::task_): New field.
12525         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12526         for thin archives.  Pass additional parameters to
12527         Archive::Archive.  Unlock the archive file after calling
12528         Archive::setup.
12529
12530 2008-03-29  Ian Lance Taylor  <iant@google.com>
12531
12532         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12533         version symbol to be local.
12534         * testsuite/ver_test_4.sh: New file.
12535         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12536         (check_DATA): Add ver_test_4.syms.
12537         (ver_test_4.syms): New target.
12538         * testsuite/Makefile.in: Rebuild.
12539
12540         * output.cc
12541         (Output_section::Input_section_sort_entry::has_priority): New
12542         function.
12543         (Output_section::Input_section_sort_entry::match_file_name): New
12544         function.
12545         (Output_section::Input_section_sort_entry::match_section_name):
12546         Remove.
12547         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12548         Remove.
12549         (Output_section::Input_section_sort_entry::match_section_file):
12550         Remove.
12551         (Output_section::Input_section_sort_compare::operator()): Rewrite
12552         using new Input_section_sort_entry functions.  Sort crtbegin and
12553         crtend first.  Sort sections with no priority before sections with
12554         a priority.
12555         * testsuite/initpri1.c (d3): Check j != 4.
12556         (cd5): New constructor/destructor function.
12557         (main): Check j != 2.
12558
12559         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12560         new symbol when resolving, don't call set_is_default.
12561         * testsuite/ver_test_7.cc: New file.
12562         * testsuite/ver_test_7.sh: New file.
12563         * testsuite/Makefile.am (ver_test_7.so): New target.
12564         (ver_test_7.o): New target.
12565         (check_SCRIPTS): Add ver_test_7.sh.
12566         (check_DATA): Add ver_test_7.syms.
12567         (ver_test_7.syms): New target.
12568
12569 2008-03-28  Ian Lance Taylor  <iant@google.com>
12570
12571         * layout.cc (Layout::layout): If we see an input section with a
12572         name that needs sorting, set the must_sort flag for the output
12573         section.
12574         (Layout::make_output_section): If the name of the output section
12575         indicates that it might require sorting, set the may_sort flag.
12576         * output.h (Output_section::may_sort_attached_input_sections): New
12577         function.
12578         (Output_section::set_may_sort_attached_input_sections): New
12579         function.
12580         (Output_section::must_sort_attached_input_sections): New
12581         function.
12582         (Output_section::set_must_sort_attached_input_sections): New
12583         function.
12584         (class Output_section): Declare Input_section_sort_entry.  Define
12585         Input_section_sort_compare.  Declare
12586         sort_attached_input_sections.  Add new fields:
12587         may_sort_attached_input_sections_,
12588         must_sort_attached_input_sections_,
12589         attached_input_sections_are_sorted_.
12590         * output.cc (Output_section::Output_section): Initialize new
12591         fields.
12592         (Output_section::add_input_section): Add an entry to
12593         input_sections_ if may_sort or must_sort are true.
12594         (Output_section::set_final_data_size): Call
12595         sort_attached_input_sections if necessary.
12596         (Output_section::Input_section_sort_entry): Define new class.
12597         (Output_section::Input_section_sort_compare::operator()): New
12598         function.
12599         (Output_section::sort_attached_input_sections): New function.
12600         * configure.ac: Check whether the compiler supports constructor
12601         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12602         * testsuite/initpri1.c: New file.
12603         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12604         CONSTRUCTOR_PRIORITY.
12605         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12606         (initpri1_LDFLAGS): New variable.
12607         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12608
12609 2008-03-27  Ian Lance Taylor  <iant@google.com>
12610
12611         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12612         * testsuite/common_test_1.c: New file.
12613         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12614         (common_test_1_SOURCES): New variable.
12615         (common_test_1_DEPENDENCIES): New variable.
12616         (common_test_1_LDFLAGS): New variable.
12617
12618         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12619         and commons_ correctly when NAME/VERSION does not override
12620         NAME/NULL.
12621         * testsuite/ver_test_6.c: New file.
12622         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12623         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12624         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12625
12626 2008-03-26  Ian Lance Taylor  <iant@google.com>
12627
12628         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12629         of an undefined symbol from a version script.
12630         * testsuite/Makefile.am (ver_test_5.so): New target.
12631         (ver_test_5.o): New target.
12632         (check_SCRIPTS): Add ver_test_5.sh.
12633         (check_DATA): Add ver_test_5.syms.
12634         (ver_test_5.syms): New target.
12635         * testsuite/ver_test_5.cc: New file.
12636         * testsuite/ver_test_5.script: New file.
12637         * testsuite/ver_test_5.sh: New file.
12638         * Makefile.in, testsuite/Makefile.in: Rebuild.
12639
12640         PR gold/5986
12641         Fix problems building gold with gcc 4.3.0.
12642         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12643         (gold_error_at_location, gold_warning_at_location): Use it.
12644         * configure.ac: Check whether we can compile and use a template
12645         function with a printf attribute.
12646         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12647         when jumping over bytes.
12648         * object.cc: Instantiate Object::read_section_data.
12649         * debug.h: Include <cstring>
12650         * dwarf_reader.cc: Include <algorithm>
12651         * main.cc: Include <cstring>.
12652         * options.cc: Include <cstring>.
12653         * output.cc: Include <cstring>.
12654         * script.cc: Include <cstring>.
12655         * script.h: Include <string>.
12656         * symtab.cc: Include <cstring> and <algorithm>.
12657         * target-select.cc: Include <cstring>.
12658         * version.cc: Include <string>.
12659         * testsuite/testmain.cc: Include <cstdlib>.
12660         * configure, config.in: Rebuild.
12661
12662 2008-03-25  Ian Lance Taylor  <iant@google.com>
12663
12664         * options.cc: Include "../bfd/bfdver.h".
12665         (options::help): Print bug reporting address.
12666
12667         * version.cc (print_version): Adjust output for current value of
12668         BFD_VERSION_STRING.
12669
12670         * NEWS: New file.
12671
12672         * options.cc (options::help): Print list of supported targets.
12673         * target-select.h: Include <vector>.
12674         (class Target_selector): Make machine_, size_, and is_big_endian_
12675         fields const.  Add bfd_name_ and instantiated_target_ fields.
12676         (Target_selector::Target_selector): Add bfd_name parameter.
12677         (Target_selector::recognize): Make non-virtual, call
12678         do_recognize.
12679         (Target_selector::recognize_by_name): Make non-virtual, call
12680         do_recognize_by_name.
12681         (Target_selector::supported_names): New function.
12682         (Target_selector::bfd_name): New function.
12683         (Target_selector::do_instantiate_target): New pure virtual
12684         function.
12685         (Target_selector::do_recognize): New virtual function.
12686         (Target_selector::do_recognize_by_name): New virtual function.
12687         (Target_selector::instantiate_target): New private function.
12688         (supported_target_names): Declare.
12689         * target-select.cc (Target_selector::Target_selector): Update for
12690         new parameter and fields.
12691         (select_target_by_name): Check that the name matches before
12692         calling recognize_by_name.
12693         (supported_target_names): New function.
12694         * i386.cc (class Target_selector_i386): Update Target_selector
12695         constructor call.  Remove recognize and recognize_by_name.  Add
12696         do_instantiate_target.
12697         * x86_64.cc (class Target_selector_x86_64): Likewise.
12698         * testsuite/testfile.cc (class Target_selector_test): Update for
12699         changes to Target_selector.
12700
12701         * README: Rewrite, with some notes on unsupported features.
12702
12703 2008-03-24  Cary Coutant  <ccoutant@google.com>
12704
12705         * i386.cc (Target_i386::Got_type): New enum declaration.
12706         (Target_i386::Scan::local): Updated callers of Output_data_got
12707         member functions.
12708         (Target_i386::Scan::global): Likewise.
12709         (Target_i386::Relocate::relocate): Likewise.
12710         (Target_i386::Relocate::relocate_tls): Likewise.
12711         * object.h (Got_offset_list): New class.
12712         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12713         (Sized_relobj::local_got_offset): Likewise.
12714         (Sized_relobj::set_local_got_offset): Likewise.
12715         (Sized_relobj::local_has_tls_got_offset): Removed.
12716         (Sized_relobj::local_tls_got_offset): Removed.
12717         (Sized_relobj::set_local_tls_got_offset): Removed.
12718         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12719         * output.cc (Output_data_got::add_global): Added got_type parameter.
12720         (Output_data_got::add_global_with_rel): Likewise.
12721         (Output_data_got::add_global_with_rela): Likewise.
12722         (Output_data_got::add_global_pair_with_rel): New function.
12723         (Output_data_got::add_global_pair_with_rela): New function.
12724         (Output_data_got::add_local): Added got_type parameter.
12725         (Output_data_got::add_local_with_rel): Likewise.
12726         (Output_data_got::add_local_with_rela): Likewise.
12727         (Output_data_got::add_local_pair_with_rel): New function.
12728         (Output_data_got::add_local_pair_with_rela): New function.
12729         (Output_data_got::add_global_tls): Removed.
12730         (Output_data_got::add_global_tls_with_rel): Removed.
12731         (Output_data_got::add_global_tls_with_rela): Removed.
12732         (Output_data_got::add_local_tls): Removed.
12733         (Output_data_got::add_local_tls_with_rel): Removed.
12734         (Output_data_got::add_local_tls_with_rela): Removed.
12735         * output.h (Output_data_got::add_global): Added got_type parameter.
12736         (Output_data_got::add_global_with_rel): Likewise.
12737         (Output_data_got::add_global_with_rela): Likewise.
12738         (Output_data_got::add_global_pair_with_rel): New function.
12739         (Output_data_got::add_global_pair_with_rela): New function.
12740         (Output_data_got::add_local): Added got_type parameter.
12741         (Output_data_got::add_local_with_rel): Likewise.
12742         (Output_data_got::add_local_with_rela): Likewise.
12743         (Output_data_got::add_local_pair_with_rel): New function.
12744         (Output_data_got::add_local_pair_with_rela): New function.
12745         (Output_data_got::add_global_tls): Removed.
12746         (Output_data_got::add_global_tls_with_rel): Removed.
12747         (Output_data_got::add_global_tls_with_rela): Removed.
12748         (Output_data_got::add_local_tls): Removed.
12749         (Output_data_got::add_local_tls_with_rel): Removed.
12750         (Output_data_got::add_local_tls_with_rela): Removed.
12751         * resolve.cc (Symbol::override_base_with_special): Removed
12752         reference to has_got_offset_ field.
12753         * symtab.cc (Symbol::init_fields): Replaced initialization
12754         of got_offset_ with got_offsets_.  Removed initialization
12755         of has_got_offset_
12756         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12757         (Symbol::got_offset): Likewise.
12758         (Symbol::set_got_offset): Likewise.
12759         (Symbol::has_tls_got_offset): Removed.
12760         (Symbol::tls_got_offset): Removed.
12761         (Symbol::set_tls_got_offset): Removed.
12762         (Symbol::got_offset_): Removed.
12763         (Symbol::tls_mod_got_offset_): Removed.
12764         (Symbol::tls_pair_got_offset_): Removed.
12765         (Symbol::got_offsets_): New field.
12766         (Symbol::has_got_offset): Removed.
12767         (Symbol::has_tls_mod_got_offset): Removed.
12768         (Symbol::has_tls_pair_got_offset): Removed.
12769         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12770         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12771         member functions.
12772         (Target_x86_64::Scan::global): Likewise.
12773         (Target_x86_64::Relocate::relocate): Likewise.
12774         (Target_x86_64::Relocate::relocate_tls): Likewise.
12775
12776 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12777
12778         * yyscript.y: Fix spelling error in comment.
12779
12780 2008-03-24  Ian Lance Taylor  <iant@google.com>
12781
12782         * options.h (class General_options): Define build_id option.
12783         * layout.h (class Layout): Declare write_build_id, create_note,
12784         create_build_id.  Add build_id_note_ member.
12785         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12786         "libiberty.h", "md5.h", "sha1.h".
12787         (Layout::Layout): Initialize eh_frame_data_,
12788         eh_frame_hdr_section_, and build_id_note_.
12789         (Layout::finalize): Call create_build_id.
12790         (Layout::create_note): New function, broken out of
12791         Layout::create_gold_note.
12792         (Layout::create_gold_note): Call create_note.
12793         (Layout::create_build_id): New function.
12794         (Layout::write_build_id): New function.
12795         (Close_task_runner::run): Call write_build_id.
12796
12797         * x86_64.cc: Correct license to GPLv3.
12798
12799 2008-03-23  Ian Lance Taylor  <iant@google.com>
12800
12801         * options.cc: Include "demangle.h".
12802         (parse_optional_string): New function.
12803         (parse_long_option): Handle takes_optional_argument.
12804         (parse_short_option): Update dash_z initializer.  Handle
12805         takes_optional_argument.
12806         (General_options::General_options): Initialize do_demangle_.
12807         (General_options::finalize): Set do_demangle_.  Handle demangling
12808         style.
12809         * options.h (parse_optional_string): Declare.
12810         (struct One_option): Add optional_arg field.  Update constructor.
12811         Update call constructor calls.  Add takes_optional_argument
12812         function.
12813         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12814         (DEFINE_optional_string): Define.
12815         (General_options::demangle): Change from DEFINE_bool to
12816         DEFINE_optional_string.
12817         (General_options::no_demangle): New function.
12818         (General_options::do_demangle): New function.
12819         (General_options::set_do_demangle): New function.
12820         (General_options::execstack_status_): Move definition to end of
12821         class definition.
12822         (General_options::static_): Likewise.
12823         (General_options::do_demangle_): New field.
12824         * object.cc (big_endian>::get_symbol_location_info): Call
12825         Options::do_demangle, not Options::demangle.
12826         * symtab.cc (demangle): Likewise.
12827
12828 2008-03-22  Ian Lance Taylor  <iant@google.com>
12829
12830         * gold.h: Include <cstddef> and <sys/types.h>
12831         * options.h: Include <cstring>.
12832
12833 2008-03-21  Ian Lance Taylor  <iant@google.com>
12834
12835         * Added source code to GNU binutils.