* gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
[external/binutils.git] / gold / ChangeLog
1 2012-04-09  Cary Coutant  <ccoutant@google.com>
2
3         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4         low_pc == 0.
5
6 2012-04-06  Ian Lance Taylor  <iant@google.com>
7
8         * timer.cc: #include <unistd.h>.
9
10 2012-04-06  Roland McGrath  <mcgrathr@google.com>
11
12         * configure.in (AC_CHECK_HEADERS): Add locale.h.
13         * config.in: Regenerate.
14         * configure: Regenerate.
15
16 2012-04-05  Nick Clifton  <nickc@redhat.com>
17
18         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
19         (AM_LC_MESSAGES): Add.
20         * aclocal.m4: Regenerate.
21         * config.in: Regenerate.
22         * configure: Regenerate.
23
24 2012-03-21  Cary Coutant  <ccoutant@google.com>
25
26         * Makefile.am: Add gdb-index.cc, gdb-index.h.
27         * Makefile.in: Regenerate.
28         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
29         (Sized_elf_reloc_mapper::symbol_section): New function.
30         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
31         (make_elf_reloc_mapper): New function.
32         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
33         (Dwarf_abbrev_table::do_read_abbrevs): New function.
34         (Dwarf_abbrev_table::do_get_abbrev): New function.
35         (Dwarf_ranges_table::read_ranges_table): New function.
36         (Dwarf_ranges_table::read_range_list): New function.
37         (Dwarf_pubnames_table::read_section): New function.
38         (Dwarf_pubnames_table::read_header): New function.
39         (Dwarf_pubnames_table::next_name): New function.
40         (Dwarf_die::Dwarf_die): New function.
41         (Dwarf_die::read_attributes): New function.
42         (Dwarf_die::skip_attributes): New function.
43         (Dwarf_die::set_name): New function.
44         (Dwarf_die::set_linkage_name): New function.
45         (Dwarf_die::attribute): New function.
46         (Dwarf_die::string_attribute): New function.
47         (Dwarf_die::int_attribute): New function.
48         (Dwarf_die::uint_attribute): New function.
49         (Dwarf_die::ref_attribute): New function.
50         (Dwarf_die::child_offset): New function.
51         (Dwarf_die::sibling_offset): New function.
52         (Dwarf_info_reader::check_buffer): New function.
53         (Dwarf_info_reader::parse): New function.
54         (Dwarf_info_reader::do_parse): New function.
55         (Dwarf_info_reader::do_read_string_table): New function.
56         (Dwarf_info_reader::lookup_reloc): New function.
57         (Dwarf_info_reader::get_string): New function.
58         (Dwarf_info_reader::visit_compilation_unit): New function.
59         (Dwarf_info_reader::visit_type_unit): New function.
60         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
61         Sized_elf_reloc_mapper.
62         (Sized_dwarf_line_info::symbol_section): Remove function.
63         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
64         (Sized_dwarf_line_info::read_line_mappings): Remove object
65         parameter, adjust callers.
66         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
67         * dwarf_reader.h: Include <sys/types.h>.
68         (class Track_relocs): Remove forward declaration.
69         (class Elf_reloc_mapper): New class.
70         (class Sized_elf_reloc_mapper): New class.
71         (class Dwarf_abbrev_table): New class.
72         (class Dwarf_range_list): New class.
73         (class Dwarf_ranges_table): New class.
74         (class Dwarf_pubnames_table): New class.
75         (class Dwarf_die): New class.
76         (class Dwarf_info_reader): New class.
77         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
78         (Sized_dwarf_line_info::symbol_section): Remove member function.
79         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
80         base class.
81         * gdb-index.cc: New source file.
82         * gdb-index.h: New source file.
83         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
84         and .debug_types sections, call Layout::add_to_gdb_index.
85         (Sized_relobj_incr::do_section_name): Implement.
86         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
87         return type; Implement.
88         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
89         return type.
90         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
91         parameter list and return type.
92         (Sized_incr_dynobj::do_section_contents): Likewise.
93         * layout.cc: Include gdb-index.h.
94         (Layout::Layout): Initialize gdb_index_data_.
95         (Layout::init_fixed_output_section): Check for .gdb_index section.
96         (Layout::add_to_gdb_index): New function. Instantiate.
97         * layout.h: Add forward declaration for class Gdb_index.
98         (Layout::add_to_gdb_index): New member function.
99         (Layout::gdb_index_data_): New data member.
100         * main.cc: Include gdb-index.h.
101         (main): Print statistics for gdb index.
102         * object.cc (Object::section_contents): Move code into
103         do_section_contents.
104         (need_decompressed_section): Check for sections needed when building
105         gdb index.
106         (build_compressed_section_map): Likewise.
107         (Sized_relobj_file::do_read_symbols): Need local symbols when building
108         gdb index.
109         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
110         sections; call Layout::add_to_gdb_index.
111         (Sized_relobj_file::do_decompressed_section_contents): Call
112         do_section_contents directly.
113         * object.h (Object::do_section_contents): Adjust parameter list and
114         return type.
115         (Object::do_decompressed_section_contents): Call do_section_contents
116         directly.
117         (Sized_relobj_file::do_section_contents): Adjust parameter list and
118         return type.
119         * options.h (class General_options): Add --gdb-index option.
120         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
121         list and return type.
122         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
123         * reloc.h (Track_relocs::checkpoint): New function.
124         (Track_relocs::reset): New function.
125
126         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
127         New test cases.
128         * testsuite/Makefile.in: Regenerate.
129         * testsuite/gdb_index_test.cc: New test source file.
130         * testsuite/gdb_index_test_1.sh: New test source file.
131         * testsuite/gdb_index_test_2.sh: New test source file.
132
133 2012-03-19  Doug Kwan  <dougkwan@google.com>
134
135         * arm.cc (Target_arm::do_define_standard_symbols): New method.
136         (Target_arm::do_finalize_sections): Remove code which defines
137         __exidx_start and __exidx_end.  Make symbol table parameter
138         anonymous as it is not used.
139         * gold.cc (queue_middle_tasks): Call target hook to define any
140         target-specific symbols.
141         * target.h (Target::define_standard_symbols): New method.
142         (Target::do_define_standard_symbols): Same.
143         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
144         * testsuite/Makefile.in: Regenerate.
145         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
146         and __exidx_end.
147         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
148         relocations are generated for __exidx_start and __exidx_end.
149
150 2012-03-16  Doug Kwan  <dougkwan@google.com>
151
152         * testsuite/Makefile.am: Disable test initpri3b.
153         * testsuite/Makefile.in: Regenerate.
154
155 2012-03-15  Doug Kwan  <dougkwan@google.com>
156
157         * arm.cc (Target_arm::got_section): Make .got section read-only
158         if -z now is given.
159
160 2012-03-15  Ian Lance Taylor  <iant@google.com>
161
162         PR gold/13850
163         * layout.cc (Layout::make_output_section): Correctly mark
164         SHT_INIT_ARRAY, et. al., as relro.
165
166 2012-03-14  Doug Kwan  <dougkwan@google.com>
167
168         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
169         dynamic relocations for protected symbols in shared objects.
170
171 2012-03-13  Ian Lance Taylor  <iant@google.com>
172
173         * resolve.cc (Symbol_table::resolve): When merging common symbols,
174         keep the larger alignment.
175
176 2012-03-12  Cary Coutant  <ccoutant@google.com>
177
178         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
179         handling of DW_LNE_define_file.
180
181 2012-03-12  Cary Coutant  <ccoutant@google.com>
182
183         * reduced_debug_output.cc
184         (Output_reduced_debug_info_section::get_die_end): Add new FORM
185         codes to switch.
186
187 2012-02-29  Cary Coutant  <ccoutant@google.com>
188
189         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
190
191 2012-02-29  Cary Coutant  <ccoutant@google.com>
192
193         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
194         Call Object::decompressed_section_contents.
195         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
196         New dtor.
197         (Sized_dwarf_line_info::buffer_start_): New data member.
198         * merge.cc (Output_merge_data::do_add_input_section): Call
199         Object::decompressed_section_contents.
200         (Output_merge_string::do_add_input_section): Likewise.
201         * object.cc (need_decompressed_section): New function.
202         (build_compressed_section_map): Decompress sections needed later.
203         (Sized_relobj_file::do_decompressed_section_contents): New function.
204         (Sized_relobj_file::do_discard_decompressed_sections): New function.
205         * object.h (Object::decompressed_section_contents): New function.
206         (Object::discard_decompressed_sections): New function.
207         (Object::do_decompressed_section_contents): New function.
208         (Object::do_discard_decompressed_sections): New function.
209         (Compressed_section_info): New type.
210         (Compressed_section_map): Include decompressed section contents.
211         (Sized_relobj_file::do_decompressed_section_contents): New function.
212         (Sized_relobj_file::do_discard_decompressed_sections): New function.
213
214 2012-02-16  Cary Coutant  <ccoutant@google.com>
215
216         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
217         * testsuite/Makefile.in: Regenerate.
218
219 2012-02-14  Cary Coutant  <ccoutant@google.com>
220
221         * options.cc (General_options::finalize): Disallow -pie and -static.
222
223 2012-02-03  Doug Kwan  <dougkwan@google.com>
224
225         * arm.cc (Arm_relocate_functions::abs8,
226         Arm_relocate_functions::abs16): Use
227         Bits::has_signed_unsigned_overflow32.
228         (Arm_relocate_functions::thm_abs8): Correct range of
229         overflow check.
230         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
231         in assertions.
232
233 2012-02-02  Doug Kwan  <dougkwan@google.com>
234
235         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
236         position independent outputs, not just shared objects.
237
238 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
239
240         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
241         * configure: Regenerated.
242
243 2012-01-27  Ian Lance Taylor  <iant@google.com>
244
245         * reloc.h (Bits): New class with static functions, copied from
246         namespace utils in arm.cc.
247         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
248         instead.
249
250 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
251
252         * incremental.cc (write_info_blocks): Correct relocation offset.
253
254 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
255
256         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
257         (Relocate::tls_gd_to_le): Likewise.
258
259 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
260
261         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
262
263 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
264
265         * configure.ac: Check if -mcmodel=medium works.
266         * configure: Regenerated.
267
268 2012-01-24  Cary Coutant  <ccoutant@google.com>
269
270         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
271         definition and ...
272         (read_unsigned_LEB_128_x): ... this new function.
273         (read_signed_LEB_128): Replaced with inline definition and ...
274         (read_signed_LEB_128_x): ... this new function.
275         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
276         (read_unsigned_LEB_128): Add inline definition.
277         (read_signed_LEB_128_x): New function.
278         (read_signed_LEB_128): Add inline definition.
279         * testsuite/Makefile.am (leb128_unittest): New unit test.
280         * testsuite/Makefile.in: Regenerate.
281         * testsuite/leb128_unittest.cc: New unit test.
282
283 2012-01-23  Ian Lance Taylor  <iant@google.com>
284
285         PR gold/13617
286         * i386.cc (Target_i386::do_code_fill): When using a jmp
287         instruction, pad with nop instructions.
288         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
289
290 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
291
292         * x86_64.cc (gc_process_relocs): Add typename on types used in
293         template.
294         (scan_relocs): Likewise.
295         (relocate_section): Likewise.
296         (apply_relocation): Likewise.
297
298 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
299
300         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
301         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
302         under x32.
303
304 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
305
306         * x86_64.cc: Initial support for x32.
307
308 2012-01-03  Cary Coutant  <ccoutant@google.com>
309
310         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
311         Use abstract base class for GOT.
312         * gold/output.h (class Output_data_got_base): New abstract base class.
313         (class Output_data_got): Derive from new base class, adjust ctors.
314         (Output_data_got::reserve_slot): Make virtual; rename to
315         do_reserve_slot; Adjust callers.
316         * gold/target.h (Sized_target::init_got_plt_for_update): Return
317         pointer to abstract base class.
318         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
319
320 2011-12-18  Ian Lance Taylor  <iant@google.com>
321
322         * object.h (Relobj::local_symbol_value): New function.
323         (Relobj::local_plt_offset): New function.
324         (Relobj::local_has_got_offset): New function.
325         (Relobj::local_got_offset): New function.
326         (Relobj::set_local_got_offset): New function.
327         (Relobj::do_local_symbol_value): New pure virtual function.
328         (Relobj::do_local_plt_offset): Likewise.
329         (Relobj::do_local_has_got_offset): Likewise.
330         (Relobj::do_local_got_offset): Likewise.
331         (Relobj::do_set_local_got_offset): Likewise.
332         (Sized_relobj::do_local_has_got_offset): Rename from
333         local_has_got_offset.
334         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
335         (Sized_relobj::do_set_local_got_offset): Rename from
336         set_local_got_offset.
337         (Sized_relobj_file::do_local_plt_offset): Rename from
338         local_plt_offset.
339         (Sized_relobj_file::do_local_symbol_value): New function.
340         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
341         local_plt_offset.
342         * output.cc (Output_data_got::Got_entry::write): Change object to
343         Relobj.  Use local_symbol_value.
344         (Output_data_got::add_global_with_rel): Change rel_dyn to
345         Output_data_reloc_generic*.  Use add_global_generic.
346         (Output_data_got::add_global_with_rela): Remove.  Change all
347         callers to use add_global_with_rel.
348         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
349         Output_data_reloc_generic*.  Use add_global_generic.
350         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
351         callers to use add_global_pair_with_rel.
352         (Output_data_got::add_local): Change object to Relobj*.
353         (Output_data_got::add_local_plt): Likewise.
354         (Output_data_got::add_local_with_rel): Change object to Relobj*,
355         change rel_dyn to Output_data_reloc_generic*.  Use
356         add_local_generic.
357         (Output_data_got::add_local_with_rela): Remove.  Change all
358         callers to use all_local_with_rel.
359         (Output_data_got::add_local_pair_with_rel): Change object to
360         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
361         add_output_section_generic.
362         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
363         callers to use add_local_pair_with_rel.
364         (Output_data_got::reserve_local): Change object to Relobj*.
365         * output.h: (class Output_data_reloc_generic): Add pure virtual
366         declarations for add_global_generic, add_local_generic,
367         add_output_section_generic.
368         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
369         functions for Output_data_reloc_generic.  Update declarations for
370         changes listed in output.cc.
371         (class Output_data_got): Change template parameter to got_size.
372         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
373         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
374         function.
375         (Sized_relobj_incr::do_local_plt_offset): New function.
376         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
377         add_global_generic.
378
379 2011-12-17  Cary Coutant  <ccoutant@google.com>
380
381         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
382         * resolve.cc (Symbol_table::resolve): Likewise.
383         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
384         arrays.
385         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
386
387 2011-12-16  Ian Lance Taylor  <iant@google.com>
388
389         * output.h (Output_data_reloc_generic::add): Only call
390         add_dynamic_reloc if this is a dynamic reloc section.
391
392 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
393
394         PR gold/13505
395         * target-reloc.h (apply_relocation): Replace <64, false> with
396         <size, big_endian>.
397
398 2011-11-25  Nick Clifton  <nickc@redhat.com>
399
400         * po/it.po: New Italian translation.
401
402 2011-11-17  Sterling Augustine  <saugustine@google.com>
403
404         * script.cc (script_include_directive): Implement.
405         (read_script_file): New local variables name and search_path. Update
406         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
407         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
408         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
409
410 2011-11-11  Sterling Augustine  <saugustine@google.com>
411
412         * yyscript.y (section_cmd): Add support for INCLUDE directive.
413         (file_or_sections_cmd): Likewise.
414
415 2011-11-11  Doug Kwan  <dougkwan@google.com>
416
417         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
418         if --just-symbols is given.
419
420 2011-11-10  Doug Kwan  <dougkwan@google.com>
421
422         PR gold/13362
423         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
424         when processing data relocs.
425         * reloc.h (Relocate_functions::rel_unaligned): New method.
426         (Relocate_functions::pcrel_unaligned): Ditto.
427         (Relocate_functions::rel32_unaligned): Ditto.
428         (Relocate_functions::pcrel32_unaligned): Ditto.
429
430 2011-11-09  Doug Kwan  <dougkwan@google.com>
431
432         PR gold/13362
433         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
434         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
435         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
436         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
437         (Relocate_functions::rel_unaligned): New.
438         (Relocate_functions::rel32_unaligned): New.
439         * target-reloc.h (relocate_for_relocatable): Add code to handle
440         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
441         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
442         arm_unaligned_reloc_r): New targets.
443         * testsuite/Makefile.in: Regenerate.
444         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
445         linking.
446
447 2011-11-02  Ian Lance Taylor  <iant@google.com>
448
449         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
450         NATIVE_LINKER.
451         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
452         * options.cc (General_options::finalize): Use library search path
453         from configure script if specified.  If not native and no sysroot,
454         only search TOOLLIBDIR.
455         * options.h (Search_directory::Search_directory): Change name to
456         const std::string&.
457         (General_options::add_to_library_path_with_sysroot): Change arg to
458         const std::string&.
459         * configure, Makefile.in, config.in: Rebuild.
460
461 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
462
463         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
464         we are working around the ARM1176 Erratum.
465         * options.h (General_options::fix_arm1176): Add option.
466         * testsuite/Makefile.am: Add testcases, and keep current ones
467         working.
468         * testsuite/Makefile.in: Regenerate.
469         * testsuite/arm_fix_1176.s: New file.
470         * testsuite/arm_fix_1176.sh: Likewise.
471
472 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
473
474         * arm.cc (Target_arm::Target_arm): Remove initialisation of
475         may_use_blx_.
476         (Target_arm::may_use_blx): Remove method.
477         (Target_arm::set_may_use_blx): Likewise.
478         (Target_arm::may_use_v4t_interworking): New method.
479         (Target_arm::may_use_v5t_interworking): Likewise.
480         (Target_arm::may_use_blx_): Remove member variable.
481         (Arm_relocate_functions::arm_branch_common): Check for v5T
482         interworking.
483         (Arm_relocate_functions::thumb_branch_common): Likewise.
484         (Reloc_stub::stub_type_for_reloc): Likewise.
485         (Target_arm::do_finalize_sections): Correct interworking checks.
486         * testsuite/Makefile.am: Add new tests.
487         * testsuite/Makefile.in: Regenerate.
488         * testsuite/arm_farcall_arm_arm.s: New test.
489         * testsuite/arm_farcall_arm_arm.sh: Likewise.
490         * testsuite/arm_farcall_arm_thumb.s: Likewise.
491         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
492         * testsuite/arm_farcall_thumb_arm.s: Likewise.
493         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
494         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
495         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
496
497 2011-10-31  Cary Coutant  <ccoutant@google.com>
498
499         PR gold/13023
500         * expression.cc (Expression::eval_with_dot): Add
501         is_section_dot_assignment parameter.
502         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
503         absolute and assigning to dot within a section.
504         * script-sections.cc
505         (Output_section_element_assignment::set_section_addresses): Pass
506         dot_section to set_if_absolute.
507         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
508         as is_section_dot_assignment flag to eval_with_dot.
509         (Output_section_element_dot_assignment::set_section_addresses):
510         Likewise.
511         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
512         parameter.  Also set value if relative to dot_section; set the
513         symbol's output_section.
514         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
515         parameter.  Adjust all callers.
516         (Expression::eval_maybe_dot): Likewise.
517         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
518         Adjust all callers.
519         * testsuite/script_test_2.t: Test assignment of an absolute value
520         to dot within an output section element.
521
522 2011-10-31  Cary Coutant  <ccoutant@google.com>
523
524         * options.h (class General_options): Add --[no-]gnu-unique options.
525         * symtab.cc (Symbol_table::sized_write_globals): Convert
526         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
527
528 2011-10-31  Cary Coutant  <ccoutant@google.com>
529
530         PR gold/13359
531         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
532         unnecessary assertion.
533         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
534
535 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
536
537         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
538         gc_mark_symbol.
539         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
540         gc_mark_symbol.
541         Change to just keep the section associated with symbol.
542         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
543         they are externally visible and --export-dynamic is turned on.
544         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
545
546 2011-10-19  Ian Lance Taylor  <iant@google.com>
547
548         PR gold/13163
549         * script-sections.cc
550         (Output_section_element_dot_assignment::needs_output_section): New
551         function.
552
553 2011-10-19  Ian Lance Taylor  <iant@google.com>
554
555         PR gold/13204
556         * layout.cc (Layout::segment_precedes): Don't assert failure if a
557         --section-start option was seen.
558         * options.h (General_options::any_section_start): New function.
559
560 2011-10-18  David S. Miller  <davem@davemloft.net>
561
562         PR binutils/13301
563         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
564         member to track relocation locations that have moved during TLS
565         reloc optimizations.
566         (Target_sparc::Relocate::Relocate): Initialize to NULL.
567         (Target_sparc::Relocate::relocate): Adjust view down by 4
568         bytes if it matches reloc_adjust_addr_.
569         (Target_sparc::Relocate::relocate_tls): Always move the
570         __tls_get_addr call delay slot instruction forward 4 bytes when
571         performing relaxation.
572
573 2011-10-18  Cary Coutant  <ccoutant@google.com>
574
575         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
576         (Output_file::map_no_anonymous): Check for non-zero
577         return code from posix_fallocate.
578
579 2011-10-17  Cary Coutant  <ccoutant@google.com>
580
581         PR gold/13245
582         * plugin.cc (is_visible_from_outside): Check for symbols
583         referenced from dynamic objects.
584         * resolve.cc (Symbol_table::resolve): Don't count references
585         from dynamic objects as references from real ELF files.
586         * testsuite/plugin_test_2.sh: Adjust expected result.
587
588 2011-10-17  Cary Coutant  <ccoutant@google.com>
589
590         * gold.cc: Include timer.h.
591         (queue_middle_tasks): Stamp time.
592         (queue_final_tasks): Likewise.
593         * main.cc (main): Store timer in parameters.  Print timers
594         for each pass.
595         * parameters.cc (Parameters::Parameters): Initialize timer_.
596         (Parameters::set_timer): New function.
597         (set_parameters_timer): New function.
598         * parameters.h (Parameters::set_timer): New function.
599         (Parameters::timer): New function.
600         (Parameters::timer_): New data member.
601         (set_parameters_timer): New function.
602         * timer.cc (Timer::stamp): New function.
603         (Timer::get_pass_time): New function.
604         * timer.h (Timer::stamp): New function.
605         (Timer::get_pass_time): New function.
606         (Timer::pass_times_): New data member.
607
608 2011-10-17  Cary Coutant  <ccoutant@google.com>
609
610         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
611         task for members of lib groups.
612
613 2011-10-17  Cary Coutant  <ccoutant@google.com>
614
615         PR gold/13288
616         * fileread.cc (File_read::find_view): Add assert.
617         (File_read::make_view): Move bounds check (replace with assert)...
618         (File_read::find_or_make_view): ... to here.
619
620 2011-10-12  Cary Coutant  <ccoutant@google.com>
621
622         * output.cc (Output_file::open_base_file): Handle case where
623         ::read returns less than requested size.
624
625 2011-10-10  Cary Coutant  <ccoutant@google.com>
626
627         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
628         Initialize defined_count_.
629         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
630         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
631         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
632         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
633         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
634         * incremental.h (Sized_relobj_incr::defined_count_): New data
635         member.
636         (Sized_incr_dynobj::defined_count_): New data member.
637         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
638         Return zeroes instead of internal error.
639
640 2011-10-10  Cary Coutant  <ccoutant@google.com>
641
642         PR gold/13249
643         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
644         (Output_reloc::symbol_value): Return PLT offset if flag is set.
645         * output.h (class Output_reloc): Add use_plt_offset flag.
646         (Output_reloc::type_): Adjust size of bit field.
647         (Output_reloc::use_plt_offset_): New bit field.
648         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
649         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
650         flag.  Adjust all callers.
651         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
652         creating RELATIVE relocations.
653
654 2011-10-10  Nick Clifton  <nickc@redhat.com>
655
656         * po/es.po: Updated Spanish translation.
657         * po/fi.po: Updated Finnish translation.
658
659 2011-10-03   Diego Novillo  <dnovillo@google.com>
660
661         * options.cc (parse_uint): Fix dereference of RETVAL.
662
663 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
664
665         * layout.h (section_order_map_): New member.
666         (get_section_order_map): New member function.
667         * output.cc (Output_section::add_input_section): Check for patterns
668         only when --section-ordering-file is specified.
669         * gold.cc (queue_middle_tasks): Delay updating order of sections till
670         output_sections have been formed.
671         * layout.cc (Layout_Layout): Initialize section_order_map_.
672         * plugin.cc (update_section_order): Store order in order_map. Do not
673         update the order.
674         * testsuite/Makefile.am: Add test case for plugin_final_layout.
675         * testsuite/Makefile.in: Regenerate.
676         * testsuite/plugin_section_order.c: New file.
677         * testsuite/plugin_final_layout.cc: New file.
678         * testsuite/plugin_final_layout.sh: New file.
679
680 2011-09-29  Cary Coutant  <ccoutant@google.com>
681
682         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
683         Check for NULL.
684         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
685         symbols during incremental update.
686         (Symbol_table::add_from_dynobj): Likewise.
687
688 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
689             Ian Lance Taylor  <iant@google.com>
690
691         * symtab.cc (Symbol_table::define_special_symbol): Always
692         canonicalize version string.
693
694 2011-09-26  Cary Coutant  <ccoutant@google.com>
695
696         * gold.cc (queue_initial_tasks): Move option checks ...
697         * options.cc (General_options::finalize): ... to here. Disable
698         some options; make others fatal.
699
700 2011-09-26  Cary Coutant  <ccoutant@google.com>
701
702         gcc PR lto/47247
703         * plugin.cc (get_symbols_v2): New function.
704         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
705         (is_referenced_from_outside): New function.
706         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
707         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
708         (get_symbols): Pass version parameter.
709         (get_symbols_v2): New function.
710         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
711         parameter.
712         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
713         (onload): Add LDPT_GET_SYMBOLS_V2.
714         (all_symbols_read_hook): Use get_symbols_v2; check for
715         LDPR_PREVAILING_DEF_IRONLY_EXP.
716         * testsuite/plugin_test_3.sh: Update expected results.
717
718 2011-09-23  Simon Baldwin  <simonb@google.com>
719
720         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
721         configuration options.
722         * configure: Regenerate.
723         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
724         * Makefile.in: Regenerate.
725         * testsuite/Makefile.in: Regenerate.
726
727 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
728
729         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
730
731 2011-09-19  Cary Coutant  <ccoutant@google.com>
732
733         * incremental.cc (can_incremental_update): Fix typo in comment.
734         * incremental.h (can_incremental_update): Likewise.
735
736 2011-09-18  Cary Coutant  <ccoutant@google.com>
737
738         * incremental.cc (can_incremental_update): New function.
739         * incremental.h (can_incremental_update): New function.
740         * layout.cc (Layout::init_fixed_output_section): Call it.
741         (Layout::make_output_section): Don't allow patch space in .eh_frame.
742         * object.cc (Sized_relobj_file::do_layout): Call
743         can_incremental_update.
744
745 2011-09-13  Cary Coutant  <ccoutant@google.com>
746
747         * configure.ac: Check for glibc support for gnu_indirect_function
748         support with static linking, setting automake conditional
749         IFUNC_STATIC.
750         * Makefile.in: Regenerate.
751         * configure: Regenerate.
752
753         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
754         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
755         for IFUNC_STATIC.
756         * testsuite/Makefile.in: Regenerate.
757
758 2011-09-13  Cary Coutant  <ccoutant@google.com>
759
760         * incremental.cc (Sized_relobj_incr::do_layout): Call
761         report_comdat_group for kept comdat sections.
762         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
763         * testsuite/Makefile.in: Regenerate.
764         * testsuite/incr_comdat_test_1.cc: New source file.
765         * testsuite/incr_comdat_test_2_v1.cc: New source file.
766         * testsuite/incr_comdat_test_2_v2.cc: New source file.
767         * testsuite/incr_comdat_test_2_v3.cc: New source file.
768
769 2011-09-13  Ian Lance Taylor  <iant@google.com>
770
771         * object.cc (Sized_relobj_file::do_layout): Remove unused local
772         variable external_symbols_offset.
773
774 2011-09-12  Ian Lance Taylor  <iant@google.com>
775
776         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
777         triggered if object has no symbols.
778
779 2011-09-09  David S. Miller  <davem@davemloft.net>
780
781         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
782         (Output_fill_debug_line::do_write): Likewise.
783
784 2011-08-29  Cary Coutant  <ccoutant@google.com>
785
786         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
787         casts to match formatting specs.
788         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
789
790 2011-08-26  Cary Coutant  <ccoutant@google.com>
791
792         * layout.cc (Free_list::allocate): Provide guarantee of minimum
793         remaining hole size when allocating.
794         (Layout::make_output_section): Set fill methods for debug sections.
795         * layout.h (Free_list::Free_list_node): Move from private to
796         public.
797         (Free_list::set_min_hole_size): New function.
798         (Free_list::begin, Free_list::end): New functions.
799         (Free_list::min_hole_): New data member.
800         * output.cc: Include dwarf.h.
801         (Output_fill_debug_info::do_minimum_hole_size): New function.
802         (Output_fill_debug_info::do_write): New function.
803         (Output_fill_debug_line::do_minimum_hole_size): New function.
804         (Output_fill_debug_line::do_write): New function.
805         (Output_section::Output_section): Initialize new data member.
806         (Output_section::set_final_data_size): Ensure patch space is larger
807         than minimum hole size.
808         (Output_section::do_write): Fill holes in debug sections.
809         * output.h (Output_fill): New class.
810         (Output_fill_debug_info): New class.
811         (Output_fill_debug_line): New class.
812         (Output_section::set_free_space_fill): New function.
813         (Output_section::free_space_fill_): New data member.
814         * testsuite/Makefile.am (incremental_test_3): Add
815         --incremental-patch option.
816         (incremental_test_4): Likewise.
817         (incremental_test_5): Likewise.
818         (incremental_test_6): Likewise.
819         (incremental_copy_test): Likewise.
820         (incremental_common_test_1): Likewise.
821         * testsuite/Makefile.in: Regenerate.
822
823 2011-08-26  Nick Clifton  <nickc@redhat.com>
824
825         * po/es.po: Updated Spanish translation.
826
827 2011-08-01  Cary Coutant  <ccoutant@google.com>
828
829         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
830         * gold/testsuite/Makefile.in: Regenerate.
831         * gold/testsuite/justsyms_exec.c: New source file.
832         * gold/testsuite/justsyms_lib.c: New source file.
833
834 2011-08-01  Cary Coutant  <ccoutant@google.com>
835
836         * layout.cc (Layout::set_segment_offsets): Don't realign text
837         segment if -Ttext was specified.
838         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
839         file type.
840         * object.h (Sized_relobj_file::e_type): New function.
841         (Sized_relobj_file::e_type_): New data member.
842         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
843         base address for ET_EXEC files.
844         * target.cc (Target::do_make_elf_object_implementation): Allow
845         ET_EXEC files with --just-symbols option.
846
847 2011-07-28  Cary Coutant  <ccoutant@google.com>
848
849         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
850         Add thread_number parameter.
851         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
852         * workqueue-threads.cc
853         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
854         current thread if its thread number is greater than desired thread
855         count.
856         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
857         Add thread_number parameter.
858         (Workqueue::should_cancel_thread): Likewise.
859         (Workqueue::find_runnable_or_wait): Pass thread_number to
860         should_cancel_thread.
861         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
862         parameter.
863
864 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
865
866         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
867         only after checking if it cannot be forced local.
868         * symtab.h (is_externally_visible): Check if the symbol is not forced
869         local.
870
871 2011-07-15  Ian Lance Taylor  <iant@google.com>
872
873         * options.h (class General_options): Add --print-output-format.
874         Move -EL next to -EB, for  better --help output.
875         * target-select.cc: Include <cstdio>, "options.h", and
876         "parameters.h".
877         (Target_selector::do_target_bfd_name): New function.
878         (print_output_format): New function.
879         * target-select.h (class Target_selector): Update declarations.
880         (Target_selector::target_bfd_name): New function.
881         (print_output_format): Declare.
882         * main.cc: Include "target-select.h".
883         (main): Handle --print-output-format.
884         * gold.cc: Include "target-select.h".
885         (queue_initial_tasks): Handle --print-output-format when there are
886         no input files.
887         * parameters.cc (parameters_force_valid_target): Give a better
888         error message if -EB/-EL does not match target.
889         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
890         function.
891
892 2011-07-15  Ian Lance Taylor  <iant@google.com>
893
894         * i386.cc (class Output_data_plt_i386): Add layout_ field.
895         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
896         (Output_data_plt_i386::do_write): Write address of .dynamic
897         section to first entry in .got.plt section.
898         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
899         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
900         Initialize layout_.
901         (Output_data_plt_x86_64::do_write): Write address of .dynamic
902         section to first entry in .got.plt section.
903         * layout.h (Layout::dynamic_section): New function.
904
905 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
906
907         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
908         to claim_file call.
909         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
910         input_section_position_, and input_section_glob_.
911         (read_layout_from_file): Call function section_ordering_specified.
912         * layout.h (is_section_ordering_specified): New function.
913         (section_ordering_specified): New function.
914         (section_ordering_specified_): New boolean member.
915         * main.cc(main): Call load_plugins after layout object is defined.
916         * output.cc (Output_section::add_input_section): Use
917         function section_ordering_specified to check if section ordering is
918         needed.
919         * output.cc (Output_section::add_relaxed_input_section): Use
920         function section_ordering_specified to check if section ordering is
921         needed.
922         (Output_section::update_section_layout): New function.
923         (Output_section::sort_attached_input_sections): Check if input section
924         must be reordered.
925         * output.h (Output_section::update_section_layout): New function.
926         * plugin.cc (get_section_count): New function.
927         (get_section_type): New function.
928         (get_section_name): New function.
929         (get_section_contents): New function.
930         (update_section_order): New function.
931         (allow_section_ordering): New function.
932         (Plugin::load): Add the new interfaces to the transfer vector.
933         (Plugin_manager::load_plugins): New parameter.
934         (Plugin_manager::all_symbols_read): New parameter.
935         (Plugin_manager::claim_file): New parameter. Save the elf object for
936         unclaimed objects.
937         (Plugin_manager::get_elf_object): New function.
938         (Plugin_manager::get_view): Change to directly use the bool to check
939         if get_view is called from claim_file_hook.
940         * plugin.h (input_objects): New function
941         (Plugin__manager::load_plugins): New parameter.
942         (Plugin_manager::claim_file): New parameter.
943         (Plugin_manager::get_elf_object): New function.
944         (Plugin_manager::in_claim_file_handler): New function.
945         (Plugin_manager::in_claim_file_handler_): New member.
946         (layout): New function.
947         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
948         handler with an extra parameter. Make the elf object before calling
949         claim_file handler.
950         * testsuite/plugin_test.c (get_section_count): New function pointer.
951         (get_section_type): New function pointer.
952         (get_section_name): New function pointer.
953         (get_section_contents): New function pointer.
954         (update_section_order): New function pointer.
955         (allow_section_ordering): New function pointer.
956         (onload): Check if the new interfaces exist.
957
958 2011-07-13  Ian Lance Taylor  <iant@google.com>
959
960         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
961         relro section.
962         * x86_64.cc (Target_x86_64::got_section): Likewise.
963         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
964         (relro_now_test_SOURCES): New variable.
965         (relro_now_test_DEPENDENCIES): New variable.
966         (relro_now_test_LDFLAGS): New variable.
967         (relro_now_test_LDADD): New variable.
968         (relro_now_test.so): New target.
969         * testsuite/Makefile.in: Rebuild.
970
971 2011-07-12  Ian Lance Taylor  <iant@google.com>
972
973         PR gold/12980
974         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
975         GLOB_DAT relocation rather than a RELATIVE relocation for a
976         protected symbol when creating a shared library.
977         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
978         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
979         * testsuite/protected_main_1.cc (main): Test that protected
980         function has same address.
981
982 2011-07-11  Ian Lance Taylor  <iant@google.com>
983
984         PR gold/12979
985         * options.h (class General_options): Add -Bgroup.
986         * options.cc (General_options::finalize): If -Bgroup is set,
987         default to --unresolved-symbols=report-all.
988         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
989         * target-reloc.h (issue_undefined_symbol_error): Handle
990         --unresolved-symbols=report-all.
991
992 2011-07-08  Ian Lance Taylor  <iant@google.com>
993
994         PR gold/11985
995         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
996         if linker script discards key sections.
997         (Layout::create_dynamic_symtab): Likewise.
998         (Layout::assign_local_dynsym_offsets): Likewise.
999         (Layout::sized_create_version_sections): Likewise.
1000         (Layout::create_interp): Likewise.
1001         (Layout::finish_dynamic_section): Likewise.
1002         (Layout::set_dynamic_symbol_size): Likewise.
1003
1004 2011-07-08  Ian Lance Taylor  <iant@google.com>
1005
1006         PR gold/12386
1007         * options.h (class General_options): Add --unresolved-symbols.
1008         * target-reloc.h (issue_undefined_symbol_error): Check
1009         --unresolved-symbols.  Add comments.
1010
1011 2011-07-08  Ian Lance Taylor  <iant@google.com>
1012
1013         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1014         expression more complex.
1015
1016 2011-07-08  Ian Lance Taylor  <iant@google.com>
1017
1018         PR gold/11317
1019         * target-reloc.h (issue_undefined_symbol_error): New inline
1020         function, broken out of relocate_section.
1021         (relocate_section): Call issue_undefined_symbol_error.
1022         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1023         there is no TLS segment if we are about to issue an undefined
1024         symbol error.
1025         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1026
1027 2011-07-08  Ian Lance Taylor  <iant@google.com>
1028
1029         PR gold/12279
1030         * resolve.cc (Symbol_table::should_override): Add fromtype
1031         parameter.  Change all callers.  Give error when linking together
1032         TLS and non-TLS symbol.
1033         (Symbol_table::should_override_with_special): Add fromtype
1034         parameter.  Change all callers.
1035         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1036         there is no TLS segment if we have reported some errors.
1037         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1038
1039 2011-07-08  Ian Lance Taylor  <iant@google.com>
1040
1041         PR gold/12372
1042         * target.h (Target::plt_address_for_global): New function.
1043         (Target::plt_address_for_local): New function.
1044         (Target::plt_section_for_global): Remove.
1045         (Target::plt_section_for_local): Remove.
1046         (Target::do_plt_address_for_global): New virtual function.
1047         (Target::do_plt_address_for_local): New virtual function.
1048         (Target::do_plt_section_for_global): Remove.
1049         (Target::do_plt_section_for_local): Remove.
1050         (Target::register_global_plt_entry): Add Symbol_table and Layout
1051         parameters.
1052         * output.cc (Output_data_got::Got_entry::write): Use
1053         plt_address_for_global and plt_address_for_local.
1054         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1055         address of output section.
1056         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1057         got_irelative_, and irelative_count_ fields.  Update
1058         declarations.
1059         (Output_data_plt_i386::has_irelative_section): New function.
1060         (Output_data_plt_i386::entry_count): Add irelative_count_.
1061         (Output_data_plt_i386::set_final_data_size): Likewise.
1062         (class Target_i386): Add got_irelative_ and rel_irelative_
1063         fields.  Update declarations.
1064         (Target_i386::Target_i386): Initialize new fields.
1065         (Target_i386::do_plt_address_for_global): New function replacing
1066         do_plt_section_for_global.
1067         (Target_i386::do_plt_address_for_local): New function replacing
1068         do_plt_section_for_local.
1069         (Target_i386::got_section): Create got_irelative_.
1070         (Target_i386::rel_irelative_section): New function.
1071         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1072         fields.  Don't define __rel_iplt_{start,end}.
1073         (Output_data_plt_i386::add_entry): Add symtab and layout
1074         parameters.  Change all callers.  Use different PLT and GOT for
1075         IFUNC symbols.
1076         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1077         layout parameters.  Change all callers.  Use different PLT and
1078         GOT.
1079         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1080         (Output_data_plt_i386::rel_irelative): New function.
1081         (Output_data_plt_i386::address_for_global): New function.
1082         (Output_data_plt_i386::address_for_local): New function.
1083         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1084         IRELATIVE GOT when changing IFUNC GOT entries.
1085         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1086         reloc.
1087         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1088         if we didn't create an IRELATIVE GOT.
1089         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1090         plt_address_for_local.
1091         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1092         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1093         got_irelative_, and irelative_count_ fields.  Update
1094         declarations.
1095         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1096         Initialize new fields.  Remove symtab parameter.  Change all
1097         callers.
1098         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1099         irelative_count_.
1100         (Output_data_plt_x86_64::has_irelative_section): New function.
1101         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1102         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1103         fields.  Update declarations.
1104         (Target_x86_64::Target_x86_64): Initialize new fields.
1105         (Target_x86_64::do_plt_address_for_global): New function replacing
1106         do_plt_section_for_global.
1107         (Target_x86_64::do_plt_address_for_local): New function replacing
1108         do_plt_section_for_local.
1109         (Target_x86_64::got_section): Create got_irelative_.
1110         (Target_x86_64::rela_irelative_section): New function.
1111         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1112         all callers.  Don't create __rel_iplt_{start,end}.
1113         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1114         parameters.  Change all callers.  Use different PLT and GOT for
1115         IFUNC symbols.
1116         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1117         layout parameters.  Change all callers.  Use different PLT and
1118         GOT.
1119         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1120         parameters.  Change all callers.  Use different PLT and GOT for
1121         IFUNC symbols.
1122         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1123         (Output_data_plt_x86_64::rela_irelative): New function.
1124         (Output_data_plt_x86_64::address_for_global): New function.
1125         (Output_data_plt_x86_64::address_for_local): New function.
1126         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1127         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1128         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1129         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1130         parameters.
1131         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1132         reloc.
1133         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1134         symbols if we didn't create an IRELATIVE GOT.
1135         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1136         plt_address_for_local.
1137         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1138         * testsuite/ifuncvar1.c: New test file.
1139         * testsuite/ifuncvar2.c: New test file.
1140         * testsuite/ifuncvar3.c: New test file.
1141         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1142         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1143         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1144         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1145         * testsuite/Makefile.in: Rebuild.
1146
1147 2011-07-07  Cary Coutant  <ccoutant@google.com>
1148
1149         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1150         (two_file_test_1_ndebug.o): Likewise.
1151         (two_file_test_1b_ndebug.o): Likewise.
1152         (two_file_test_2_ndebug.o): Likewise.
1153         (two_file_test_main_ndebug.o): Likewise.
1154         (incremental_test_2): Link with no-debug versions.
1155
1156 2011-07-06  Cary Coutant  <ccoutant@google.com>
1157
1158         * gold/incremental.cc
1159         (Output_section_incremental_inputs::write_info_blocks): Check for
1160         hidden and internal symbols.
1161
1162 2011-07-06  Cary Coutant  <ccoutant@google.com>
1163
1164         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1165         Check disposition for startup file.
1166         (Incremental_inputs::report_command_line): Ignore
1167         --incremental-startup-unchanged option.
1168         * options.cc (General_options::parse_incremental_startup_unchanged):
1169         New function.
1170         (General_options::General_options): Initialize new data member.
1171         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1172         (General_options): Add --incremental-startup-unchanged option.
1173         (General_options::incremental_startup_disposition): New function.
1174         (General_options::incremental_startup_disposition_): New data member.
1175
1176 2011-07-06  Cary Coutant  <ccoutant@google.com>
1177
1178         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1179         input file index to Script_info ctor.
1180         (Sized_incremental_binary::do_file_has_changed): Find the
1181         command-line argument for files named in scripts.
1182         * incremental.h (Script_info::Script_info): New ctor
1183         with input file index.
1184         (Script_info::input_file_index): New function.
1185         (Script_info::input_file_index_): New data member.
1186         (Incremental_binary::get_library): Add const.
1187         (Incremental_binary::get_script_info): Add const.
1188         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1189         * testsuite/Makefile.am (incremental_test_5): New test case.
1190         (incremental_test_6): New test case.
1191         * testsuite/Makefile.in: Regenerate.
1192
1193 2011-07-06  Cary Coutant  <ccoutant@google.com>
1194
1195         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1196         debug output when command lines differ.
1197
1198 2011-07-06  Cary Coutant  <ccoutant@google.com>
1199
1200         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1201         --incremental-patch option.
1202         * layout.cc (Free_list::allocate): Extend allocation beyond original
1203         end if enabled.
1204         (Layout::make_output_section): Mark sections that should get
1205         patch space.
1206         * options.cc (parse_percent): New function.
1207         * options.h (parse_percent): New function.
1208         (DEFINE_percent): New macro.
1209         (General_options): Add --incremental-patch option.
1210         * output.cc (Output_section::Output_section): Initialize new data
1211         members.
1212         (Output_section::add_input_section): Print section name when out
1213         of patch space.
1214         (Output_section::add_output_section_data): Likewise.
1215         (Output_section::set_final_data_size): Add patch space when
1216         doing --incremental-full.
1217         (Output_section::do_reset_address_and_file_offset): Remove patch
1218         space.
1219         (Output_segment::set_section_list_addresses): Print debug output
1220         only if --incremental-update.
1221         * output.h (Output_section::set_is_patch_space_allowed): New function.
1222         (Output_section::is_patch_space_allowed_): New data member.
1223         (Output_section::patch_space_): New data member.
1224         * parameters.cc (Parameters::incremental_full): New function.
1225         * parameters.h (Parameters::incremental_full): New function
1226         * testsuite/Makefile.am (incremental_test_2): Add test for
1227         --incremental-patch option.
1228         * testsuite/Makefile.in: Regenerate.
1229         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1230         (t18): Remove function body.
1231
1232 2011-07-05  Doug Kwan  <dougkwan@google.com>
1233
1234         PR gold/12771
1235         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1236         Arm_Address type for relocation result.
1237         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1238         overflow check.
1239         (Arm_relocate_functions::abs32): Use unaligned access.
1240         (Arm_relocate_functions::rel32): Ditto.
1241         (Arm_relocate_functions::prel31): Ditto.
1242         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1243         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1244         static data relocations.
1245         * testsuite/Makefile.in: Regnerate.
1246         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1247
1248 2011-07-05  Ian Lance Taylor  <iant@google.com>
1249
1250         PR gold/12392
1251         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1252         symbols if necessary.
1253         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1254
1255 2011-07-05  Ian Lance Taylor  <iant@google.com>
1256
1257         PR gold/12952
1258         * resolve.cc (Symbol::override_base_with_special): Simply override
1259         version with special symbol version, ignoring previous version.
1260
1261 2011-07-05  Ian Lance Taylor  <iant@google.com>
1262
1263         * object.cc (Sized_relobj_file::include_section_group): Add
1264         information to comment about signature location.
1265
1266 2011-07-02  Ian Lance Taylor  <iant@google.com>
1267
1268         PR gold/12957
1269         * options.h (class General_options): Add -f and -F.
1270         * options.cc (General_options::finalize): Fatal error if -f/-F
1271         are used without -shared.
1272         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1273
1274 2011-07-02  Ian Lance Taylor  <iant@google.com>
1275
1276         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1277
1278 2011-07-01  Ian Lance Taylor  <iant@google.com>
1279
1280         PR gold/12525
1281         PR gold/12952
1282         * resolve.cc (Symbol::override_base_with_special): Don't override
1283         the version if the overriding symbol has a different name.
1284         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1285         all callers.  If we give an error about an undefined version,
1286         define the base version if necessary.
1287         * dynobj.h (class Versions): Update declaration.
1288         * testsuite/weak_alias_test_5.cc: New file.
1289         * testsuite/weak_alias_test.script: New file.
1290         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1291         and versioned_alias have the right value, and call t2.
1292         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1293         weak_alias_test_5.so.
1294         (weak_alias_test_LDADD): Likewise.
1295         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1296         * testsuite/Makefile.in: Rebuild.
1297
1298 2011-07-01  Ian Lance Taylor  <iant@google.com>
1299
1300         PR gold/12525
1301         * options.h (class General_options): Support -z notext.
1302         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1303         -Wl,-z,notext.
1304         (two_file_shared_nonpic.so): Likewise.
1305         (two_file_shared_mixed.so): Likewise.
1306         (two_file_shared_mixed_1.so): Likewise.
1307         (weak_undef_lib_nonpic.so): Likewise.
1308         (alt/weak_undef_lib_nonpic.so): Likewise.
1309         (tls_test_shared_nonpic.so): Likewise.
1310         * testsuite/Makefile.in: Rebuild.
1311
1312 2011-07-01  Ian Lance Taylor  <iant@google.com>
1313
1314         PR gold/12525
1315         * configure.ac: Test whether static linking works, setting
1316         the automake conditional HAVE_STATIC.
1317         * testsuite/Makefile.am: Disable tests using -static if
1318         HAVE_STATIC is not true.
1319         * configure, testsuite/Makefile.in: Rebuild.
1320
1321 2011-07-01  Ian Lance Taylor  <iant@google.com>
1322
1323         PR gold/12525
1324         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1325         Assert if we see DW_EH_PE_indirect.
1326         * target.h (Target::ehframe_datarel_base): New function.
1327         (Target::do_ehframe_datarel_base): New target function.
1328         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1329         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1330         function.
1331
1332 2011-07-01  Ian Lance Taylor  <iant@google.com>
1333
1334         PR gold/12571
1335         * options.h (class General_options): Add
1336         --ld-generated-unwind-info.
1337         * ehframe.cc (Fde::write): Add address parameter.  Change all
1338         callers.  If associated with PLT, fill in address and size.
1339         (Cie::set_output_offset): Only add merge mapping if there is an
1340         object.
1341         (Cie::write): Add address parameter.  Change all callers.
1342         (Eh_frame::add_ehframe_for_plt): New function.
1343         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1344         input_offset_ fields into union u_, with new plt field.
1345         (Fde::Fde): Adjust for new union field.
1346         (Fde::Fde) [Output_data version]: New constructor.
1347         (Fde::add_mapping): Only add merge mapping if there is an object.
1348         (class Cie): Update declarations.
1349         (class Eh_frame): Declare add_ehframe_for_plt.
1350         * layout.cc (Layout::layout_eh_frame): Break out code into
1351         make_eh_frame_section, and call it.
1352         (Layout::make_eh_frame_section): New function.
1353         (Layout::add_eh_frame_for_plt): New function.
1354         * layout.h (class Layout): Update declarations.
1355         * merge.cc (Merge_map::add_mapping): Add assertion.
1356         * i386.cc: Include "dwarf.h".
1357         (class Output_data_plt_i386): Make first_plt_entry,
1358         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1359         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1360         and plt_eh_frame_fde.
1361         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1362         boundary.  Call add_eh_frame_for_plt if appropriate.
1363         * x86_64.cc: Include "dwarf.h".
1364         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1365         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1366         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1367         and plt_eh_frame_fde.
1368         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1369         appropriate.
1370
1371 2011-06-29  Ian Lance Taylor  <iant@google.com>
1372
1373         PR gold/12629
1374         * object.cc (Sized_relobj_file::layout_section): Change shdr
1375         parameter to be const.
1376         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1377         out of do_layout.
1378         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1379         appropriate.  Call layout_eh_frame_section.
1380         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1381         sections.
1382         * object.h (class Sized_relobj_file): Update declarations.
1383
1384 2011-06-29  Ian Lance Taylor  <iant@google.com>
1385
1386         PR gold/12652
1387         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1388         modifier.
1389         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1390
1391 2011-06-29  Ian Lance Taylor  <iant@google.com>
1392
1393         PR gold/12675
1394         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1395         SHT_X86_64_UNWIND.
1396         * layout.cc (Layout::layout_eh_frame): Likewise.
1397
1398 2011-06-29  Ian Lance Taylor  <iant@google.com>
1399
1400         PR gold/12695
1401         * layout.cc (Layout::symtab_section_shndx): New function.
1402         * layout.h (class Layout): Declare symtab_section_shndx.
1403         * output.cc (Output_section::write_header): Call it.
1404
1405 2011-06-29  Ian Lance Taylor  <iant@google.com>
1406
1407         PR gold/12818
1408         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1409         symbols which are not used in a relocation.
1410
1411 2011-06-28  Ian Lance Taylor  <iant@google.com>
1412
1413         PR gold/12898
1414         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1415         script create indistinguishable segments.
1416         (Layout::set_segment_offsets): Use stable_sort when sorting
1417         segments.  Pass this to Compare_segments constructor.
1418         * layout.h (class Layout): Make segment_precedes non-static.
1419         (class Compare_segments): Change from struct to class.  Add
1420         layout_ field.  Add constructor.
1421         * script-sections.cc
1422         (Script_sections::attach_sections_using_phdrs_clause): Rename
1423         local orphan to is_orphan.  Don't report failure to put empty
1424         section in segment.  On attachment failure, report name of
1425         section, and attach to first PT_LOAD segment.
1426
1427 2011-06-28  Ian Lance Taylor  <iant@google.com>
1428
1429         PR gold/12934
1430         * target-select.cc (Target_selector::Target_selector): Add
1431         emulation parameter.  Change all callers.
1432         (select_target_by_bfd_name): Rename from select_target_by_name.
1433         Change all callers.
1434         (select_target_by_emulation): New function.
1435         (supported_emulation_names): New function.
1436         * target-select.h (class Target_selector): Add emulation_ field.
1437         Update declarations.
1438         (Target_selector::recognize_by_bfd_name): Rename from
1439         recognize_by_name.  Change all callers.
1440         (Target_selector::supported_bfd_names): Rename from
1441         supported_names.  Change all callers.
1442         (Target_selector::recognize_by_emulation): New function.
1443         (Target_selector::supported_emulations): New function.
1444         (Target_selector::emulation): New function.
1445         (Target_selector::do_recognize_by_bfd_name): Rename from
1446         do_recognize_by_name.  Change all callers.
1447         (Target_selector::do_supported_bfd_names): Rename from
1448         do_supported_names.  Change all callers.
1449         (Target_selector::do_recognize_by_emulation): New function.
1450         (Target_selector::do_supported_emulations): New function.
1451         (select_target_by_bfd_name): Change name in declaration.
1452         (select_target_by_emulation): Declare.
1453         (supported_emulation_names): Declare.
1454         * parameters.cc (parameters_force_valid_target): Try to find
1455         target based on emulation from -m option.
1456         * options.h (class General_options): Change doc string for -m.
1457         * options.cc (help): Print emulations.
1458         (General_options::parse_V): Likewise.
1459         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1460         Add emulation parameter.  Change all callers.
1461
1462 2011-06-28  Ian Lance Taylor  <iant@google.com>
1463
1464         * target.h (class Target): Add osabi_ field.
1465         (Target::osabi): New function.
1466         (Target::set_osabi): New function.
1467         (Target::Target): Initialize osabi_.
1468         (Target::do_adjust_elf_header): Make pure virtual.
1469         (Sized_target::do_adjust_elf_header): Declare.
1470         * target.cc (Sized_target::do_adjust_elf_header): New function.
1471         (class Sized_target): Instantiate all versions.
1472         * freebsd.h (class Target_freebsd): Remove.
1473         (Target_selector_freebsd::do_recognize): Call set_osabi on
1474         Target.
1475         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1476         (Target_selector_freebsd::set_osabi): Remove.
1477         * i386.cc (class Target_i386): Inherit from Sized_target rather
1478         than Target_freebsd.
1479         * x86_64.cc (class Target_x86_64): Likewise.
1480
1481 2011-06-28  Ian Lance Taylor  <iant@google.com>
1482
1483         * target.h (Target::can_check_for_function_pointers): Rewrite.
1484         Make non-virtual.
1485         (Target::can_icf_inline_merge_sections): Likewise.
1486         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1487         (Target::Target_info): Add can_icf_inline_merge_sections field.
1488         (Target::do_can_check_for_function_pointers): New virtual
1489         function.
1490         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1491         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1492         from can_check_for_function_pointers, move in file.
1493         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1494         section_may_have_icf_unsafe_poineters, move in file.
1495         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1496         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1497         Rename from can_check_for_function_pointers, move in file.
1498         (Target_i386::can_icf_inline_merge_sections): Remove.
1499         (Target_i386::i386_info): Initialize
1500         can_icf_inline_merge_sections.
1501         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1502         Initialize can_icf_inline_merge_sections.
1503         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1504         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1505         Rename from can_check_for_function_pointers, move in file.
1506         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1507         (Target_x86_64::x86_64_info): Initialize
1508         can_icf_inline_merge_sections.
1509         * testsuite/testfile.cc (Target_test::test_target_info):
1510         Likewise.
1511         * icf.cc (get_section_contents): Correct formatting.
1512
1513 2011-06-27  Ian Lance Taylor  <iant@google.com>
1514
1515         * symtab.cc (Symbol::versioned_name): New function.
1516         (Symbol_table::add_to_final_symtab): Use versioned_name when
1517         appropriate.
1518         (Symbol_table::sized_write_symbol): Likewise.
1519         * symtab.h (class Symbol): Declare versioned_name.
1520         * stringpool.h (class Stringpool_template): Add variant of add
1521         which takes a std::basic_string.
1522         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1523         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1524         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1525         (ver_test_12.o): New target.
1526         * testsuite/Makefile.in: Rebuild.
1527
1528 2011-06-27  Doug Kwan  <dougkwan@google.com>
1529
1530         * arm.cc (Arm_relocate_functions::thm_jump8,
1531         Arm_relocate_functions::thm_jump11): Use a wider signed
1532         type to compute offset.
1533         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1534         arm_thm_jump8.
1535         * testsuite/Makefile.in: Regenerate.
1536         * testsuite/arm_branch_in_range.sh: Check test results of
1537         arm_thm_jump11 and arm_thm_jump8.
1538         * testsuite/arm_thm_jump11.s: New test source file.
1539         * testsuite/arm_thm_jump11.t: New linker script.
1540         * testsuite/arm_thm_jump8.s: New test source file.
1541         * testsuite/arm_thm_jump8.t: New linker script.
1542
1543 2011-06-24  Ian Lance Taylor  <iant@google.com>
1544
1545         * layout.cc: Include "object.h".
1546         (ctors_sections_in_init_array): New static variable.
1547         (Layout::is_ctors_in_init_array): New function.
1548         (Layout::layout): Add entry to ctors_sections_in_init_array if
1549         appropriate.
1550         * layout.h (class Layout): Declare is_ctors_in_init_array.
1551         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1552         is_ctors_reverse_view is set.
1553         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1554         all callers.  Set is_ctors_reverse_view field of View_size.
1555         (Sized_relobj_file::reverse_words): New function.
1556         * object.h (Sized_relobj_file::View_size): Add
1557         is_ctors_reverse_view field.
1558         (class Sized_relobj_file): Update declarations.
1559         * testsuite/initpri3.c: New test.
1560         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1561         initpri3b.
1562         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1563         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1564         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1565         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1566         * testsuite/Makefile.in: Rebuild.
1567
1568 2011-06-24  Cary Coutant  <ccoutant@google.com>
1569
1570         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1571         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1572         (debug_msg_cdebug.err): New targets.
1573         * testsuite/Makefile.in: Regenerate.
1574         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1575         Fix checks for link with shared library.
1576
1577 2011-06-24  Doug Kwan  <dougkwan@google.com>
1578
1579         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1580         skip empty text sections.
1581         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1582
1583 2011-06-22  Ian Lance Taylor  <iant@google.com>
1584
1585         PR gold/12910
1586         * options.h (class General_options): Add --ctors-in-init-array.
1587         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1588         friends as SHT_PROGBITS for merging sections.
1589         (Layout::layout): Remove special handling of .init_array and
1590         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1591         and .dtors if ctors_in_init_array.
1592         (Layout::make_output_section): Force correct section types for
1593         .init_array and friends.  Don't sort if doing relocatable link,
1594         Don't sort .ctors and .dtors if ctors_in_init_array.
1595         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1596         (Layout::output_section_name): Add relobj parameter.  Change all
1597         callers.  Handle .ctors. and .dtors. in code rather than table.
1598         Handle .ctors and .dtors if ctors_in_init_array.
1599         (Layout::match_file_name): New function, moved from output.cc.
1600         * layout.h (class Layout): Update declarations.
1601         * output.cc: Include "layout.h".
1602         (Input_section_sort_entry::get_priority): New function.
1603         (Input_section_sort_entry::match_file_name): Just call
1604         Layout::match_file_name.
1605         (Output_section::Input_section_sort_init_fini_compare::operator()):
1606         Handle .ctors and .dtors.  Sort by explicit priority rather than
1607         by name.
1608         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1609         * testsuite/initpri2.c: New test.
1610         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1611         (check_PROGRAMS): Add initpri2.
1612         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1613         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1614         * configure, testsuite/Makefile.in: Rebuild.
1615
1616 2011-06-19  Ian Lance Taylor  <iant@google.com>
1617
1618         PR gold/12880
1619         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1620         .interp section to a PT_INTERP segment even if we have seen a
1621         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1622         clause in a linker script.
1623         (Layout::finalize): Don't create a .interp section if we've
1624         already create a PT_INTERP segment.
1625         (Layout::create_interp): Always call choose_output_section (revert
1626         patch of 2011-06-17).  Don't create PT_INTERP segment.
1627         * script-sections.cc
1628         (Script_sections::create_note_and_tls_segments): Add a .interp
1629         section to a PT_INTERP segment even if we have seen a
1630         --dynamic-linker option.
1631
1632 2011-06-18  Ian Lance Taylor  <iant@google.com>
1633
1634         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1635         merely because a non-PT_LOAD segment has a dynamic reloc.
1636
1637 2011-06-18  Ian Lance Taylor  <iant@google.com>
1638
1639         * layout.cc (Layout::finish_dynamic_section): Don't create
1640         DT_FLAGS entry if not needed.
1641
1642 2011-06-18  Ian Lance Taylor  <iant@google.com>
1643
1644         PR gold/12745
1645         * layout.cc (Layout::layout_eh_frame): Correct handling of
1646         writable .eh_frame section.
1647
1648 2011-06-17  Ian Lance Taylor  <iant@google.com>
1649
1650         PR gold/12893
1651         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1652         symbol is redefined with the exact same object and value.
1653
1654 2011-06-17  Ian Lance Taylor  <iant@google.com>
1655
1656         PR gold/12880
1657         * layout.h (class Layout): Add interp_segment_ field.
1658         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1659         (Layout::attach_allocated_section_to_segment): If making shared
1660         library, put .interp section in PT_INTERP segment.
1661         (Layout::finalize): Also call create_interp if -dynamic-linker
1662         option was used.
1663         (Layout::create_interp): Assert that there is no PT_INTERP
1664         segment.  If not using a SECTIONS clause, use make_output_section.
1665         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1666         * script-sections.cc
1667         (Script_sections::create_note_and_tls_segments): If making shared
1668         library, put .interp section in PT_INTERP segment.
1669
1670 2011-06-17  Ian Lance Taylor  <iant@google.com>
1671
1672         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1673         when making a shared library.
1674
1675 2011-06-17  Ian Lance Taylor  <iant@google.com>
1676
1677         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1678         parameter.  Change all callers.  Don't issue warning about PC32
1679         against locally defined symbol.
1680
1681 2011-06-16  Ian Lance Taylor  <iant@google.com>
1682
1683         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1684         occurs in same object.
1685
1686 2011-06-14  Alan Modra  <amodra@gmail.com>
1687
1688         * po/POTFILES.in: Regenerate.
1689
1690 2011-06-09  Ian Lance Taylor  <iant@google.com>
1691
1692         * script-sections.cc
1693         (Orphan_output_section::set_section_addresses): For a relocatable
1694         link set address to 0.
1695
1696 2011-06-09  Cary Coutant  <ccoutant@google.com>
1697
1698         PR gold/12804
1699         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1700         used with --compress-debug-sections.
1701         * gold/object.cc (Sized_relobj_file::do_layout): Report
1702         uncompressed size of compressed input sections.
1703
1704 2011-06-08  Cary Coutant  <ccoutant@google.com>
1705
1706         PR gold/12804
1707         * testsuite/two_file_test_2_v1.cc: Change initialization of
1708         v2 to keep it in .data.
1709
1710 2011-06-07  Cary Coutant  <ccoutant@google.com>
1711
1712         * common.cc (Symbol_table::do_allocate_commons_list): Call
1713         gold_fallback.
1714         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1715         (Errors::fallback): New function.
1716         (gold_fallback): New function.
1717         * errors.h (Errors::fallback): New function.
1718         * gold.cc (gold_exit): Change status parameter to enum; adjust
1719         all callers.
1720         (queue_initial_tasks): Call gold_fallback.
1721         * gold.h: Include cstdlib.
1722         (Exit_status): New enum type.
1723         (gold_exit): Change status parameter to enum.
1724         (gold_fallback): New function.
1725         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1726         (Layout::create_symtab_sections): Likewise.
1727         (Layout::create_shdrs): Likewise.
1728         * main.cc (main): Adjust call to gold_exit.
1729         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1730         (Output_data_got::add_got_entry_pair): Likewise.
1731         (Output_section::add_input_section): Likewise.
1732         (Output_section::add_output_section_data): Likewise.
1733         (Output_segment::set_section_list_addresses): Likewise.
1734         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1735
1736 2011-06-07  Cary Coutant  <ccoutant@google.com>
1737
1738         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1739         for incremental links.
1740         * output.cc (Output_segment::set_section_list_addresses): Remove
1741         FIXME and test for TLS or BSS.
1742
1743 2011-06-07  Cary Coutant  <ccoutant@google.com>
1744
1745         * testsuite/Makefile.am: Add incremental_copy_test,
1746         incremental_common_test_1.
1747         * testsuite/Makefile.in: Regenerate.
1748         * testsuite/common_test_1_v1.c: New source file.
1749         * testsuite/common_test_1_v2.c: New source file.
1750         * testsuite/copy_test_v1.cc: New source file.
1751
1752 2011-06-07  Cary Coutant  <ccoutant@google.com>
1753
1754         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1755         update, allocate common from bss section's free list.
1756         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1757         linker-defined symbols.
1758         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1759         Skip GOT and PLT entries that are no longer referenced.
1760         (Output_section_incremental_inputs::write_info_blocks): Mark
1761         linker-defined symbols.
1762         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1763         * output.cc (Output_section::allocate): New function.
1764         * output.h (Output_section::allocate): New function.
1765         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1766         linker-defined symbols.
1767         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1768         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1769         (Symbol::init_base_output_data): Likewise.
1770         (Symbol::init_base_output_segment): Likewise.
1771         (Symbol::init_base_constant): Likewise.
1772         (Sized_symbol::init_output_data): Likewise.
1773         (Sized_symbol::init_output_segment): Likewise.
1774         (Sized_symbol::init_constant): Likewise.
1775         (Symbol_table::do_define_in_output_data): Likewise.
1776         (Symbol_table::do_define_in_output_segment): Likewise.
1777         (Symbol_table::do_define_as_constant): Likewise.
1778         * symtab.h (Symbol::is_predefined): New function.
1779         (Symbol::init_base_output_data): Add is_predefined parameter.
1780         (Symbol::init_base_output_segment): Likewise.
1781         (Symbol::init_base_constant): Likewise.
1782         (Symbol::is_predefined_): New data member.
1783         (Sized_symbol::init_output_data): Add is_predefined parameter.
1784         (Sized_symbol::init_output_segment): Likewise.
1785         (Sized_symbol::init_constant): Likewise.
1786         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1787
1788 2011-06-07  Cary Coutant  <ccoutant@google.com>
1789
1790         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1791         instead of emit_copy_reloc.
1792         (Copy_relocs::emit_copy_reloc): Refactor.
1793         (Copy_relocs::make_copy_reloc): New function.
1794         (Copy_relocs::add_copy_reloc): Remove.
1795         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1796         section.
1797         (Copy_relocs::make_copy_reloc): New function.
1798         (Copy_relocs::add_copy_reloc): Remove.
1799         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1800         unchanged input files.
1801         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1802         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1803         Reserve BSS space for COPY relocations.
1804         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1805         (Output_section_incremental_inputs::write_info_blocks): Record
1806         whether a symbol is copied from a shared object.
1807         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1808         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1809         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1810         (Incremental_input_entry_reader::get_output_symbol_index): Add
1811         is_copy parameter.
1812         (Incremental_binary::emit_copy_relocs): New function.
1813         (Incremental_binary::do_emit_copy_relocs): New function.
1814         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1815         new data member.
1816         (Sized_incremental_binary::add_copy_reloc): New function.
1817         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1818         (Sized_incremental_binary::Copy_reloc): New struct.
1819         (Sized_incremental_binary::Copy_relocs): New typedef.
1820         (Sized_incremental_binary::copy_relocs_): New data member.
1821         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1822         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1823         * target.h (Sized_target::emit_copy_reloc): New function.
1824         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1825
1826 2011-06-02  Cary Coutant  <ccoutant@google.com>
1827
1828         PR gold/12163
1829         * gold/archive.cc (Archive::Archive): Initialize new data member.
1830         (Archive::include_all_members): Return if archive has already been
1831         included.
1832         * gold/archive.h (Archive::include_all_members_): New data member.
1833
1834 2011-06-02  Nick Clifton  <nickc@redhat.com>
1835
1836         * dynobj.h: Fix spelling mistake in comment.
1837         * output.cc: Likewise.
1838
1839 2011-05-31  Doug Kwan  <dougkwan@google.com>
1840             Asier Llano
1841
1842         PR gold/12826
1843         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1844         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1845         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1846         redundant arm_exidx_test.so.
1847         * testsuite/Makefile.in: Regenerate.
1848         (check_SCRIPTS): Add pr12826.sh
1849         (check_DATA): Add pr12826.stdout
1850         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1851         * testsuite/pr12826.sh: New file.
1852         * testsuite/pr12826_1.s: Ditto.
1853         * testsuite/pr12826_1.s: Ditto.
1854
1855 2011-05-30  Ian Lance Taylor  <iant@google.com>
1856
1857         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1858         sections.
1859
1860 2011-05-29  Ian Lance Taylor  <iant@google.com>
1861
1862         PR gold/12804
1863         * testsuite/Makefile.am: Use different file name for two_file_test
1864         temporary file for each incremental test.
1865         * testsuite/Makefile.in: Rebuild.
1866
1867 2011-05-29  Ian Lance Taylor  <iant@google.com>
1868
1869         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1870         binary input file is empty.
1871
1872 2011-05-27  Ian Lance Taylor  <iant@google.com>
1873
1874         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1875         (ver_test_9.so): Likewise.
1876         * testsuite/Makefile.in: Rebuild.
1877
1878 2011-05-26 Cary Coutant  <ccoutant@google.com>
1879
1880         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1881         * incremental.cc (Incremental_inputs::report_input_section): Fix
1882         comment, indentation.
1883         (Incremental_inputs::report_comdat_group): New function.
1884         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1885         of data for incremental input file entry.
1886         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1887         group count, COMDAT group signatures.
1888         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1889         an unchanged input file.
1890         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1891         Initialize new data member.
1892         (Incremental_object_entry::add_comdat_group): New function.
1893         (Incremental_object_entry::get_comdat_group_count): New function.
1894         (Incremental_object_entry::get_comdat_signature_key): New function.
1895         (Incremental_object_entry::groups_): New data member.
1896         (Incremental_inputs::report_comdat_group): New function.
1897         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1898         data for incremental input file entry.
1899         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1900         (Incremental_input_entry_reader::get_input_section): Adjust size of
1901         data for incremental input file entry.
1902         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1903         (Incremental_input_entry_reader::get_comdat_group_signature): New
1904         function.
1905         * object.cc (Sized_relobj::include_section_group): Report kept
1906         COMDAT groups for incremental links.
1907
1908 2011-05-24  David Meyer  <pdox@google.com>
1909
1910         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1911         with name parameter.  Add found_name parameter.
1912         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1913         * dirsearch.h (class Dirsearch): Update declaration.
1914
1915 2011-05-24  Ian Lance Taylor  <iant@google.com>
1916
1917         * archive.cc (Library_base::should_include_member): Pull in object
1918         from archive if it defines the entry symbol.
1919         * parameters.cc (Parameters::entry): New function.
1920         * parameters.h (class Parameters): Declare entry.
1921         * output.h (class Output_file_header): Remove entry_ field.
1922         * output.cc (Output_file_header::Output_file_header): Remove entry
1923         parameter.  Change all callers.
1924         (Output_file_header::entry): Use parameters->entry.
1925         * gold.cc (queue_middle_tasks): Likewise.
1926         * plugin.cc (Plugin_hook::run): Likewise.
1927
1928 2011-05-24 Cary Coutant  <ccoutant@google.com>
1929
1930         * gold.cc (queue_initial_tasks): Pass incremental base filename
1931         to Output_file::open_base_file; don't print error message.
1932         * incremental-dump.cc (main): Adjust call to
1933         Output_file::open_for_modification.
1934         * incremental-dump.cc (main): Likewise.
1935         * incremental.cc (Incremental_inputs::report_command_line):
1936         Ignore --incremental-base option when comparing command lines.
1937         Ignore parameter when given as separate argument.
1938         * options.h (class General_options): Add --incremental-base.
1939         * output.cc (Output_file::Output_file):
1940         (Output_file::open_base_file): Add base_name and writable parameters;
1941         read base file into new file; print error message here.
1942         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1943         callers.
1944         * output.h (Output_file::open_for_modification): Rename to...
1945         (Output_file::open_base_file): ...this; add base_name and
1946         writable parameters; adjust all callers.
1947         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1948         callers.
1949         * testsuite/Makefile.am (incremental_test_4): Test
1950         --incremental-base.
1951         * testsuite/Makefile.in: Regenerate.
1952
1953 2011-05-24 Cary Coutant  <ccoutant@google.com>
1954
1955         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1956         incremental_test_4.
1957         * testsuite/Makefile.in: Regenerate.
1958         * testsuite/two_file_test_1_v1.cc: New test source file.
1959         * testsuite/two_file_test_1b_v1.cc: New test source file.
1960         * testsuite/two_file_test_2_v1.cc: New test source file.
1961
1962 2011-05-24 Cary Coutant  <ccoutant@google.com>
1963
1964         * dynobj.h (Dynobj::do_dynobj): New function.
1965         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1966         flag and soname for shared objects.
1967         * incremental.cc (Incremental_inputs::report_object): Make
1968         either Incremental_object_entry or Incremental_dynobj_entry; add
1969         soname to string table.
1970         (Incremental_inputs::report_input_section): Add assertion.
1971         (Output_section_incremental_inputs::set_final_data_size): Adjust
1972         type of input file entry for shared libraries; adjust size of
1973         shared library info entry.
1974         (Output_section_incremental_inputs::write_input_files): Write
1975         as_needed flag for shared libraries.
1976         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1977         of input file entry for shared libraries; write soname.
1978         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1979         soname from incremental info.
1980         * incremental.h (enum Incremental_input_flags): Add
1981         INCREMENTAL_INPUT_AS_NEEDED.
1982         (Incremental_input_entry::Incremental_input_entry): Initialize new
1983         data member.
1984         (Incremental_input_entry::set_as_needed): New function.
1985         (Incremental_input_entry::as_needed): New function.
1986         (Incremental_input_entry::do_dynobj_entry): New function.
1987         (Incremental_input_entry::as_needed_): New data member.
1988         (Incremental_object_entry::Incremental_object_entry): Don't check
1989         for shared library.
1990         (Incremental_object_entry::do_type): Likewise.
1991         (class Incremental_dynobj_entry): New class.
1992         (Incremental_input_entry_reader::as_needed): New function.
1993         (Incremental_input_entry_reader::get_soname): New function.
1994         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1995         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1996         size of shared library info entry.
1997         * layout.cc (Layout::finish_dynamic_section): Don't test for
1998         incremental link when adding DT_NEEDED entries.
1999         * object.h (Object::Object): Initialize new data member.
2000         (Object::dynobj): New function.
2001         (Object::set_as_needed): New function.
2002         (Object::as_needed): New function.
2003         (Object::do_dynobj): New function.
2004         (Object::as_needed_): New data member.
2005
2006 2011-05-24 Cary Coutant  <ccoutant@google.com>
2007
2008         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2009         info; adjust display of GOT entries.
2010         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2011         vector of input objects; remove file_status_.
2012         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2013         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2014         got_plt reader; call target hooks to reserve GOT entries.
2015         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2016         of input file info header and GOT info entry.
2017         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2018         relocation info.
2019         (Got_plt_view_info::got_descriptor): Remove.
2020         (Got_plt_view_info::sym_index): New data member.
2021         (Got_plt_view_info::input_index): New data member.
2022         (Local_got_offset_visitor::visit): Write input file index.
2023         (Global_got_offset_visitor::visit): Write 0 for input file index.
2024         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2025         with sym_index and input_index.
2026         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2027         incremental info GOT entry; replace got_descriptor with input_index.
2028         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2029         map from input file index to object.
2030         (Sized_relobj_incr::do_layout): Replace direct data member reference
2031         with accessor function.
2032         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2033         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2034         Adjust size of input file info header.
2035         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2036         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2037         (Incremental_input_entry_reader::get_input_section): Adjust size of
2038         input file info header.
2039         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2040         of incremental info GOT entry.
2041         (Incremental_got_plt_reader::get_got_desc): Remove.
2042         (Incremental_got_plt_reader::get_got_symndx): New function.
2043         (Incremental_got_plt_reader::get_got_input_index): New function.
2044         (Sized_incremental_binary::Sized_incremental_binary): Remove
2045         file_status_; add input_objects_.
2046         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2047         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2048         (Sized_incremental_binary::file_is_unchanged): Remove.
2049         (Sized_incremental_binary::set_input_object): New function.
2050         (Sized_incremental_binary::input_object): New function.
2051         (Sized_incremental_binary::file_status_): Remove.
2052         (Sized_incremental_binary::input_objects_): New data member.
2053         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2054         references.
2055         (Sized_relobj_incr::invalid_address): Move to base class.
2056         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2057         class.
2058         (Sized_relobj_incr::do_output_section_offset): Likewise.
2059         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2060         (Sized_relobj_incr::section_offsets_): Likewise.
2061         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2062         function.
2063         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2064         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2065         with accessor function.
2066         (Sized_relobj_file::do_layout): Likewise.
2067         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2068         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2069         (Sized_relobj_file::compute_final_local_value): Replace refs to
2070         section_offsets_ with accessor function.
2071         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2072         * object.h (Relobj::Relobj): Initialize new data members.
2073         (Relobj::add_dyn_reloc): New function.
2074         (Relobj::first_dyn_reloc): New function.
2075         (Relobj::dyn_reloc_count): New function.
2076         (Relobj::first_dyn_reloc_): New data member.
2077         (Relobj::dyn_reloc_count_): New data member.
2078         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2079         references.
2080         (Sized_relobj::Address): New typedef.
2081         (Sized_relobj::invalid_address): Move here from child class.
2082         (Sized_relobj::Sized_relobj): Initialize new data members.
2083         (Sized_relobj::sized_relobj): New function.
2084         (Sized_relobj::is_output_section_offset_invalid): Move here from
2085         child class.
2086         (Sized_relobj::get_output_section_offset): Likewise.
2087         (Sized_relobj::local_has_got_offset): Likewise.
2088         (Sized_relobj::local_got_offset): Likewise.
2089         (Sized_relobj::set_local_got_offset): Likewise.
2090         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2091         (Sized_relobj::clear_got_offsets): New function.
2092         (Sized_relobj::section_offsets): Move here from child class.
2093         (Sized_relobj::do_output_section_offset): Likewise.
2094         (Sized_relobj::do_set_section_offset): Likewise.
2095         (Sized_relobj::Local_got_offsets): Likewise.
2096         (Sized_relobj::local_got_offsets_): Likewise.
2097         (Sized_relobj::section_offsets_): Likewise.
2098         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2099         references.
2100         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2101         class.
2102         (Sized_relobj_file::sized_relobj): New function
2103         (Sized_relobj_file::local_has_got_offset): Move to base class.
2104         (Sized_relobj_file::local_got_offset): Likewise.
2105         (Sized_relobj_file::set_local_got_offset): Likewise.
2106         (Sized_relobj_file::get_output_section_offset): Likewise.
2107         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2108         (Sized_relobj_file::do_output_section_offset): Likewise.
2109         (Sized_relobj_file::do_set_section_offset): Likewise.
2110         (Sized_relobj_file::Local_got_offsets): Likewise.
2111         (Sized_relobj_file::local_got_offsets_): Likewise.
2112         (Sized_relobj_file::section_offsets_): Likewise.
2113         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2114         (all constructors).
2115         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2116         (Output_reloc::get_symbol_index): Likewise.
2117         (Output_reloc::local_section_offset): Likewise.
2118         (Output_reloc::get_address): Likewise.
2119         (Output_reloc::symbol_value): Likewise.
2120         (Output_data_got::reserve_slot): Move to class definition.
2121         (Output_data_got::reserve_local): New function.
2122         (Output_data_got::reserve_slot_for_global): Remove.
2123         (Output_data_got::reserve_global): New function.
2124         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2125         (all constructors, two instantiations).
2126         (Output_reloc::get_relobj): New function (two instantiations).
2127         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2128         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2129         (Output_data_reloc::add_global): Adjust type of relobj.
2130         (Output_data_reloc::add_global_relative): Likewise.
2131         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2132         (Output_data_reloc::add_local): Likewise.
2133         (Output_data_reloc::add_local_relative): Likewise.
2134         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2135         (Output_data_reloc::add_local_section): Likewise.
2136         (Output_data_reloc::add_output_section): Likewise.
2137         (Output_data_reloc::add_absolute): Likewise.
2138         (Output_data_reloc::add_target_specific): Likewise.
2139         (Output_data_got::reserve_slot): Move definition here.
2140         (Output_data_got::reserve_local): New function.
2141         (Output_data_got::reserve_global): New function.
2142         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2143         section_offsets_ with accessor function.
2144         (Sized_relobj_file::write_sections): Likewise.
2145         (Sized_relobj_file::do_relocate_sections): Likewise.
2146         * target.h (Sized_target::reserve_local_got_entry): New function.
2147         (Sized_target::reserve_global_got_entry): New function.
2148         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2149         (Target_x86_64::reserve_global_got_entry): New function.
2150         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2151
2152 2011-05-23 Cary Coutant  <ccoutant@google.com>
2153
2154         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2155         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2156         bit when checking got_type.
2157         * incremental.cc (Sized_incremental_binary::setup_readers):
2158         Store symbol table and string table locations; initialize bit vector
2159         of file status flags.
2160         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2161         unchanged files.
2162         (Sized_incremental_binary::do_process_got_plt): New function.
2163         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2164         (Output_section_incremental_inputs::set_final_data_size): Record
2165         file index for each input file.
2166         (Output_section_incremental_inputs::write_got_plt): Store file index
2167         instead of input entry offset for each GOT entry.
2168         * incremental.h
2169         (Incremental_input_entry::Incremental_input_entry): Initialize new
2170         data member.
2171         (Incremental_input_entry::set_offset): Store file index.
2172         (Incremental_input_entry::get_file_index): New function.
2173         (Incremental_input_entry::file_index_): New data member.
2174         (Incremental_binary::process_got_plt): New function.
2175         (Incremental_binary::do_process_got_plt): New function.
2176         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2177         data members.
2178         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2179         (Sized_incremental_binary::set_file_is_unchanged): New function.
2180         (Sized_incremental_binary::file_is_unchanged): New function.
2181         (Sized_incremental_binary::do_process_got_plt): New function.
2182         (Sized_incremental_binary::file_status_): New data member.
2183         (Sized_incremental_binary::main_symtab_loc_): New data member.
2184         (Sized_incremental_binary::main_strtab_loc_): New data member.
2185         * output.cc (Output_data_got::Got_entry::write): Add case
2186         RESERVED_CODE.
2187         (Output_data_got::add_global): Call add_got_entry.
2188         (Output_data_got::add_global_plt): Likewise.
2189         (Output_data_got::add_global_with_rel): Likewise.
2190         (Output_data_got::add_global_with_rela): Likewise.
2191         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2192         (Output_data_got::add_global_pair_with_rela): Likewise.
2193         (Output_data_got::add_local): Call add_got_entry.
2194         (Output_data_got::add_local_plt): Likewise.
2195         (Output_data_got::add_local_with_rel): Likewise.
2196         (Output_data_got::add_local_with_rela): Likewise.
2197         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2198         (Output_data_got::add_local_pair_with_rela): Likewise.
2199         (Output_data_got::reserve_slot): New function.
2200         (Output_data_got::reserve_slot_for_global): New function.
2201         (Output_data_got::add_got_entry): New function.
2202         (Output_data_got::add_got_entry_pair): New function.
2203         (Output_section::add_output_section_data): Edit FIXME.
2204         * output.h
2205         (Output_section_data_build::Output_section_data_build): New
2206         constructor with size parameter.
2207         (Output_data_space::Output_data_space): Likewise.
2208         (Output_data_got::Output_data_got): Initialize new data member; new
2209         constructor with size parameter.
2210         (Output_data_got::add_constant): Call add_got_entry.
2211         (Output_data_got::reserve_slot): New function.
2212         (Output_data_got::reserve_slot_for_global): New function.
2213         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2214         (Output_data_got::add_got_entry): New function.
2215         (Output_data_got::add_got_entry_pair): New function.
2216         (Output_data_got::free_list_): New data member.
2217         * target.h (Sized_target::init_got_plt_for_update): New function.
2218         (Sized_target::register_global_plt_entry): New function.
2219         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2220         Initialize new data member; call init; add constructor with PLT count.
2221         (Output_data_plt_x86_64::init): New function.
2222         (Output_data_plt_x86_64::add_relocation): New function.
2223         (Output_data_plt_x86_64::reserve_slot): New function.
2224         (Output_data_plt_x86_64::free_list_): New data member.
2225         (Target_x86_64::init_got_plt_for_update): New function.
2226         (Target_x86_64::register_global_plt_entry): New function.
2227         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2228         incremental updates.
2229         (Output_data_plt_x86_64::add_relocation): New function.
2230         * testsuite/object_unittest.cc (Object_test): Set default options.
2231
2232 2011-05-16  Ian Lance Taylor  <iant@google.com>
2233
2234         * options.h (class General_options): Make -i a synonym for -r.
2235
2236 2011-05-16  Ian Lance Taylor  <iant@google.com>
2237
2238         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2239
2240 2011-05-10 Cary Coutant  <ccoutant@google.com>
2241
2242         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2243         strip_all (-s).
2244
2245 2011-05-06  Ian Lance Taylor  <iant@google.com>
2246
2247         * layout.cc (Layout::layout): If the output section flags change,
2248         update the ordering.
2249
2250 2011-04-25 Cary Coutant  <ccoutant@google.com>
2251
2252         * incremental-dump.cc (dump_incremental_inputs): Print local
2253         symbol info for each input file.
2254         * incremental.cc
2255         (Output_section_incremental_inputs::set_final_data_size): Add local
2256         symbol info to input file entries in incremental info.
2257         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2258         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2259         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2260         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2261         implementation.
2262         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2263         (Sized_incr_relobj::do_relocate): Write the local symbols.
2264         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2265         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2266         Adjust size of input file header.
2267         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2268         (Incremental_inputs_reader::get_local_symbol_count): New function.
2269         (Incremental_inputs_reader::get_input_section): Adjust size of input
2270         file header.
2271         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2272         (Sized_incr_relobj::This): New typedef.
2273         (Sized_incr_relobj::sym_size): New const data member.
2274         (Sized_incr_relobj::Local_symbol): New struct.
2275         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2276         (Sized_incr_relobj::do_local_symbol_offset): New function.
2277         (Sized_incr_relobj::local_symbol_count_): New data member.
2278         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2279         (Sized_incr_relobj::local_symbol_index_): New data member.
2280         (Sized_incr_relobj::local_symbol_offset_): New data member.
2281         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2282         (Sized_incr_relobj::local_symbols_): New data member.
2283         * object.h (Relobj::output_local_symbol_count): New function.
2284         (Relobj::local_symbol_offset): New function.
2285         (Relobj::do_output_local_symbol_count): New function.
2286         (Relobj::do_local_symbol_offset): New function.
2287         (Sized_relobj::do_output_local_symbol_count): New function.
2288         (Sized_relobj::do_local_symbol_offset): New function.
2289
2290 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2291
2292         * descriptors.cc (set_close_on_exec): New function.
2293         (Descriptors::open): Use set_close_on_exec.
2294         * output.cc (S_ISLNK): Define if not defined.
2295
2296 2011-04-22 Cary Coutant  <ccoutant@google.com>
2297
2298         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2299         global symbol map.
2300         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2301         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2302         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2303         relocations.
2304         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2305         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2306         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2307         * incremental.h
2308         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2309         function.
2310         (Incremental_binary::apply_incremental_relocs): New function.
2311         (Incremental_binary::do_apply_incremental_relocs): New function.
2312         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2313         data member.
2314         (Sized_incremental_binary::add_global_symbol): New function.
2315         (Sized_incremental_binary::global_symbol): New function.
2316         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2317         (Sized_incremental_binary::symbol_map_): New data member.
2318         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2319         * target.h (Sized_target::apply_relocation): New function.
2320         * target-reloc.h (apply_relocation): New function.
2321         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2322
2323 2011-04-22  Doug Kwan  <dougkwan@google.com>
2324
2325         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2326         flag of a SHT_ARM_EXIDX section.
2327         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2328         * testsuite/Makefile.in: Regenerate.
2329         * testsuite/arm_exidx_test.s: New file.
2330         * testsuite/arm_exidx_test.sh: Same.
2331
2332 2011-04-20 Cary Coutant  <ccoutant@google.com>
2333
2334         PR gold/12689
2335         * archive.h (Incremental_archive_entry::Archive_member):
2336         Initialize arg_serial_ (second constructor).
2337
2338 2011-04-17  Ian Lance Taylor  <iant@google.com>
2339
2340         * object.cc (Relocate_info::location): Simplify location string.
2341         * errors.cc (Errors::error_at_location): Don't print program
2342         name.
2343         (Errors::warning_at_location): Likewise.
2344         (Errors::undefined_symbol): Likewise.
2345         * testsuite/debug_msg.sh: Update accordingly.
2346
2347 2011-04-14 Cary Coutant  <ccoutant@google.com>
2348
2349         * gold/layout.cc (Layout::symtab_section_offset): New function.
2350         * gold/layout.h (Layout::symtab_section_offset): New function.
2351         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2352
2353 2011-04-12  Ian Lance Taylor  <iant@google.com>
2354
2355         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2356         with MREMAP_MAYMOVE.
2357         * output.h (class Output_file): Add map_is_allocated_ field.
2358         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2359         not available, provide stubs.  If mremap is not available, #define
2360         it to gold_mremap.
2361         (MREMAP_MAYMOVE): Define if not defined.
2362         (Output_file::Output_file): Initialize map_is_allocated_.
2363         (Output_file::resize): Check map_is_allocated_.
2364         (Output_file::map_anonymous): If mmap fails, use malloc.
2365         (Output_file::unmap): Don't do anything for an anonymous map.
2366         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2367         is not available, provide stubs.
2368         (File_read::View::~View): Use free rather than delete[].
2369         (File_read::make_view): Use malloc rather than new[].  If mmap
2370         fails, use malloc.
2371         (File_read::find_or_make_view): Use malloc rather than new[].
2372         * gold.h: Remove HAVE_REMAP code.
2373         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2374         exists.  Rename mremap to gold_mremap.  If mmap is not available
2375         don't do anything.
2376         * configure, config.in: Rebuild.
2377
2378 2011-04-11  Ian Lance Taylor  <iant@google.com>
2379
2380         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2381         initialize local variable v.
2382
2383 2011-04-11  Cary Coutant  <ccoutant@google.com>
2384
2385         * archive.cc (Archive::include_member): Adjust call to
2386         report_object.
2387         (Add_archive_symbols::run): Track argument serial numbers.
2388         (Lib_group::include_member): Likewise.
2389         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2390         * archive.h (Incremental_archive_entry::Archive_member):
2391         Initialize arg_serial_.
2392         (Archive_member::arg_serial_): New data member.
2393         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2394         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2395         incremental link.
2396         (Sized_dynobj::do_for_all_local_got_entries): New function.
2397         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2398         function.
2399         * fileread.cc (get_mtime): New function.
2400         * fileread.h (get_mtime): New function.
2401         * gold.cc (queue_initial_tasks): Check for incremental update.
2402         (process_incremental_input): New function.
2403         (queue_middle_tasks): Don't force valid target for incremental
2404         update.
2405         * incremental-dump.cc (find_input_containing_global): Adjust
2406         size of symbol info entry.
2407         (dump_incremental_inputs): Dump argument serial number and
2408         in_system_directory flag; bias shndx by 1; print symbol names
2409         when dumping per-file symbol lists; use new symbol info readers.
2410         * incremental.cc
2411         (Output_section_incremental_inputs:update_data_size): New function.
2412         (Sized_incremental_binary::setup_readers): Setup input readers
2413         for each input file; build maps for files added from libraries
2414         and scripts.
2415         (Sized_incremental_binary::check_input_args): New function.
2416         (Sized_incremental_binary::do_check_inputs): Build map of argument
2417         serial numbers to input arguments.
2418         (Sized_incremental_binary::do_file_has_changed): Rename
2419         do_file_is_unchanged to this; compare file modification times.
2420         (Sized_incremental_binary::do_init_layout): New function.
2421         (Sized_incremental_binary::do_reserve_layout): New function.
2422         (Sized_incremental_binary::do_get_input_reader): Remove.
2423         (Sized_incremental_binary::get_symtab_view): New function.
2424         (Incremental_checker::can_incrementally_link_output_file): Remove.
2425         (Incremental_inputs::report_command_line): Exclude --debug options.
2426         (Incremental_inputs::report_archive_begin): Add parameter; track
2427         argument serial numbers; don't put input file entry for archive
2428         before archive members.
2429         (Incremental_inputs::report_archive_end): Put input file entry
2430         for archive after archive members.
2431         (Incremental_inputs::report_object): Add parameter; track argument
2432         serial numbers and in_system_directory flag.
2433         (Incremental_inputs::report_script): Add parameter; track argument
2434         serial numbers.
2435         (Output_section_incremental_inputs::set_final_data_size): Adjust
2436         size of symbol info entry; check for forwarding symbols.
2437         (Output_section_incremental_inputs::write_input_files): Write
2438         in_system_directory flag and argument serial number.
2439         (Output_section_incremental_inputs::write_info_blocks): Map section
2440         indices between incremental info and original input file; store
2441         input section index for each symbol.
2442         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2443         change operator() to visit().
2444         (class Global_got_offset_visitor): Likewise.
2445         (class Global_symbol_visitor_got_plt):
2446         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2447         classes.
2448         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2449         (Sized_incr_relobj::do_read_symbols): New function.
2450         (Sized_incr_relobj::do_layout): New function.
2451         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2452         (Sized_incr_relobj::do_add_symbols): New function.
2453         (Sized_incr_relobj::do_should_include_member): New function.
2454         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2455         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2456         (Sized_incr_relobj::do_section_size): New function.
2457         (Sized_incr_relobj::do_section_name): New function.
2458         (Sized_incr_relobj::do_section_contents): New function.
2459         (Sized_incr_relobj::do_section_flags): New function.
2460         (Sized_incr_relobj::do_section_entsize): New function.
2461         (Sized_incr_relobj::do_section_address): New function.
2462         (Sized_incr_relobj::do_section_type): New function.
2463         (Sized_incr_relobj::do_section_link): New function.
2464         (Sized_incr_relobj::do_section_info): New function.
2465         (Sized_incr_relobj::do_section_addralign): New function.
2466         (Sized_incr_relobj::do_initialize_xindex): New function.
2467         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2468         (Sized_incr_relobj::do_read_relocs): New function.
2469         (Sized_incr_relobj::do_gc_process_relocs): New function.
2470         (Sized_incr_relobj::do_scan_relocs): New function.
2471         (Sized_incr_relobj::do_count_local_symbols): New function.
2472         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2473         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2474         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2475         (Sized_incr_relobj::do_relocate): New function.
2476         (Sized_incr_relobj::do_set_section_offset): New function.
2477         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2478         (Sized_incr_dynobj::do_read_symbols): New function.
2479         (Sized_incr_dynobj::do_layout): New function.
2480         (Sized_incr_dynobj::do_add_symbols): New function.
2481         (Sized_incr_dynobj::do_should_include_member): New function.
2482         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2483         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2484         (Sized_incr_dynobj::do_section_size): New function.
2485         (Sized_incr_dynobj::do_section_name): New function.
2486         (Sized_incr_dynobj::do_section_contents): New function.
2487         (Sized_incr_dynobj::do_section_flags): New function.
2488         (Sized_incr_dynobj::do_section_entsize): New function.
2489         (Sized_incr_dynobj::do_section_address): New function.
2490         (Sized_incr_dynobj::do_section_type): New function.
2491         (Sized_incr_dynobj::do_section_link): New function.
2492         (Sized_incr_dynobj::do_section_info): New function.
2493         (Sized_incr_dynobj::do_section_addralign): New function.
2494         (Sized_incr_dynobj::do_initialize_xindex): New function.
2495         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2496         (make_sized_incremental_object): New function.
2497         (Incremental_library::copy_unused_symbols): New function.
2498         (Incremental_library::do_for_all_unused_symbols): New function.
2499         * incremental.h (enum Incremental_input_flags): New type.
2500         (class Incremental_checker): Remove.
2501         (Incremental_input_entry::Incremental_input_entry): Add argument
2502         serial number.
2503         (Incremental_input_entry::arg_serial): New function.
2504         (Incremental_input_entry::set_is_in_system_directory): New function.
2505         (Incremental_input_entry::is_in_system_directory): New function.
2506         (Incremental_input_entry::arg_serial_): New data member.
2507         (Incremental_input_entry::is_in_system_directory_): New data member.
2508         (class Script_info): Move here from script.h.
2509         (Script_info::Script_info): Add filename parameter.
2510         (Script_info::filename): New function.
2511         (Script_info::filename_): New data member.
2512         (Incremental_script_entry::Incremental_script_entry): Add argument
2513         serial number.
2514         (Incremental_object_entry::Incremental_object_entry): Likewise.
2515         (Incremental_object_entry::add_input_section): Build list of input
2516         sections with map to original shndx.
2517         (Incremental_object_entry::get_input_section_index): New function.
2518         (Incremental_object_entry::shndx_): New data member.
2519         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2520         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2521         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2522         serial number.
2523         (Incremental_inputs::report_archive_begin): Likewise.
2524         (Incremental_inputs::report_object): Likewise.
2525         (Incremental_inputs::report_script): Likewise.
2526         (class Incremental_global_symbol_reader): New class.
2527         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2528         and store flags and input file type.
2529         (Incremental_input_entry_reader::arg_serial): New function.
2530         (Incremental_input_entry_reader::type): Extract type from flags.
2531         (Incremental_input_entry_reader::is_in_system_directory): New function.
2532         (Incremental_input_entry_reader::get_input_section_count): Call
2533         accessor function for type.
2534         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2535         function for type; adjust size of global symbol entry.
2536         (Incremental_input_entry_reader::get_global_symbol_count): Call
2537         accessor function for type.
2538         (Incremental_input_entry_reader::get_object_count): Likewise.
2539         (Incremental_input_entry_reader::get_object_offset): Likewise.
2540         (Incremental_input_entry_reader::get_member_count): Likewise.
2541         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2542         (Incremental_input_entry_reader::get_member_offset): Likewise.
2543         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2544         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2545         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2546         (Incremental_input_entry_reader::get_global_symbol_reader): New
2547         function.
2548         (Incremental_input_entry_reader::get_output_symbol_index): New
2549         function.
2550         (Incremental_input_entry_reader::type_): Remove.
2551         (Incremental_input_entry_reader::flags_): New data member.
2552         (Incremental_inputs_reader::input_file_offset): New function.
2553         (Incremental_inputs_reader::input_file_index): New function.
2554         (Incremental_inputs_reader::input_file): Call input_file_offset.
2555         (Incremental_inputs_reader::input_file_at_offset): New function.
2556         (Incremental_relocs_reader::get_r_type): Reformat.
2557         (Incremental_relocs_reader::get_r_shndx): Reformat.
2558         (Incremental_relocs_reader::get_r_offset): Reformat.
2559         (Incremental_relocs_reader::data): New function.
2560         (Incremental_binary::Incremental_binary): Initialize new data members.
2561         (Incremental_binary::check_inputs): Add cmdline parameter.
2562         (Incremental_binary::file_is_unchanged): Remove.
2563         (Input_reader::arg_serial): New function.
2564         (Input_reader::get_unused_symbol_count): New function.
2565         (Input_reader::get_unused_symbol): New function.
2566         (Input_reader::do_arg_serial): New function.
2567         (Input_reader::do_get_unused_symbol_count): New function.
2568         (Input_reader::do_get_unused_symbol): New function.
2569         (Incremental_binary::input_file_count): New function.
2570         (Incremental_binary::get_input_reader): Change signature to use
2571         index instead of filename.
2572         (Incremental_binary::file_has_changed): New function.
2573         (Incremental_binary::get_input_argument): New function.
2574         (Incremental_binary::get_library): New function.
2575         (Incremental_binary::get_script_info): New function.
2576         (Incremental_binary::init_layout): New function.
2577         (Incremental_binary::reserve_layout): New function.
2578         (Incremental_binary::output_file): New function.
2579         (Incremental_binary::do_check_inputs): New function.
2580         (Incremental_binary::do_file_is_unchanged): Remove.
2581         (Incremental_binary::do_file_has_changed): New function.
2582         (Incremental_binary::do_init_layout): New function.
2583         (Incremental_binary::do_reserve_layout): New function.
2584         (Incremental_binary::do_input_file_count): New function.
2585         (Incremental_binary::do_get_input_reader): Change signature.
2586         (Incremental_binary::input_args_map_): New data member.
2587         (Incremental_binary::library_map_): New data member.
2588         (Incremental_binary::script_map_): New data member.
2589         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2590         new data members.
2591         (Sized_incremental_binary::output_section): New function.
2592         (Sized_incremental_binary::inputs_reader): Add const.
2593         (Sized_incremental_binary::symtab_reader): Add const.
2594         (Sized_incremental_binary::relocs_reader): Add const.
2595         (Sized_incremental_binary::got_plt_reader): Add const.
2596         (Sized_incremental_binary::get_symtab_view): New function.
2597         (Sized_incremental_binary::Inputs_reader): New typedef.
2598         (Sized_incremental_binary::Input_entry_reader): New typedef.
2599         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2600         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2601         (Sized_incremental_binary::do_file_has_changed): New function.
2602         (Sized_incremental_binary::do_init_layout): New function.
2603         (Sized_incremental_binary::do_reserve_layout): New function.
2604         (Sized_input_reader::Inputs_reader): Remove.
2605         (Sized_input_reader::Input_entry_reader): Remove.
2606         (Sized_input_reader::do_arg_serial): New function.
2607         (Sized_input_reader::do_get_unused_symbol_count): New function.
2608         (Sized_input_reader::do_get_unused_symbol): New function.
2609         (Sized_incremental_binary::do_input_file_count): New function.
2610         (Sized_incremental_binary::do_get_input_reader): Change signature;
2611         use index instead of filename.
2612         (Sized_incremental_binary::section_map_): New data member.
2613         (Sized_incremental_binary::input_entry_readers_): New data member.
2614         (class Sized_incr_relobj): New class.
2615         (class Sized_incr_dynobj): New class.
2616         (make_sized_incremental_object): New function.
2617         (class Incremental_library): New class.
2618         * layout.cc (Free_list::num_lists): New static data member.
2619         (Free_list::num_nodes): New static data member.
2620         (Free_list::num_removes): New static data member.
2621         (Free_list::num_remove_visits): New static data member.
2622         (Free_list::num_allocates): New static data member.
2623         (Free_list::num_allocate_visits): New static data member.
2624         (Free_list::init): New function.
2625         (Free_list::remove): New function.
2626         (Free_list::allocate): New function.
2627         (Free_list::dump): New function.
2628         (Free_list::print_stats): New function.
2629         (Layout_task_runner::run): Resize output file for incremental updates.
2630         (Layout::Layout): Initialize new data members.
2631         (Layout::set_incremental_base): New function.
2632         (Layout::init_fixed_output_section): New function.
2633         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2634         incremental updates.
2635         (Layout::create_gold_note): Do not create gold note section for
2636         incremental updates.
2637         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2638         for incremental updates.
2639         (Layout::set_section_offsets): For incremental updates, allocate space
2640         from free list.
2641         (Layout::create_symtab_sections): Layout with offsets relative to
2642         start of section; for incremental updates, allocate space from free
2643         list.
2644         (Layout::create_shdrs): For incremental updates, allocate space from
2645         free list.
2646         (Layout::finish_dynamic_section): For incremental updates, do not
2647         check --as-needed (fixed in subsequent patch).
2648         * layout.h (class Free_list): New class.
2649         (Layout::set_incremental_base): New function.
2650         (Layout::incremental_base): New function.
2651         (Layout::init_fixed_output_section): New function.
2652         (Layout::allocate): New function.
2653         (Layout::incremental_base_): New data member.
2654         (Layout::free_list_): New data member.
2655         * main.cc (main): Print Free_list statistics.
2656         * object.cc (Relobj::finalize_incremental_relocs): Add
2657         clear_counts parameter; clear counts only when clear_counts is set.
2658         (Sized_relobj::Sized_relobj): Initialize new base class.
2659         (Sized_relobj::do_layout): Don't report special sections.
2660         (Sized_relobj::do_for_all_local_got_entries): New function.
2661         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2662         symtab_off to all symbol table offsets.
2663         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2664         * object.h (class Got_offset_list): Move to top of file.
2665         (Object::Object): Allow case where input_file == NULL.
2666         (Object::~Object): Likewise.
2667         (Object::input_file): Assert that input_file != NULL.
2668         (Object::lock): Allow case where input_file == NULL.
2669         (Object::unlock): Likewise.
2670         (Object::is_locked): Likewise.
2671         (Object::token): Likewise.
2672         (Object::release): Likewise.
2673         (Object::is_incremental): New function.
2674         (Object::get_mtime): New function.
2675         (Object::for_all_local_got_entries): New function.
2676         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2677         (Object::set_is_in_system_directory): New function.
2678         (Object::is_in_system_directory): New function.
2679         (Object::do_is_incremental): New function.
2680         (Object::do_get_mtime): New function.
2681         (Object::do_for_all_local_got_entries): New function.
2682         (Object::is_in_system_directory_): New data member.
2683         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2684         (class Sized_relobj_base): New class.
2685         (class Sized_relobj): Derive from Sized_relobj_base.
2686         (class Sized_relobj::Symbols): Redeclare from base class.
2687         (class Sized_relobj::local_got_offset_list): Remove.
2688         (class Sized_relobj::Output_sections): Redeclare from base class.
2689         (class Sized_relobj::do_for_all_local_got_entries): New function.
2690         (class Sized_relobj::write_local_symbols): Add offset parameter.
2691         (class Sized_relobj::local_symbol_offset_): Update comment.
2692         (class Sized_relobj::local_dynsym_offset_): Update comment.
2693         * options.cc (Input_arguments::add_file): Remove const.
2694         * options.h (Input_file_argument::Input_file_argument):
2695         Initialize arg_serial_ (all constructors).
2696         (Input_file_argument::set_arg_serial): New function.
2697         (Input_file_argument::arg_serial): New function.
2698         (Input_file_argument::arg_serial_): New data member.
2699         (Input_arguments::Input_arguments): Initialize file_count_.
2700         (Input_arguments::add_file): Remove const.
2701         (Input_arguments::number_of_input_files): New function.
2702         (Input_arguments::file_count_): New data member.
2703         (Command_line::number_of_input_files): Call
2704         Input_arguments::number_of_input_files.
2705         * output.cc (Output_segment_headers::Output_segment_headers):
2706         Set current size.
2707         (Output_section::Input_section::current_data_size): New function.
2708         (Output_section::Output_section): Initialize new data members.
2709         (Output_section::add_input_section): Don't do merge sections for
2710         an incremental link; allocate space from free list for an
2711         incremental update.
2712         (Output_section::add_output_section_data): Allocate space from
2713         free list for an incremental update.
2714         (Output_section::update_data_size): New function.
2715         (Output_section::set_fixed_layout): New function.
2716         (Output_section::reserve): New function.
2717         (Output_segment::set_section_addresses): Remove const.
2718         (Output_segment::set_section_list_addresses): Remove const; allocate
2719         space from free list for an incremental update.
2720         (Output_segment::set_offset): Adjust size of RELRO segment for an
2721         incremental update.
2722         * output.h (Output_data::current_data_size): Move here from
2723         child classes.
2724         (Output_data::pre_finalize_data_size): New function.
2725         (Output_data::update_data_size): New function.
2726         (Output_section_headers::update_data_size): new function.
2727         (Output_section_data_build::current_data_size): Move to Output_data.
2728         (Output_data_strtab::update_data_size): New function.
2729         (Output_section::current_data_size): Move to Output_data.
2730         (Output_section::set_fixed_layout): New function.
2731         (Output_section::has_fixed_layout): New function.
2732         (Output_section::reserve): New function.
2733         (Output_section::update_data_size): New function.
2734         (Output_section::has_fixed_layout_): New data member.
2735         (Output_section::free_list_): New data member.
2736         (Output_segment::set_section_addresses): Remove const.
2737         (Output_segment::set_section_list_addresses): Remove const.
2738         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2739         New function.
2740         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2741         New function.
2742         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2743         parameter when calling Add_symbols constructor; store argument
2744         serial number for members of a lib group.
2745         (Add_symbols::locks): Allow case where token == NULL.
2746         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2747         (Read_member::~Read_member): New function.
2748         (Read_member::is_runnable): New function.
2749         (Read_member::locks): New function.
2750         (Read_member::run): New function.
2751         (Check_script::~Check_script): New function.
2752         (Check_script::is_runnable): New function.
2753         (Check_script::locks): New function.
2754         (Check_script::run): New function.
2755         (Check_library::~Check_library): New function.
2756         (Check_library::is_runnable): New function.
2757         (Check_library::locks): New function.
2758         (Check_library::run): New function.
2759         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2760         (Add_symbols::library_): New data member.
2761         (class Read_member): New class.
2762         (class Check_script): New class.
2763         (class Check_library): New class.
2764         * reloc.cc (Read_relocs::is_runnable): Allow case where
2765         token == NULL.
2766         (Read_relocs::locks): Likewise.
2767         (Scan_relocs::locks): Likewise.
2768         (Relocate_task::locks): Likewise.
2769         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2770         to clear counters.
2771         (Sized_relobj::incremental_relocs_scan): Fix comment.
2772         (Sized_relobj::do_relocate): Pass output file offset to
2773         write_local_symbols.
2774         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2775         from class declaration.
2776         * script.cc (read_input_script): Allocate Script_info; pass
2777         argument serial number to report_script.
2778         * script.h (class Script_info): Move to incremental.h.
2779         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2780         * symtab.h (Symbol_table::add_from_incrobj): New function.
2781         (Symbol_table::set_file_offset): New function.
2782
2783 2011-04-05  Cary Coutant  <ccoutant@google.com>
2784
2785         * incremental-dump.cc (dump_incremental_inputs): Change signature
2786         to take a Sized_incremental_binary; change caller.  Use readers
2787         in Sized_incremental_binary.
2788         * incremental.cc
2789         (Sized_incremental_binary::find_incremental_inputs_sections):
2790         Rename do_find_incremental_inputs_sections to this.
2791         (Sized_incremental_binary::setup_readers): New function.
2792         (Sized_incremental_binary::do_check_inputs): Check
2793         has_incremental_info_ flag; move setup code to setup_readers;
2794         use input readers.
2795         (Sized_incremental_binary::do_file_is_unchanged): New function.
2796         (Sized_incremental_binary::do_get_input_reader): New function.
2797         * incremental.h (class Incremental_binary): Move to end of file.
2798         (Incremental_binary::file_is_unchanged): New function.
2799         (Incremental_binary::do_file_is_unchanged): New function.
2800         (Incremental_binary::Input_reader): New class.
2801         (Incremental_binary::get_input_reader): New function.
2802         (class Sized_incremental_binary): Move to end of file.
2803         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2804         input section reader classes.
2805         (Sized_incremental_binary::has_incremental_info): New function.
2806         (Sized_incremental_binary::inputs_reader): New function.
2807         (Sized_incremental_binary::symtab_reader): New function.
2808         (Sized_incremental_binary::relocs_reader): New function.
2809         (Sized_incremental_binary::got_plt_reader): New function.
2810         (Sized_incremental_binary::do_file_is_unchanged): New function.
2811         (Sized_incremental_binary::Sized_input_reader): New class.
2812         (Sized_incremental_binary::get_input_reader): New function.
2813         (Sized_incremental_binary::find_incremental_inputs_sections):
2814         Rename do_find_incremental_inputs_sections to this.
2815         (Sized_incremental_binary::setup_readers): New function.
2816         (Sized_incremental_binary::has_incremental_info_): New data member.
2817         (Sized_incremental_binary::inputs_reader_): New data member.
2818         (Sized_incremental_binary::symtab_reader_): New data member.
2819         (Sized_incremental_binary::relocs_reader_): New data member.
2820         (Sized_incremental_binary::got_plt_reader_): New data member.
2821         (Sized_incremental_binary::current_input_file_): New data member.
2822
2823 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2824
2825         PR gold/12640
2826         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2827         violation.
2828
2829 2011-03-30  Cary Coutant  <ccoutant@google.com>
2830
2831         * archive.cc (Archive::include_member): Adjust call to report_object.
2832         (Add_archive_symbols::run): Add script_info to call to
2833         report_archive_begin.
2834         (Lib_group::include_member): Adjust call to report_object.
2835         (Add_lib_group_symbols::run): Adjust call to report_object.
2836         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2837         blocks.  Add object count for script input files.
2838         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2839         script_info parameter; change all callers.
2840         (Incremental_inputs::report_object): Add script_info parameter;
2841         change all callers.
2842         (Incremental_inputs::report_script): Store backpointer to
2843         incremental info entry.
2844         (Output_section_incremental_inputs::set_final_data_size): Record
2845         additional information for scripts.
2846         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2847         * incremental.h (Incremental_script_entry::add_object): New function.
2848         (Incremental_script_entry::get_object_count): New function.
2849         (Incremental_script_entry::get_object): New function.
2850         (Incremental_script_entry::objects_): New data member; adjust
2851         constructor.
2852         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2853         (Incremental_inputs::report_object): Add script_info parameter.
2854         (Incremental_inputs_reader::get_object_count): New function.
2855         (Incremental_inputs_reader::get_object_offset): New function.
2856         * options.cc (Input_arguments::add_file): Return reference to
2857         new input argument.
2858         * options.h (Input_argument::set_script_info): New function.
2859         (Input_argument::script_info): New function.
2860         (Input_argument::script_info_): New data member; adjust all
2861         constructors.
2862         (Input_file_group::add_file): Return reference to new input argument.
2863         (Input_file_lib::add_file): Likewise.
2864         (Input_arguments::add_file): Likewise.
2865         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2866         * script.cc (Parser_closure::Parser_closure): Add script_info
2867         parameter; adjust all callers.
2868         (Parser_closure::script_info): New function.
2869         (Parser_closure::script_info_): New data member.
2870         (read_input_script): Report scripts earlier to incremental info.
2871         (script_add_file): Set script_info in Input_argument.
2872         (script_add_library): Likewise.
2873         * script.h (Script_options::Script_info): Rewrite class.
2874
2875 2011-03-29  Cary Coutant  <ccoutant@google.com>
2876
2877         * archive.cc (Library_base::should_include_member): Move
2878         method here from class Archive.
2879         (Archive::Archive): Initialize base class.
2880         (Archive::should_include_member): Move to base class.
2881         (Archive::do_for_all_unused_symbols): New function.
2882         (Add_archive_symbols::run): Remove redundant access to
2883         incremental_inputs.
2884         (Lib_group::Lib_group): Initialize base class.
2885         (Lib_group::do_filename): New function.
2886         (Lib_group::include_member): Pass pointer to Lib_group to
2887         report_object.
2888         (Lib_group::do_for_all_unused_symbols): New function.
2889         (Add_lib_group_symbols::run): Report archive information for
2890         incremental links.
2891         * archive.h (class Library_base): New base class.
2892         (class Archive): Derive from Library_base.
2893         (Archive::filename): Move to base class.
2894         (Archive::set_incremental_info): Likewise.
2895         (Archive::incremental_info): Likewise.
2896         (Archive::Should_include): Likewise.
2897         (Archive::should_include_member): Likewise.
2898         (Archive::Armap_entry): Remove.
2899         (Archive::Unused_symbol_iterator): Remove.
2900         (Archive::unused_symbols_begin): Remove.
2901         (Archive::unused_symbols_end): Remove.
2902         (Archive::do_filename): New function.
2903         (Archive::do_get_mtime): New function.
2904         (Archive::do_for_all_unused_symbols): New function.
2905         (Archive::task_): Move to base class.
2906         (Archive::incremental_info_): Likewise.
2907         (class Lib_group): Derive from Library_base.
2908         (Lib_group::do_filename): New function.
2909         (Lib_group::do_get_mtime): New function.
2910         (Lib_group::do_for_all_unused_symbols): New function.
2911         (Lib_group::task_): Move to base class.
2912         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2913         function.
2914         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2915         function.
2916         * incremental.cc (Incremental_inputs::report_archive_begin):
2917         Use Library_base; call library's get_mtime; add incremental inputs
2918         entry before members.
2919         (class Unused_symbol_visitor): New class.
2920         (Incremental_inputs::report_archive_end): Use Library_base; use
2921         visitor class to record unused symbols; don't add incremental inputs
2922         entry after members.
2923         (Incremental_inputs::report_object): Use Library_base.
2924         * incremental.h
2925         (Incremental_archive_entry::Incremental_archive_entry): Remove
2926         unused Archive parameter.
2927         (Incremental_inputs::report_archive_begin): Use Library_base.
2928         (Incremental_inputs::report_archive_end): Likewise.
2929         (Incremental_inputs::report_object): Likewise.
2930         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2931         function.
2932         * object.h (Object::for_all_global_symbols): New function.
2933         (Object::do_for_all_global_symbols): New function.
2934         (Sized_relobj::do_for_all_global_symbols): New function.
2935         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2936         function.
2937         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2938         function.
2939
2940 2011-03-27  Ian Lance Taylor  <iant@google.com>
2941
2942         * archive.cc (Archive::interpret_header): Return -1 if something
2943         goes wrong.  Change callers accordingly.
2944
2945 2011-03-25  Cary Coutant  <ccoutant@google.com>
2946
2947         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2948         * testsuite/Makefile.in: Regenerate.
2949
2950 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2951
2952         * plugin.cc (get_view): New.
2953         (Plugin::load): Pass get_view to the plugin.
2954         (Plugin_manager::get_view): New.
2955
2956 2011-03-21  Ian Lance Taylor  <iant@google.com>
2957
2958         * testsuite/final_layout.sh: Rewrite to not use dc.
2959         * testsuite/relro_test.sh: Fail if dc is not present.
2960
2961 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2962
2963         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2964         Change == to -eq.
2965         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2966         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2967         Change == to -eq.
2968         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2969         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2970
2971 2011-03-14  Ian Lance Taylor  <iant@google.com>
2972
2973         * script-sections.cc (Sort_output_sections::script_compare):
2974         Rename from is_before, change return type.
2975         (Sort_output_sections::operator()): Adjust accordingly.
2976
2977 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2978
2979         PR gold/12572
2980         * testsuite/odr_violation2.cc: Add comment to make all error line
2981         numbers double digits.
2982         * testsuite/debug_msg.sh: Adjust expected errors.
2983
2984 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2985
2986         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2987         but mark earlier ones as non-canonical
2988         (offset_to_iterator): Update search target and example
2989         (do_addr2line): Return extra lines in a vector*
2990         (format_file_lineno): Extract from do_addr2line
2991         (one_addr2line): Add vector* out-param
2992         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2993         when a lineno entry appeared last for its instruction
2994         (Dwarf_line_info): Add vector* out-param
2995         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2996         * symtab.cc (Odr_violation_compare): Include the lineno in the
2997         comparison again.
2998         (linenos_from_loc): New. Combine the canonical line for an
2999         address with its other lines.
3000         (True_if_intersect): New. Helper functor to make
3001         std::set_intersection a query.
3002         (detect_odr_violations): Compare sets of lines instead of just
3003         one line for each function. This became less deterministic, but
3004         has fewer false positives.
3005         * symtab.h: Declarations.
3006         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3007         mix an optimized and non-optimized object in the same binary
3008         (odr_violation2.so): Same.
3009         * testsuite/Makefile.in: Regenerate from Makefile.am.
3010         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3011         * testsuite/debug_msg.sh: Update line numbers and add
3012         assertions.
3013         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3014         non-optimized context.
3015         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3016         isn't inlined, and use OdrDerived in an optimized context.
3017         * testsuite/odr_header1.h: Defines OdrDerived, where
3018         optimization will change the
3019         first-instruction-in-the-destructor's file and line number.
3020         * testsuite/odr_header2.h: Defines OdrBase.
3021
3022 2011-03-09  Ian Lance Taylor  <iant@google.com>
3023
3024         * fileread.cc (File_read::clear_views): Don't delete the whole
3025         file view.
3026
3027 2011-03-08  Ian Lance Taylor  <iant@google.com>
3028
3029         PR gold/12525
3030         * fileread.cc: #include <climits>.
3031         (GOLD_IOV_MAX): Define.
3032         (File_read::read_multiple): Limit number of entries by iov_max.
3033         * fileread.h (class File_read): Always set max_readv_entries to
3034         128.
3035
3036 2011-03-07  Ian Lance Taylor  <iant@google.com>
3037
3038         PR gold/12525
3039         * options.h (class General_options): Add -dy and -dn.
3040
3041 2011-03-02  Cary Coutant  <ccoutant@google.com>
3042
3043         * testsuite/script_test_9.t: Add TLS segment.
3044
3045 2011-03-02  Simon Baldwin  <simonb@google.com>
3046
3047         * configure.ac: Add check for gnu_indirect_function support in
3048         the toolchain building binutils.
3049         * configure: Rebuild.
3050
3051 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3052
3053         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3054         plugin only symbols.
3055         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3056         in plugin files as not needed in the symbol table.
3057
3058 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3059
3060         * output.cc (Output_section::add_input_section): Delay fill
3061         generation for section ordering.
3062
3063 2011-02-09  Ian Lance Taylor  <iant@google.com>
3064
3065         PR gold/12316
3066         * object.h (class Sized_relobj): Remove clear_local_symbols.
3067         * reloc.cc (Sized_relobj::do_relocate): Don't call
3068         clear_local_symbols.
3069
3070 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3071
3072         * plugin.cc (is_visible_from_outside): Return true for symbols
3073         in the -u option.
3074
3075 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3076
3077         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3078         filename.
3079
3080 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3081
3082         * icf.h (is_section_foldable_candidate): Change type of parameter
3083         to std::string.
3084         * icf.cc (Icf::find_identical_sections): Change type of local variable
3085         section_name to be std::string.
3086         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3087
3088 2011-01-25  Ian Lance Taylor  <iant@google.com>
3089
3090         * script.cc (script_add_extern): Rewrite to use
3091         add_symbol_reference.
3092
3093 2011-01-25  Doug Kwan  <dougkwan@google.com>
3094
3095         * icf.cc (get_section_contents): Always lock section's object.
3096
3097 2011-01-24  Ian Lance Taylor  <iant@google.com>
3098
3099         * options.h (class General_options): Accept
3100         --no-detect-odr-violations.
3101
3102 2011-01-24  Ian Lance Taylor  <iant@google.com>
3103
3104         * version.cc (version_string): Bump to 1.11.
3105
3106 2011-01-24  Ian Lance Taylor  <iant@google.com>
3107
3108         * plugin.cc (class Plugin_rescan): Define new class.
3109         (Plugin_manager::claim_file): Set any_claimed_.
3110         (Plugin_manager::save_archive): New function.
3111         (Plugin_manager::save_input_group): New function.
3112         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3113         necessary.
3114         (Plugin_manager::new_undefined_symbol): New function.
3115         (Plugin_manager::rescan): New function.
3116         (Plugin_manager::rescannable_defines): New function.
3117         (Plugin_manager::add_input_file): Set any_added_.
3118         * plugin.h (class Plugin_manager): define new fields rescannable_,
3119         undefined_symbols_, any_claimed_, and any_added_.  Declare
3120         Plugin_rescan as friend.  Declare new functions.
3121         (Plugin_manager::Rescannable): Define type.
3122         (Plugin_manager::Rescannable_list): Define type.
3123         (Plugin_manager::Undefined_symbol_list): Define type.
3124         (Plugin_manager::Plugin_manager): Initialize new fields.
3125         * archive.cc (Archive::defines_symbol): New function.
3126         (Add_archive_symbols::run): Pass archive to plugins if any.
3127         * archive.h (class Archive): Declare defines_symbol.
3128         * readsyms.cc (Input_group::~Input_group): New function.
3129         (Finish_group::run): Pass input_group to plugins if any.
3130         * readsyms.h (class Input_group): Declare destructor.
3131         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3132         any.
3133
3134 2011-01-10  Ian Lance Taylor  <iant@google.com>
3135
3136         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3137         section as relro.
3138         (Layout::set_segment_offsets): Reset increase_relro before calling
3139         set_section_addresses a second time.
3140
3141 2011-01-04  Cary Coutant  <ccoutant@google.com>
3142
3143         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3144         sections before NOBITS sections.
3145
3146 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3147
3148         * version.cc (print_version): Update copyright to 2011.
3149
3150 2010-12-23  Cary Coutant  <ccoutant@google.com>
3151
3152         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3153         of OS to this->add.  Add OD parameter to second form of the function.
3154
3155 2010-12-20  Ian Lance Taylor  <iant@google.com>
3156
3157         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3158         second of two consecutive entries with same offset.
3159
3160 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3161
3162         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3163         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3164         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3165         to avoid unneeded links against $(LDADD).
3166         * testsuite/Makefile.in: Regenerate.
3167
3168 2010-12-15  Ian Lance Taylor  <iant@google.com>
3169
3170         PR gold/12324
3171         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3172         for R_X86_64_32 and R_X86_64_PC32.
3173         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3174         ver_matching_def_pic.o.
3175         (ver_matching_def_pic.o): New target.
3176
3177 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3178
3179         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3180         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3181         Move definition before File_read::View member definitions.
3182         (File_read::View::~View): Initialize and hold lock before
3183         updating current_mapped_bytes.
3184
3185 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3186
3187         * dwarf_reader.cc: Remove outdated comment.
3188         * gold-threads.cc: Fix typo in error message.
3189         * archive.cc: Fix typos in comments.
3190         * archive.h: Likewise.
3191         * arm-reloc-property.cc: Likewise.
3192         * arm-reloc-property.h: Likewise.
3193         * arm-reloc.def: Likewise.
3194         * arm.cc: Likewise.
3195         * attributes.h: Likewise.
3196         * cref.cc: Likewise.
3197         * ehframe.cc: Likewise.
3198         * fileread.h: Likewise.
3199         * gold.h: Likewise.
3200         * i386.cc: Likewise.
3201         * icf.cc: Likewise.
3202         * incremental.h: Likewise.
3203         * int_encoding.cc: Likewise.
3204         * layout.h: Likewise.
3205         * main.cc: Likewise.
3206         * merge.h: Likewise.
3207         * object.cc: Likewise.
3208         * object.h: Likewise.
3209         * options.cc: Likewise.
3210         * readsyms.cc: Likewise.
3211         * reduced_debug_output.cc: Likewise.
3212         * reloc.cc: Likewise.
3213         * script-sections.cc: Likewise.
3214         * sparc.cc: Likewise.
3215         * symtab.h: Likewise.
3216         * target-reloc.h: Likewise.
3217         * target.cc: Likewise.
3218         * target.h: Likewise.
3219         * timer.cc: Likewise.
3220         * timer.h: Likewise.
3221         * x86_64.cc: Likewise.
3222
3223 2010-12-09  Cary Coutant  <ccoutant@google.com>
3224
3225         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3226         stack.
3227         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3228         parameter; change all callers.
3229         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3230         * options.h (warn_execstack): New option.
3231
3232 2010-12-07  Doug Kwan  <dougkwan@google.com>
3233
3234         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3235         like function call relocations.
3236
3237 2010-12-07  Ian Lance Taylor  <iant@google.com>
3238
3239         * archive.cc (Archive::get_elf_object_for_member): Permit
3240         punconfigured to be NULL.
3241         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3242         (Archive::include_member): Pass NULL to get_elf_object_for_member
3243         if we searched for the archive and this is the first included
3244         object.
3245
3246 2010-12-01  Ian Lance Taylor  <iant@google.com>
3247
3248         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3249         track_relocs_type_ field.
3250         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3251         Set track_relocs_type_.
3252         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3253         contents when using RELA relocs.
3254         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3255         reloc_map_.
3256         * reloc.cc (Track_relocs::next_addend): New function.
3257         * reloc.h (class Track_relocs): Declare next_addend.
3258
3259 2010-12-01  Ian Lance Taylor  <iant@google.com>
3260
3261         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3262         virtual destructor.
3263
3264 2010-12-01  Ian Lance Taylor  <iant@google.com>
3265
3266         * README: Update compilers known to work and fail.
3267
3268 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3269
3270         * configure.in: For --enable-gold, handle value `default' instead of
3271         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3272         not the default.
3273         * configure: Regenerate.
3274
3275 2010-11-18  Doug Kwan  <dougkwan@google.com>
3276
3277         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3278         and right_alignment to be zero.  Store result alignment only if it is
3279         greater than existing alignment.
3280
3281 2010-11-16  Cary Coutant  <ccoutant@google.com>
3282
3283         PR gold/12220
3284         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3285         Check for ".zdebug_line".
3286
3287 2010-11-16  Doug Kwan  <dougkwan@google.com>
3288             Cary Coutant  <ccoutant@google.com>
3289
3290         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3291         by reference; adjust all callers.
3292         * output.cc (Output_segment::set_section_addresses): Adjust references
3293         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3294         list is empty.
3295         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3296         end at page boundary.
3297
3298 2010-11-16  Cary Coutant  <ccoutant@google.com>
3299
3300         PR gold/12220
3301         * layout.cc (Layout::choose_output_section): Transform names of
3302         compressed sections even when using a script with a SECTIONS clause.
3303         (Layout::output_section_name): Remove code to transform
3304         compressed debug section names.
3305         * output.cc (Output_section::add_input_section): Use uncompressed
3306         section size when tracking input sections.
3307
3308 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3309
3310         * symtab.h (Symbol::NON_PIC_REF): Remove.
3311         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3312         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3313         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3314         (Symbol::use_plt_offset): Take a flags argument and pass it
3315         directly to needs_dynamic_reloc.  Restrict check for undefined
3316         weak symbols to function calls.
3317         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3318         (Target_arm::Scan::global): Use it.
3319         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3320         (Target_arm::Relocate::relocate): Likewise.
3321         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3322         parameter with an r_type parameter.  Use get_reference_flags
3323         to get the flags.
3324         (Target_arm::Relocate::relocate): Update accordingly.
3325         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3326         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3327         (Target_i386::Scan::global): Likewise.
3328         (Target_i386::Relocate::relocate): Likewise.
3329         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3330         parameter with an r_type parameter.  Use get_reference_flags
3331         to get the flags.
3332         (Target_i386::Relocate::relocate): Update accordingly.
3333         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3334         (Target_powerpc::Scan::global): Use it.
3335         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3336         (Target_powerpc::Relocate::relocate): Likewise.
3337         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3338         (Target_sparc::Scan::global): Use it.
3339         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3340         (Target_sparc::Relocate::relocate): Likewise.
3341         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3342         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3343         (Target_x86_64::Scan::global): Likewise.
3344         (Target_x86_64::Relocate::relocate): Likewise.
3345
3346 2010-11-08  Doug Kwan  <dougkwan@google.com>
3347             Cary Coutant  <ccoutant@google.com>
3348
3349         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3350         (Arm_exidx_merge_section::section_contents_): New data member.
3351         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3352         (Arm_input_section::~Arm_input_section): De-allocate memory.
3353         (Arm_input_section::original_contents_): New data member.
3354         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3355         in parameters instead of calling Object::section_contents without
3356         locking.
3357         (Arm_output_section::group_section): New parameter TASK.  Pass it
3358         to callees that need locking objects.
3359         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3360         to lock EXIDX input sections.  Fix a formatting issue.  Call
3361         Arm_exidx_merged_section::build_contents to create merged section
3362         contents.
3363         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3364         to lock object of stub table owner.
3365         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3366         TEXT_SIZE to initialize data member TEXT_SIZE_.
3367         (Arm_exidx_input_section::addralign): Fix typo in comment.
3368         (Arm_exidx_input_section::text_size): New method.
3369         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3370         that require locking objects.  Lock objects before scanning for stubs
3371         and updating local symbols.
3372         (Arm_input_section<big_endian>::init): Copy contents of original
3373         input section.
3374         (Arm_input_section<big_endian>::do_write): Use saved contents of
3375         original input section instead of calling Object::section_contents
3376         without locking.
3377         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3378         size without calling Object::section_size().
3379         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3380         for size.  Allocate a buffer for merged EXIDX entries.
3381         (Arm_exidx_merged_section::build_contents): New method.
3382         (Arm_exidx_merged_section::do_write): Move merge section contents
3383         building code to Arm_exidx_merged_section::build_contetns.  Write
3384         out contetns in buffer instead of building it on the fly.
3385         (Arm_relobj::make_exidx_input_section): Also pass text section size
3386         to Arm_exidx_input_section constructor.
3387         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3388         (Arm_dynobj::do_read_symbols): Fix memory leak.
3389         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3390         * target.h: (class Task): Add forward declaration.
3391         (Target::relax): Add new parameter TASK and pass it to
3392         Target::do_relax().
3393         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3394
3395 2010-11-05  Cary Coutant  <ccoutant@google.com>
3396
3397         PR gold/10708
3398         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3399         object when reading from the file.
3400         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3401         second layout pass.
3402         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3403         when reading section contents.
3404         (get_section_contents): Likewise.
3405         (icf::find_identical_sections): Likewise.
3406         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3407         object when reading from the file.
3408         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3409         the object when doing deferred section layout.
3410
3411 2010-11-03  Nick Clifton  <nickc@redhat.com>
3412
3413         PR gold/12001
3414         * script.h (class Symbol_assignment: name): New member.  Returns
3415         the name of the symbol.
3416         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3417         Returns true if the given symbol name is on the list of
3418         assignments wating to be processed.
3419         * archive.cc (should_incldue_member): If the symbol is undefined,
3420         check to see if it is on the list of symbols pending assignment.
3421
3422 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3423
3424         * script-sections.cc (Script_sections::find_memory_region): Check
3425         for a NULL output section pointer.
3426
3427 2010-10-29  Doug Kwan  <dougkwan@google.com>
3428
3429         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3430         Output_section::add_relaxed_input_section.
3431         * output.cc (Output_section::add_relaxed_input_section): Add new
3432         arguments LAYOUT and NAME.  Set section order index.
3433         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3434         Copy section order index.
3435         * output.h (Output_section::add_relaxed_input_section): Add new
3436         arguments LAYOUT and NAME.
3437
3438 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3439
3440         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3441         NATIVE_OR_CROSS_LINKER.
3442         * testsuite/Makefile.in: Regenerate.
3443
3444 2010-10-20  Doug Kwan  <dougkwan@google.com>
3445
3446         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3447         without SHF_LINK_ORDER flags.
3448         * layout.cc (Layout::choose_output_section): Do not filter
3449         SHF_LINK_ORDER flag in a relocatable link.
3450
3451 2010-10-17  Cary Coutant  <ccoutant@google.com>
3452
3453         * output.h (Output_segment::set_section_addresses): Change function
3454         signature.  Update all callers.
3455         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3456         sections.
3457         (Output_segment::set_section_addresses): Align after last TLS
3458         section.  Add padding before last relro section instead of after.
3459
3460 2010-10-17  Doug Kwan  <dougkwan@google.com>
3461
3462         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3463         GOT output section to be writable.
3464
3465 2010-10-14  Cary Coutant  <ccoutant@google.com>
3466
3467         * debug.h (DEBUG_INCREMENTAL): New flag.
3468         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3469         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3470         mode.
3471         * incremental.cc (report_command_line): Ignore all forms of
3472         --incremental.
3473         * layout.cc (Layout::Layout): Check parameters for incremental link
3474         mode.
3475         * options.cc (General_options::parse_incremental): New function.
3476         (General_options::parse_no_incremental): New function.
3477         (General_options::parse_incremental_full): New function.
3478         (General_options::parse_incremental_update): New function.
3479         (General_options::incremental_mode_): New data member.
3480         (General_options::finalize): Check incremental_mode_.
3481         * options.h (General_options): Update help text for --incremental.
3482         Add --no-incremental, --incremental-full, --incremental-update.
3483         (General_options::Incremental_mode): New enum type.
3484         (General_options::incremental_mode): New function.
3485         (General_options::incremental_mode_): New data member.
3486         * parameters.cc (Parameters::incremental_mode_): New data member.
3487         (Parameters::set_options): Set incremental_mode_.
3488         (Parameters::set_incremental_full): New function.
3489         (Parameters::incremental): New function.
3490         (Parameters::incremental_update): New function.
3491         (set_parameters_incremental_full): New function.
3492         * parameters.h (Parameters::set_incremental_full): New function.
3493         (Parameters::incremental): New function.
3494         (Parameters::incremental_update): New function.
3495         (Parameters::incremental_mode_): New data member.
3496         (set_parameters_incremental_full): New function.
3497         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3498         incremental link mode.
3499         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3500         (Sized_relobj::do_relocate_sections): Likewise.
3501         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3502         option.
3503         * testsuite/Makefile.in: Regenerate.
3504         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3505
3506 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3507
3508         * script-sections.h (class Script_sections): Make
3509         Sections_elements typedef public.
3510         * script-sections.cc (class Sort_output_sections): Add elements_
3511         field.  Add constructor which sets it; change all callers.
3512         (Sort_output_sections::is_before): New function.
3513         (Sort_output_sections::operator()): Call is_before.
3514         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3515         conditional.
3516         * testsuite/script_test_10.sh: New test. Test script section
3517         order.
3518         * testsuite/script_test_10.t: Likewise.
3519         * testsuite/script_test_10.s: Likewise.
3520         * testsuite/Makefile.am: Wrap the cross linker tests and the
3521         common tests into NATIVE_OR_CROSS_LINKER.
3522         (check_SCRIPTS): Add script_test_10.sh.
3523         (check_DATA): Add script_test_10.stdout.
3524         (script_test_10.o, script_test_10): New targets.
3525         (script_test_10.stdout): New target.
3526         * configure, testsuite/Makefile.in: Regenerate.
3527
3528 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3529
3530         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3531         error for the deprecated relocations.
3532         (Target_arm::Scan::global): Likewise.
3533         (Target_arm::Relocate::relocate): Likewise.
3534
3535 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3536
3537         * fileread.cc (Input_file::find_file): Initialize *found_name
3538         and *namep when using the fallback search for case 4.
3539
3540 2010-10-11  Cary Coutant  <ccoutant@google.com>
3541
3542         * options.h (class General_options): Redefine -z lazy as an alias for
3543         the negation of -z now.
3544
3545 2010-10-11  Ian Lance Taylor  <iant@google.com>
3546
3547         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3548         binding.
3549
3550 2010-10-06  Nick Clifton  <nickc@redhat.com>
3551
3552         * script-sections.cc(class Memory_region): Remove
3553         current_lma_offset_ field.  Rename current_vma_offset_ to
3554         current_offset_.  Add last_section_ field.
3555         (Memory_region::get_current_vma_address): Rename to
3556         get_current_address.
3557         (Memory_region::get_current_lma_address): Delete.
3558         (Memory_region::increment_vma_offset): Rename to
3559         increment_offset.
3560         (Memory_region::increment_lma_offset): Delete.
3561         (Memory_region::attributes_compatible): New method.  Returns
3562         true if the provided section is compatible with the region.
3563         (Memory_region::get_last_section): New method.  Returns the last
3564         section to use the region.
3565         (Memory_region::set_last_section): New method.  Stores the last
3566         section to use the region.
3567         (Script_sections::block_in_region): New method.  Returns true if
3568         a block of memory is contained within a region.
3569         (Script_sections::find_memory_region): New method.  Locates a
3570         memory region to be used to set a VMA or LMA address.
3571         (Output_section_definition::set_section_addresses): Add code to
3572         check for addresses set by memory regions.
3573         (Output_segment::set_section_addresses): Remove memory region
3574         walking code.
3575         (Script_sections::create_segment): Add a warning if a header
3576         segment is created outside of any region.
3577         * script-sections.h (class Script_sections): Add prototypes for
3578         find_memory_region and block_in_region methods.
3579         * testsuite/memory_test.s: Use .long instead of .word.
3580         * testsuite/memory_test.t: Add some more output sections.
3581         * testsuite/memory_test.sh: Update expected output.
3582
3583 2010-10-02  Doug Kwan  <dougkwan@google.com>
3584
3585         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3586         defintion to symtab.h
3587         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3588         declaration to defintion.
3589
3590 2010-10-01  Nick Clifton  <nickc@redhat.com>
3591
3592         * expression.cc (eval): Replace dummy argument with NULL.
3593         (eval_maybe_dot): Check for a NULL result section pointer.
3594         (Symbol_expression::value): Likewise.
3595         (Dot_expression::value): Likewise.
3596         (BINARY_EXPRESSION): Likewise.
3597         (Max_expression::value): Likewise.
3598         (Min_expression::value): Likewise.
3599         (Absolute_expression::value): Likewise.
3600         (Addr_expression::value_from_output_section): Likewise.
3601         (Loaddddr_expression::value_from_output_section): Likewise.
3602         (Segment_start_expression::value): Likewise.
3603         * script-sections.cc
3604         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3605         argument with NULL.
3606         (Sections_elememt_dot_assignment::set_section_addresses):
3607         Likewise.
3608         (Output_data_expression::do_write_to_buffer): Likewise.
3609         (Output_section_definition::finalize_symbols): Likewise.
3610         (Output_section_definition::set_section_addresses): Likewise.
3611
3612 2010-09-30  Doug Kwan  <dougkwan@google.com>
3613
3614         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3615
3616 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3617
3618         * target.h (Target::can_icf_inline_merge_sections): New virtual
3619         function.
3620         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3621         virtual function.
3622         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3623         virtual function.
3624         * icf.cc (get_section_contents): Inline merge sections only when
3625         target allows it.
3626
3627 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3628
3629         * configure: Regenerate.
3630
3631 2010-09-17  Ian Lance Taylor  <iant@google.com>
3632
3633         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3634         * testsuite/Makefile.am (memory_test.o): New target.
3635         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3636         memory_test.t.
3637         * testsuite/Makefile.in: Rebuild.
3638
3639 2010-09-17  Doug Kwan  <dougkwan@google.com>
3640
3641         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3642         defintion if relocation uses GOT entries of the symbol.
3643         * testsuite/icf_safe_test.sh: Fix test.
3644         * testsuite/icf_safe_so_test.sh: Fix test.
3645
3646 2010-09-16  Cary Coutant  <ccoutant@google.com>
3647
3648         * script_sections.cc (class Memory_region): Remove "NULL" from
3649         vector initializations.
3650
3651 2010-09-15  Cary Coutant  <ccoutant@google.com>
3652
3653         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3654         Resolve forwarding symbols.
3655
3656 2010-09-15  Doug Kwan  <dougkwan@google.com>
3657
3658         * gold/testsuite/script_test_3.t: Add ARM special sections.
3659         * gold/testsuite/script_test_4.t: Same.
3660         * gold/testsuite/script_test_5.t: Same.
3661         * gold/testsuite/script_test_6.t: Same.
3662         * gold/testsuite/script_test_7.t: Same.
3663         * gold/testsuite/script_test_7.t: Same.
3664         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3665
3666 2010-09-14  Cary Coutant  <ccoutant@google.com>
3667
3668         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3669         (Target_x86_64::Relocate::relocate_tls): Replace check for
3670         saw_tls_block_reloc_ with test for executable section.
3671
3672 2010-09-12  Cary Coutant  <ccoutant@google.com>
3673
3674         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3675         position-independent executables to shared libraries need dynamic
3676         relocations.
3677         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3678         position-independent executables.
3679         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3680         * testsuite/Makefile.in: Regenerate.
3681
3682 2010-09-10  Nick Clifton  <nickc@redhat.com>
3683
3684         PR gold/11997
3685         * testsuite/memory_test.t: Discard any sections that are not
3686         needed.
3687
3688 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3689
3690         PR gold/11996
3691         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3692         "This::" to work around a bug in gcc 4.2.
3693
3694         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3695
3696 2010-09-09  Rafael Espindola  <espindola@google.com>
3697
3698         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3699         sections with different PF_X flags in the same segment.
3700         (Layout::find_first_load_seg): Search all segments to find the first
3701         one.
3702         * options.h (rosegment): New.
3703
3704 2010-09-08  Rafael Espindola  <espindola@google.com>
3705
3706         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3707
3708 2010-09-08  Doug Kwan  <dougkwan@google.com>
3709
3710         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3711         (Arm_relobj::do_relocate_sections): Add new parameter for output
3712         file to match the parent.
3713         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3714         of local symbols instead of input values.  Update code to track
3715         changes in gold::relocate_section.
3716         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3717         (Sized_relobj::compute_final_local_value_internal): New methods.
3718         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3719         body into private version of Sized_relobj::compute_final_local_value.
3720         Call the inline method.
3721         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3722         merged symbol value if there is one.
3723         (Symbol_value::has_output_value): New method defintiion.
3724         (Sized_relobj::Compute_final_local_value_status): New enum type.
3725         (Sized_relobj::compute_final_local_value): New methods.
3726         (Sized_relobj::compute_final_local_value_internal): New methods.
3727         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3728         and arm_cortex_a8.sh.
3729         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3730         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3731         New tests.
3732         * Makefile.in: Regenerate.
3733         * testsuite/arm_bl_out_of_range.s: Update test.
3734         * testsuite/thumb_bl_out_of_range.s: Ditto.
3735         * testsuite/thumb_blx_out_of_range.s: Ditto.
3736         * testsuite/arm_branch_out_of_range.sh: New file.
3737         * testsuite/arm_cortex_a8.sh: Ditto.
3738         * testsuite/arm_cortex_a8_b.s: Ditto.
3739         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3740         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3741         * testsuite/arm_cortex_a8_bl.s: Ditto.
3742         * testsuite/arm_cortex_a8_blx.s: Ditto.
3743         * testsuite/arm_cortex_a8_local.s: Ditto.
3744         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3745         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3746
3747 2010-09-08  Rafael Espindola  <espindola@google.com>
3748
3749         * Makefile.am (memory_test.stdout): Run readelf with -W.
3750         * Makefile.in: Regenerate.
3751         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3752         64 bit output.
3753
3754 2010-09-08  Rafael Espindola  <espindola@google.com>
3755
3756         * script-sections.cc (Script_sections::add_memory_region): Convert
3757         field precision to int.
3758         * script.cc (script_set_section_region, script_set_section_region):
3759         Convert field precision to int.
3760
3761 2010-09-08  Rafael Espindola  <espindola@google.com>
3762
3763         * arm.cc (do_finalize_sections): Create the __exidx_start and
3764         __exdix_end symbols even when the section is missing.
3765
3766 2010-09-08  Nick Clifton  <nickc@redhat.com>
3767
3768         * README: Remove claim that MEMORY is not supported.
3769         * expression.cc (script_exp_function_origin)
3770         (script_exp_function_length): Move from here to ...
3771         * script.cc: ... here.
3772         (script_set_section_region, script_add_memory)
3773         (script_parse_memory_attr, script_include_directive): New
3774         functions.
3775         * script-sections.cc
3776         (class Memory_region): New class.
3777         (class Output_section_definition): Add set_memory_region,
3778         set_section_vma, set_section_lma and get_section_name methods.
3779         (class Script_Sections): Add add_memory_region,
3780         find_memory_region, find_memory_region_origin,
3781         find_memory_region_length and set_memory_region methods.
3782         Have set_section_addresses method walk the list of set memory
3783         regions.
3784         Extend the print methos to display memory regions.
3785         * script-sections.h: Add prototypes for new methods.
3786         Add enum for MEMORY region attributes.
3787         * yyscript.y: Add support for parsing MEMORY regions.
3788         * script-c.h: Add prototypes for new functions.
3789         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3790         * testsuite/Makefile.in: Regenerate.
3791         * testsuite/memory_test.sh: New script.
3792         * testsuite/memory_test.s: New assembler source file.
3793         * testsuite/memory_test.t: New linker script.
3794
3795 2010-08-27  Doug Kwan  <dougkwan@google.com>
3796
3797         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3798         reference override an existing dynamic weak reference.
3799         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3800         * testsuite/Makefile.in: Regenerate.
3801         * testsuite/dyn_weak_ref.sh: New file.
3802         * testsuite/dyn_weak_ref_1.c: Ditto.
3803         * testsuite/dyn_weak_ref_2.c: Ditto.
3804
3805 2010-08-27  Ian Lance Taylor  <iant@google.com>
3806
3807         * incremental.h (class Incremental_input_entry): Add virtual
3808         destructor.
3809
3810 2010-08-27  Ian Lance Taylor  <iant@google.com>
3811
3812         * testsuite/start_lib_test_3.c: Mark t3 as used.
3813
3814 2010-08-27  Nick Clifton  <nickc@redhat.com>
3815
3816         * options.cc (version_script): Fix small typo in previous
3817         whitespace tidyup.
3818
3819 2010-08-25  Nick Clifton  <nickc@redhat.com>
3820
3821         * archive.cc: Formatting fixes: Remove whitespace between
3822         typename and following asterisk.  Remove whitespace between
3823         function name and opening parenthesis.
3824         * archive.h: Likewise.
3825         * arm.cc: Likewise.
3826         * attributes.cc: Likewise.
3827         * attributes.h: Likewise.
3828         * common.cc: Likewise.
3829         * copy-relocs.cc: Likewise.
3830         * dirsearch.h: Likewise.
3831         * dynobj.cc: Likewise.
3832         * ehframe.cc: Likewise.
3833         * ehframe.h: Likewise.
3834         * expression.cc: Likewise.
3835         * fileread.cc: Likewise.
3836         * fileread.h: Likewise.
3837         * gc.h: Likewise.
3838         * gold-threads.cc: Likewise.
3839         * gold.cc: Likewise.
3840         * i386.cc: Likewise.
3841         * icf.h: Likewise.
3842         * incremental-dump.cc: Likewise.
3843         * incremental.cc: Likewise.
3844         * layout.cc: Likewise.
3845         * layout.h: Likewise.
3846         * main.cc: Likewise.
3847         * merge.cc: Likewise.
3848         * merge.h: Likewise.
3849         * object.cc: Likewise.
3850         * object.h: Likewise.
3851         * options.cc: Likewise.
3852         * options.h: Likewise.
3853         * output.cc: Likewise.
3854         * output.h: Likewise.
3855         * plugin.cc: Likewise.
3856         * plugin.h: Likewise.
3857         * powerpc.cc: Likewise.
3858         * reloc.cc: Likewise.
3859         * script-c.h: Likewise.
3860         * script-sections.cc: Likewise.
3861         * script.cc: Likewise.
3862         * stringpool.cc: Likewise.
3863         * symtab.cc: Likewise.
3864         * symtab.h: Likewise.
3865         * target.cc: Likewise.
3866         * timer.cc: Likewise.
3867         * timer.h: Likewise.
3868         * version.cc: Likewise.
3869         * x86_64.cc: Likewise.
3870
3871 2010-08-24  Nick Clifton  <nickc@redhat.com>
3872
3873         PR 11899
3874         * layout.cc (segment_precedes): Sort segments by their physical
3875         addresses, if they have been set.
3876
3877 2010-08-23  Cary Coutant  <ccoutant@google.com>
3878
3879         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3880         symbols data.
3881         (Lib_group::include_member): Unlock object after deleting its
3882         symbols data.
3883         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3884         the bug fixed here.
3885
3886 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3887             Cary Coutant  <ccoutant@google.com>
3888
3889         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3890         constructor, and set_blocker.
3891         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3892         readsyms_blocker_.
3893         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3894         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3895         * testsuite/Makefile.am (start_lib_test): New test case.
3896         * testsuite/Makefile.in: Regenerate.
3897         * testsuite/start_lib_test_main.c: New file.
3898         * testsuite/start_lib_test_1.c: New file.
3899         * testsuite/start_lib_test_2.c: New file.
3900         * testsuite/start_lib_test_3.c: New file.
3901
3902 2010-08-19  Ian Lance Taylor  <iant@google.com>
3903
3904         * Makefile.in: Rebuild with automake 1.11.1.
3905         * aclocal.m4: Likewise.
3906         * testsuite/Makefile.in: Likewise.
3907
3908 2010-08-19  Ian Lance Taylor  <iant@google.com>
3909
3910         PR 10893
3911         * i386.cc (class Output_data_plt_i386): Update declarations.
3912         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3913         local_ifuncs_ fields.
3914         (Target_i386::do_plt_section_for_global): New function.
3915         (Target_i386::do_plt_section_for_local): New function.
3916         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3917         parameter; change all callers.  Initialize global_ifuncs_ and
3918         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3919         __rel_iplt_end.
3920         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3921         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3922         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3923         symbols.
3924         (Target_i386::make_plt_section): New function, broken out of
3925         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3926         (Target_i386::make_plt_entry): Call make_plt_section.
3927         (Target_i386::make_local_ifunc_plt_entry): New function.
3928         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3929         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3930         R_386_IRELATIVE to switch.
3931         (Target_i386::Scan::global): Likewise.
3932         (Target_i386::Relocate::relocate): Likewise.
3933         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3934         switch.
3935         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3936         (Target_x86_64::do_plt_section_for_global): New function.
3937         (Target_x86_64::do_plt_section_for_local): New function.
3938         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3939         parameter; change all callers.  If doing a static link define
3940         __rela_iplt_start and __rela_iplt_end.
3941         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3942         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3943         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3944         to point to .plt.
3945         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3946         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3947         switch.
3948         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3949         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3950         R_X86_64_IRELATIVE to switch.
3951         (Target_x86_64::Scan::global): Likewise.
3952         (Target_x86_64::Relocate::relocate): Likewise.
3953         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3954         switch.
3955         * target.h (class Target): Add plt_section_for_global and
3956         plt_section_for_local functions.  Add do_plt_section_for_global
3957         and do_plt_section_for_local virtual functions.
3958         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3959         clarifying comments.
3960         (Symbol::use_plt_offset): Handle IFUNC symbol.
3961         * object.cc (Sized_relobj::Sized_relobj): Initialize
3962         local_plt_offsets_.
3963         (Sized_relobj::local_has_plt_offset): New function.
3964         (Sized_relobj::local_plt_offset): New function.
3965         (Sized_relobj::set_local_plt_offset): New function.
3966         (Sized_relobj::do_count): Handle IFUNC symbol.
3967         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3968         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3969         is_ifunc_symbol functions.
3970         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3971         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3972         local_plt_offsets_ field.
3973         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3974         * output.h (class Output_section_data): Add non-const
3975         output_section function.
3976         (class Output_data_got): Update declarations.
3977         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3978         Add use_plt_offset parameter to global and local constructors.
3979         Change all callers.  Change local_sym_index_ field to 31 bits.
3980         Change GSYM_CODE and CONSTANT_CODE accordingly.
3981         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3982         doing a static link don't set sh_link field.
3983         (Output_data_got::Got_entry::write): Use PLT offset if
3984         appropriate.
3985         (Output_data_got::add_global_plt): New function.
3986         (Output_data_got::add_local_plt): New function.
3987         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3988         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3989         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3990         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3991         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3992         IFUNC conditional.
3993         * testsuite/ifunc-sel.h: New file.
3994         * testsuite/ifuncmain1.c: New file.
3995         * testsuite/ifuncmain1vis.c: New file.
3996         * testsuite/ifuncmod1.c: New file.
3997         * testsuite/ifuncdep2.c: New file.
3998         * testsuite/ifuncmain2.c: New file.
3999         * testsuite/ifuncmain3.c: New file.
4000         * testsuite/ifuncmod3.c: New file.
4001         * testsuite/ifuncmain4.c: New file.
4002         * testsuite/ifuncmain5.c: New file.
4003         * testsuite/ifuncmod5.c: New file.
4004         * testsuite/ifuncmain6pie.c: New file.
4005         * testsuite/ifuncmod6.c: New file.
4006         * testsuite/ifuncmain7.c: New file.
4007         * configure, testsuite/Makefile.in: Rebuild.
4008
4009 2010-08-18  Ian Lance Taylor  <iant@google.com>
4010
4011         * incremental.cc
4012         (Output_section_incremental_inputs::write_input_files): Add cast
4013         to avoid signed/unsigned comparison warning.
4014         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4015
4016 2010-08-12  Cary Coutant  <ccoutant@google.com>
4017
4018         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4019
4020 2010-08-13  Ian Lance Taylor  <iant@google.com>
4021
4022         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4023
4024 2010-08-12  Cary Coutant  <ccoutant@google.com>
4025             Doug Kwan  <dougkwan@google.com>
4026
4027         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4028         defintion overrides non-weak undef, remember that the original undef
4029         is not weak.
4030         * symtab.cc (Symbol_table::sized_write_global): For undef without
4031         an original weak binding, set binding to global in output.
4032         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4033         * testsuite/Makefile.in: Regenerate.
4034         * testsuite/strong_ref_weak_def.sh: New file.
4035         * testsuite/strong_ref_weak_def_1.c: Ditto.
4036         * testsuite/strong_ref_weak_def_2.c: Ditto.
4037
4038 2010-08-12  Cary Coutant  <ccoutant@google.com>
4039
4040         * testsuite/incremental_test.sh: Rewrite.
4041         * testsuite/incremental_test_1.c: Rewrite.
4042         * testsuite/incremental_test_2.c: Rewrite.
4043
4044 2010-08-12  Cary Coutant  <ccoutant@google.com>
4045
4046         * arm.cc (Target_arm::got_size): Add const.
4047         (Target_arm::got_entry_count): New function.
4048         (Target_arm::plt_entry_count): New function.
4049         (Target_arm::first_plt_entry_offset): New function.
4050         (Target_arm::plt_entry_size): New function.
4051         (Output_data_plt_arm::entry_count): New function.
4052         (Output_data_plt_arm::first_plt_entry_offset): New function.
4053         (Output_data_plt_arm::get_plt_entry_size): New function.
4054         * i386.cc (Target_i386::got_size): Add const.
4055         (Target_i386::got_entry_count): New function.
4056         (Target_i386::plt_entry_count): New function.
4057         (Target_i386::first_plt_entry_offset): New function.
4058         (Target_i386::plt_entry_size): New function.
4059         (Output_data_plt_i386::entry_count): New function.
4060         (Output_data_plt_i386::first_plt_entry_offset): New function.
4061         (Output_data_plt_i386::get_plt_entry_size): New function.
4062         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4063         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4064         * incremental.cc: Include target.h.
4065         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4066         parameter.  Adjust all callers.  Find incremental_got_plt section.
4067         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4068         section.
4069         (Output_section_incremental_inputs::set_final_data_size): Calculate
4070         size of incremental_got_plt section.
4071         (Output_section_incremental_inputs::do_write): Write the
4072         incremental_got_plt section.
4073         (Got_plt_view_info): New struct.
4074         (Local_got_offset_visitor): New class.
4075         (Global_got_offset_visitor): New class.
4076         (Global_symbol_visitor_got_plt): New class.
4077         (Output_section_incremental_inputs::write_got_plt): New function.
4078         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4079         Add parameter.  Adjust all callers.
4080         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4081         (Incremental_inputs::got_plt_section): New function.
4082         (Incremental_inputs::got_plt_section_): New data member.
4083         (Incremental_got_plt_reader): New class.
4084         * layout.cc (Layout::create_incremental_info_sections): Add the
4085         incremental_got_plt section.
4086         * object.h (Got_offset_list::get_list): New function.
4087         (Got offset_list::for_all_got_offsets): New function.
4088         (Sized_relobj::local_got_offset_list): New function.
4089         * powerpc.cc (Target_powerpc::got_size): Add const.
4090         (Target_powerpc::got_entry_count): New function.
4091         (Target_powerpc::plt_entry_count): New function.
4092         (Target_powerpc::first_plt_entry_offset): New function.
4093         (Target_powerpc::plt_entry_size): New function.
4094         (Output_data_plt_powerpc::entry_count): New function.
4095         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4096         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4097         * sparc.cc (Target_sparc::got_size): Add const.
4098         (Target_sparc::got_entry_count): New function.
4099         (Target_sparc::plt_entry_count): New function.
4100         (Target_sparc::first_plt_entry_offset): New function.
4101         (Target_sparc::plt_entry_size): New function.
4102         (Output_data_plt_sparc::entry_count): New function.
4103         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4104         (Output_data_plt_sparc::get_plt_entry_size): New function.
4105         * symtab.h (Symbol::got_offset_list): New function.
4106         (Symbol_table::for_all_symbols): New function.
4107         * target.h (Sized_target::got_entry_count): New function.
4108         (Sized_target::plt_entry_count): New function.
4109         (Sized_target::plt_entry_size): New function.
4110         * x86_64.cc (Target_x86_64::got_size): Add const.
4111         (Target_x86_64::got_entry_count): New function.
4112         (Target_x86_64::plt_entry_count): New function.
4113         (Target_x86_64::first_plt_entry_offset): New function.
4114         (Target_x86_64::plt_entry_size): New function.
4115         (Output_data_plt_x86_64::entry_count): New function.
4116         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4117         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4118
4119 2010-08-12  Cary Coutant  <ccoutant@google.com>
4120
4121         * archive.cc: Include incremental.h.
4122         (Archive::Archive): Initialize incremental_info_.
4123         (Archive::include_member): Record archive members in incremental info.
4124         (Add_archive_symbols::run): Record begin and end of an archive in
4125         incremental info.
4126         (Lib_group::include_member): Record objects in incremental info.
4127         * archive.h (Incremental_archive_entry): Forward declaration.
4128         (Archive::set_incremental_info): New member function.
4129         (Archive::incremental_info): New member function.
4130         (Archive::Unused_symbol_iterator): New class.
4131         (Archive::unused_symbols_begin): New member function.
4132         (Archive::unused_symbols_end): New member function.
4133         (Archive::incremental_info_): New data member.
4134         * incremental-dump.cc (find_input_containing_global): New function.
4135         (dump_incremental_inputs): Dump new incremental info sections.
4136         * incremental.cc: Include symtab.h.
4137         (Output_section_incremental_inputs): New class.
4138         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4139         new incremental info sections.
4140         (Sized_incremental_binary::do_check_inputs): Likewise.
4141         (Incremental_inputs::report_archive): Remove.
4142         (Incremental_inputs::report_archive_begin): New function.
4143         (Incremental_inputs::report_archive_end): New function.
4144         (Incremental_inputs::report_object): New function.
4145         (Incremental_inputs::finalize_inputs): Remove.
4146         (Incremental_inputs::report_input_section): New function.
4147         (Incremental_inputs::report_script): Rewrite.
4148         (Incremental_inputs::finalize): Do nothing but finalize string table.
4149         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4150         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4151         (Incremental_inputs::create_data_sections): New function.
4152         (Incremental_inputs::relocs_entsize): New function.
4153         (Output_section_incremental_inputs::set_final_data_size): New function.
4154         (Output_section_incremental_inputs::do_write): New function.
4155         (Output_section_incremental_inputs::write_header): New function.
4156         (Output_section_incremental_inputs::write_input_files): New function.
4157         (Output_section_incremental_inputs::write_info_blocks): New function.
4158         (Output_section_incremental_inputs::write_symtab): New function.
4159         * incremental.h (Incremental_script_entry): Forward declaration.
4160         (Incremental_object_entry): Forward declaration.
4161         (Incremental_archive_entry): Forward declaration.
4162         (Incremental_inputs): Forward declaration.
4163         (Incremental_inputs_header_data): Remove.
4164         (Incremental_inputs_header): Remove.
4165         (Incremental_inputs_header_write): Remove.
4166         (Incremental_inputs_entry_data): Remove.
4167         (Incremental_inputs_entry): Remove.
4168         (Incremental_inputs_entry_write): Remove.
4169         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4170         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4171         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4172         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4173         Likewise.
4174         (Incremental_input_entry): New class.
4175         (Incremental_script_entry): New class.
4176         (Incremental_object_entry): New class.
4177         (Incremental_archive_entry): New class.
4178         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4179         (Incremental_inputs::report_inputs): Remove.
4180         (Incremental_inputs::report_archive): Remove.
4181         (Incremental_inputs::report_archive_begin): New function.
4182         (Incremental_inputs::report_archive_end): New function.
4183         (Incremental_inputs::report_object): Change prototype.
4184         (Incremental_inputs::report_input_section): New function.
4185         (Incremental_inputs::report_script): Change prototype.
4186         (Incremental_inputs::get_reloc_count): New function.
4187         (Incremental_inputs::set_reloc_count): New function.
4188         (Incremental_inputs::create_data_sections): New function.
4189         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4190         (Incremental_inputs::inputs_section): New function.
4191         (Incremental_inputs::symtab_section): New function.
4192         (Incremental_inputs::relocs_section): New function.
4193         (Incremental_inputs::get_stringpool): Add const.
4194         (Incremental_inputs::command_line): Add const.
4195         (Incremental_inputs::inputs): Remove.
4196         (Incremental_inputs::command_line_key): New function.
4197         (Incremental_inputs::input_file_count): New function.
4198         (Incremental_inputs::input_files): New function.
4199         (Incremental_inputs::relocs_entsize): New function.
4200         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4201         (Incremental_inputs::finalize_inputs): Remove.
4202         (Incremental_inputs::Input_info): Remove.
4203         (Incremental_inputs::lock_): Remove.
4204         (Incremental_inputs::inputs_): Change type.
4205         (Incremental_inputs::inputs_map_): Remove.
4206         (Incremental_inputs::current_object_entry_): New data member.
4207         (Incremental_inputs::inputs_section_): New data member.
4208         (Incremental_inputs::symtab_section_): New data member.
4209         (Incremental_inputs::relocs_section_): New data member.
4210         (Incremental_inputs::reloc_count_): New data member.
4211         (Incremental_inputs_reader): New class.
4212         (Incremental_symtab_reader): New class.
4213         (Incremental_relocs_reader): New class.
4214         * layout.cc (Layout::finalize): Move finalization of incremental info
4215         and creation of incremental info sections to follow finalization of
4216         symbol table.  Set offsets for postprocessing sections.
4217         (Layout::create_incremental_info_sections): Call
4218         Incremental_inputs::create_data_sections.  Add incremental symtab
4219         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4220         sections to layout after input sections.
4221         * layout.h (struct Timespec): Forward declaration.
4222         (Layout::incremental_inputs): Add const.
4223         (Layout::create_incremental_info_sections): Add parameter.
4224         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4225         * object.cc: Include incremental.h.
4226         (Relobj::finalize_incremental_relocs): New function.
4227         (Sized_relobj::do_layout): Record input sections in incremental info.
4228         * object.h (Object::output_section): New function.
4229         (Object::output_section_offset): Moved from Relobj.
4230         (Object::get_incremental_reloc_base): New function.
4231         (Object::get_incremental_reloc_count): New function.
4232         (Object::do_output_section): New function.
4233         (Object::do_output_section_offset): Moved from Relobj.
4234         (Object::do_get_incremental_reloc_base): New function.
4235         (Object::do_get_incremental_reloc_count): New function.
4236         (Object::Object): Initialize new data members.
4237         (Relobj::output_section): Renamed do_output_section and moved to
4238         protected.
4239         (Relobj::output_section_offset): Moved to Object.
4240         (Relobj::do_get_incremental_reloc_base): New function.
4241         (Relobj::do_get_incremental_reloc_count): New function.
4242         (Relobj::allocate_incremental_reloc_counts): New function.
4243         (Relobj::count_incremental_reloc): New function.
4244         (Relobj::finalize_incremental_relocs): New function.
4245         (Relobj::next_incremental_reloc_index): New function.
4246         (Relobj::reloc_counts_): New data member.
4247         (Relobj::reloc_bases_): New data member.
4248         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4249         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4250         (Sized_relobj::incremental_relocs_scan): New function.
4251         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4252         (Sized_relobj::incremental_relocs_write): New function.
4253         (Sized_relobj::incremental_relocs_write_reltype): New function.
4254         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4255         incremental link.
4256         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4257         archives and object files elsewhere.
4258         (Add_symbols::run): Report object files here.
4259         (Finish_group::run): Report end of archive at end of group.
4260         * reloc.cc: Include layout.h, incremental.h.
4261         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4262         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4263         (Sized_relobj::incremental_relocs_scan): New function.
4264         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4265         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4266         (Sized_relobj::incremental_relocs_write): New function.
4267         (Sized_relobj::incremental_relocs_write_reltype): New function.
4268         * script.cc (read_input_script): Rewrite test for incremental link.
4269         Change call to Incremental_inputs::report_script.
4270         * symtab.h (Symbol_table::first_global_index): New function.
4271         (Symbol_table::output_count): New function.
4272
4273 2010-08-12  Doug Kwan  <dougkwan@google.com>
4274
4275         * arm.cc (Target_arm::merge_object_attributes): Check command line
4276         options --no-wchar-size-warning and --no-enum-size-warning.
4277         * options.h (General_options): Add ld-compatible options
4278         --no-enum-size-warning and --no-wchar-size-warning.
4279
4280 2010-08-04  Ian Lance Taylor  <iant@google.com>
4281
4282         * x86_64.cc (Target_x86_64::Scan::local): Use
4283         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4284         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4285         (Target_x86_64::Scan::global): Likewise.
4286         (Target_x86_64::Relocate::relocate): Likewise.
4287         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4288         Likewise.
4289
4290 2010-08-03  Cary Coutant  <ccoutant@google.com>
4291
4292         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4293         to reserve space in merged_strings vector. Keep total input size
4294         for stats.
4295         (Output_merge_string::do_print_merge_stats): Print total input size.
4296         * merge.h (Output_merge_string): Add input_size_ field.
4297         * stringpool.cc (Stringpool_template::string_length): Move
4298         implementations out of Stringpool_template class and place in
4299         stringpool.h.
4300         * stringpool.h (string_length): Move out of Stringpool_template.
4301
4302 2010-08-03  Ian Lance Taylor  <iant@google.com>
4303
4304         PR 11712
4305         * layout.cc (relaxation_loop_body): If address of load segment is
4306         set, adjust address to include headers if possible.
4307
4308 2010-08-03  Ian Lance Taylor  <iant@google.com>
4309
4310         * version.cc (version_string): Bump to 1.10.
4311
4312 2010-08-03  Ian Lance Taylor  <iant@google.com>
4313
4314         PR 11805
4315         * layout.h (enum Output_section_order): Define.
4316         (class Layout): Update declarations.
4317         * layout.cc (Layout::get_output_section): Add order parameter.
4318         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4319         is_first_non_relro parameters.  Change all callers.
4320         (Layout::choose_output_section): Likewise.
4321         (Layout::add_output_section_data): Likewise.
4322         (Layout::make_output_section): Likewise.  Set order.
4323         (Layout::default_section_order): New function.
4324         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4325         * output.cc (Output_section::Output_section): Initialize order_.
4326         Don't initialize deleted fields.
4327         (Output_segment::Output_segment): Don't initialize deleted
4328         fields.
4329         (Output_segment::add_output_section_to_load): New function
4330         replacing add_output_section.  Change all callers to call this or
4331         add_output_section_to_nonload.
4332         (Output_segment::add_output_section_to_nonload): New function.
4333         (Output_segment::remove_output_section): Rewrite.
4334         (Output_segment::add_initial_output_data): Likewise.
4335         (Output_segment::has_any_data_sections): Likewise.
4336         (Output_segment::is_first_section_relro): Likewise.
4337         (Output_segment::maximum_alignment): Likewise.
4338         (Output_segment::has_dynamic_reloc): New function replacing
4339         dynamic_reloc_count.  Change all callers.
4340         (Output_segment::has_dynamic_reloc_list): New function replacing
4341         dynamic_reloc_count_list.  Change all callers.
4342         (Output_segment::set_section_addresses): Rewrite.
4343         (Output_segment::set_offset): Rewrite.
4344         (Output_segment::find_first_and_last_list): Remove.
4345         (Output_segment::set_tls_offsets): Rewrite.
4346         (Output_segment::first_section_load_address): Likewise.
4347         (Output_segment::output_section_count): Likewise.
4348         (Output_segment::section_with_lowest_load_address): Likewise.
4349         (Output_segment::write_section_headers): Likewise.
4350         (Output_segment::print_sections_to_map): Likewise.
4351         * output.h (class Output_data): Remove dynamic_reloc_count_
4352         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4353         (Output_data::add_dynamic_reloc): Rewrite.
4354         (Output_data::has_dynamic_reloc): New function.
4355         (Output_data::dynamic_reloc_count): Remove.
4356         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4357         is_last_relro_, is_first_non_relro_, is_interp_,
4358         is_dynamic_linker_section_ fields.  Add order and set_order
4359         functions.  Remove is_relro_local, set_is_relro_local,
4360         is_last_relro, set_is_last_relro, is_first_non_relro,
4361         set_is_first_non_relro functions, is_interp, set_is_interp,
4362         is_dynamic_linker_section, and set_is_dynamic_linker_section
4363         functions.
4364         (class Output_segment): Change Output_data_list from std::list to
4365         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4366         output_bss_ fields.  Update declarations.
4367
4368 2010-08-02  Ian Lance Taylor  <iant@google.com>
4369
4370         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4371         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4372         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4373
4374 2010-08-02  Ian Lance Taylor  <iant@google.com>
4375
4376         PR 11855
4377         * script.cc (Script_options::Script_options): Initialize
4378         symbol_definitions_ and symbol_references_.
4379         (Script_options::add_symbol_assignment): Update
4380         symbol_definitions_ and symbol_references_.
4381         (Script_options::add_symbol_reference): New function.
4382         (script_symbol): New function.
4383         * script.h (class Script_options): Add symbol_definitions_ and
4384         symbol_references_ fields.
4385         (Script_options::referenced_const_iterator): New type.
4386         (Script_options::referenced_begin): New function.
4387         (Script_options::referenced_end): New function.
4388         (Script_options::is_referenced): New function.
4389         (Script_options::any_unreferenced): New function.
4390         * script-c.h (script_symbol): Declare.
4391         * yyscript.y (exp): Call script_symbol.
4392         * symtab.cc: Include "script.h".
4393         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4394         Change all callers.  Check symbols referenced by scripts.
4395         (Symbol_table::add_undefined_symbols_from_command_line): Add
4396         layout parameter.  Change all callers.
4397         (Symbol_table::do_add_undefined_symbols_from_command_line):
4398         Likewise.  Break out loop body.  Check symbols referenced by
4399         scripts.
4400         (Symbol_table::add_undefined_symbol_from_command_line): New
4401         function broken out of
4402         do_add_undefined_symbols_from_command_line.
4403         * symtab.h (class Symbol_table): Update declarations.
4404         * archive.cc: Include "layout.h".
4405         (Archive::should_include_member): Add layout parameter.  Change
4406         all callers.  Check for symbol mentioned in expression.
4407         * archive.h (class Archive): Update declaration.
4408         * object.cc (Sized_relobj::do_should_include_member): Add layout
4409         parameter.
4410         * object.h (Object::should_include_member): Add layout parameter.
4411         Change all callers.
4412         (Object::do_should_include_member): Add layout parameter.
4413         (class Sized_relobj): Update declaration.
4414         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4415         parameter.
4416         * dynobj.h (class Sized_dynobj): Update declaration.
4417         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4418         layout parameter.
4419         * plugin.h (class Sized_pluginobj): Update declaration.
4420
4421 2010-08-02  Ian Lance Taylor  <iant@google.com>
4422
4423         PR 11866
4424         * output.cc (Output_segment::set_offset): Search for the first and
4425         last sections rather than assuming that the list is in order.
4426         (Output_segment::find_first_and_last_list): New function.
4427         * output.h (class Output_segment): Update declarations.
4428         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4429         (relro_strip_test_SOURCES): New variable.
4430         (relro_strip_test_DEPENDENCIES): New variable.
4431         (relro_strip_test_LDFLAGS): New variable.
4432         (relro_strip_test_LDADD): New variable.
4433         (relro_strip_test.so): New target.
4434
4435 2010-08-02  Ian Lance Taylor  <iant@google.com>
4436
4437         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4438         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4439         (Target_i386::got_tlsdesc_section): New function.
4440         (Target_i386::got_section): Create space for GOT entries for
4441         TLSDESC relocations.
4442         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4443         R_386_TLS_GOTDESC.
4444         (Target_i386::Scan::global): Likewise.
4445         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4446         using TLSDESC GOT.
4447         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4448         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4449         (Target_x86_64::got_tlsdesc_section): New function.
4450         (Target_x86_64::got_section): Create space for GOT entries for
4451         TLSDESC relocations.
4452         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4453         R_386_TLS_GOTDESC.
4454         (Target_x86_64::Scan::global): Likewise.
4455         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4456         using TLSDESC GOT.
4457
4458 2010-08-02  Ian Lance Taylor  <iant@google.com>
4459
4460         * testsuite/final_layout.sh: Use dc to convert from hex to
4461         decimal.
4462
4463 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4464
4465         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4466         paramter to the call to gold::gc_process_relocs.
4467         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4468         paramter to the call to gold::gc_process_relocs.
4469         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4470         parameter to the call to gold::gc_process_relocs.
4471         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4472         template parameter to the call to gold::gc_process_relocs.
4473         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4474         paramter to the call to gold::gc_process_relocs.
4475         * gc.h (get_embedded_addend_size): New function.
4476         (gc_process_relocs): Save the size of the reloc for use by ICF.
4477         * icf.cc (get_section_contents): Get the addend from the text section
4478         for SHT_REL relocation sections.
4479         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4480         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4481         * int_encoding.h (read_from_pointer): New overloaded function.
4482         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4483         * testsuite/icf_sht_rel_addend_test.sh: New file.
4484         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4485         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4486
4487 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4488
4489         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4490         * Makefile.in: Regenerate.
4491         * testsuite/Makefile.in: Regenerate.
4492
4493 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4494
4495         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4496         * gold/testsuite/debug_msg.cc: Likewise.
4497         * gold/testsuite/odr_violation1.cc
4498         * gold/testsuite/odr_violation2.cc
4499
4500 2010-07-21  Cary Coutant  <ccoutant@google.com>
4501
4502         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4503         string, and length fields.
4504         (Output_merge_string::Merged_strings_list): New type.
4505         (Output_merge_string::Merged_strings_lists): New typedef.
4506         (Output_merge_string): Replace merged_strings_ with
4507         merged_strings_lists_.
4508         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4509         Merged_strings_list per input object and section.  Don't store pointer
4510         to the string.  Don't store length with each merged string entry.
4511         (Output_merge_string::finalize_merged_data): Loop over list of merged
4512         strings lists.  Recompute length of each merged string.
4513
4514 2010-07-15  Cary Coutant  <ccoutant@google.com>
4515
4516         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4517         here.
4518
4519 2010-07-14  Ian Lance Taylor  <iant@google.com>
4520
4521         * descriptors.cc (Descriptors::open): Report correct name in error
4522         message.
4523
4524 2010-07-13  Doug Kwan  <dougkwan@google.com>
4525
4526         * arm.cc (Arm_input_section::Arm_input_section): For a
4527         SHT_ARM_EXIDX section, always keeps the input sections.
4528         (Arm_input_section::set_exidx_section_link): New method.
4529         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4530         has_errors_ to false.
4531         (Arm_exidx_input_section::has_errors,
4532         Arm_exidx_input_section::set_has_errors): New methods.
4533         (Arm_exidx_input_section::has_errors_): New data member.
4534         (Arm_relobj::get_exidx_shndx_list): New method.
4535         (Arm_output_section::append_text_sections_to_list): Do not skip
4536         section without SHF_EXECINSTR.
4537         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4538         errors.
4539         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4540         section header.  Make error messages more verbose.  Check for
4541         a non-executable section linked to an EXIDX section.
4542         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4543         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4544         check that there is no deferred EXIDX section if we exit early.
4545         Instead of not making an EXIDX section in case of an error, make one
4546         and set the has_errors flag of it.
4547         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4548         in a relocatable link.
4549         (Target_arm::do_relax): Look for the EXIDX output section instead of
4550         assuming that it is called .ARM.exidx.
4551         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4552         section list.  Do not check for SHF_EXECINSTR section flags but
4553         skip any input section with errors.
4554         * output.cc (Output_section::Output_section): Initialize
4555         always_keeps_input_sections_ to false.
4556         (Output_section::add_input_section): Check for
4557         always_keeps_input_sections_.
4558         *  output.h (Output_section::always_keeps_input_sections,
4559         Output_section::set_always_keeps_input_sections): New methods.
4560         (Output_section::always_keeps_input_sections): New data member.
4561
4562 2010-07-13  Rafael Espindola  <espindola@google.com>
4563
4564         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4565         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4566
4567 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4568             Ian Lance Taylor  <iant@google.com>
4569
4570         * output.h (Output_section_lookup_maps::add_merge_section):
4571         Correct check of whether value was inserted.
4572         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4573         (Output_section_lookup_maps::add_relaxed_input_section):
4574         Likewise.
4575         * arm.cc (Target_arm::got_section): Remove used local os.
4576         * i386.cc (Target_i386::got_section): Likewise.
4577         * x86_64.cc (Target_x86_64::got_section): Likewise.
4578         * sparc.cc (Target_sparc::got_section): Likewise.
4579         (Target_sparc::relocate): Remove unused local have_got_offset.
4580         * powerpc.cc (Target_powerpc::relocate): Likewise.
4581
4582 2010-07-13  Ian Lance Taylor  <iant@google.com>
4583
4584         * compressed_output.cc (zlib_decompress): Fix signature in
4585         !HAVE_ZLIB_H case.
4586
4587         * archive.cc (Archive::include_member): Unlock an external member
4588         of a thin archive.  Don't bother to delete an object we know is
4589         NULL.
4590
4591 2010-07-12  Cary Coutant  <ccoutant@google.com>
4592
4593         * compressed_output.cc (zlib_decompress): New function.
4594         (get_uncompressed_size): New function.
4595         (decompress_input_section): New function.
4596         * compressed_output.h (get_uncompressed_size): New function.
4597         (decompress_input_section): New function.
4598         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4599         Handle compressed debug sections.
4600         * layout.cc (is_compressed_debug_section): New function.
4601         (Layout::output_section_name): Map compressed section names to
4602         canonical names.
4603         * layout.h (is_compressed_debug_section): New function.
4604         (is_debug_info_section): Recognize compressed debug sections.
4605         * merge.cc: Include compressed_output.h.
4606         (Output_merge_data::do_add_input_section): Handle compressed
4607         debug sections.
4608         (Output_merge_string::do_add_input_section): Handle compressed
4609         debug sections.
4610         * object.cc: Include compressed_output.h.
4611         (Sized_relobj::Sized_relobj): Initialize new data members.
4612         (build_compressed_section_map): New function.
4613         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4614         * object.h (Object::section_is_compressed): New method.
4615         (Object::do_section_is_compressed): New method.
4616         (Sized_relobj::Compressed_section_map): New type.
4617         (Sized_relobj::do_section_is_compressed): New method.
4618         (Sized_relobj::compressed_sections_): New data member.
4619         * output.cc (Output_section::add_input_section): Handle compressed
4620         debug sections.
4621         * reloc.cc: Include compressed_output.h.
4622         (Sized_relobj::write_sections): Handle compressed debug sections.
4623
4624 2010-07-08  Cary Coutant  <ccoutant@google.com>
4625
4626         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4627         weak when resolving to a dynamic def.
4628         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4629         for weak undef/dynamic def cases. Adjust callers.
4630         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4631         undef_binding_weak_.
4632         (Symbol_table::sized_write_globals): Adjust symbol binding.
4633         (Symbol_table::sized_write_symbol): Add binding parameter.
4634         * symtab.h (Symbol::set_undef_binding): New method.
4635         (Symbol::is_undef_binding_weak): New method.
4636         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4637         (Symbol_table::should_override): Add new parameter.
4638         (Symbol_table::sized_write_symbol): Add new parameter.
4639
4640         * testsuite/weak_undef_file1.cc: Add new test case.
4641         * testsuite/weak_undef_file2.cc: Fix header comment.
4642         * testsuite/weak_undef_test.cc: Add new test case.
4643
4644 2010-06-29  Doug Kwan  <dougkwan@google.com>
4645
4646         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4647         Initialize USE_SYMBOL_.
4648         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4649         definition.
4650         (Arm_reloc_property::uses_symbol_): New data member declaration.
4651         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4652         uses symbol value and symbol is undefined but not weakly undefined.
4653
4654 2010-06-28  Rafael Espindola  <espindola@google.com>
4655
4656         * plugin.cc (Plugin::load): Use dlerror.
4657
4658 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4659
4660         * symtab.cc (detect_odr_violations): When reporting an ODR
4661         violation, report an object where the symbol is defined.
4662
4663 2010-06-25  Doug Kwan  <dougkwan@google.com>
4664
4665         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4666         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4667         definition.
4668         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4669         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4670         target hook to detect function points.
4671         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4672         * icf.h (Icf::check_section_for_function_pointers): Change type of
4673         parameter SECTION_NAME to const reference to std::string.  Use
4674         target hook to determine if section may have unsafe pointers.
4675         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4676         method definition.
4677
4678 2010-06-21  Rafael Espindola  <espindola@google.com>
4679
4680         * fileread.cc (Input_file::find_fie): New
4681         (Input_file::open): Use Input_file::find_fie.
4682         * fileread.h (Input_file::find_fie): New
4683         * plugin.cc (set_extra_library_path): New.
4684         (Plugin::load): Add set_extra_library_path to the transfer vector.
4685         (Plugin_manager::set_extra_library_path): New.
4686         (Plugin_manager::add_input_file): Use the extra search path if set.
4687         (set_extra_library_path(): New.
4688         * plugin.h (Plugin_manager): Add set_extra_library_path and
4689         extra_search_path_.
4690
4691 2010-06-19  Cary Coutant  <ccoutant@google.com>
4692
4693         * layout.cc (gdb_sections): Add .debug_types.
4694         (lines_only_debug_sections): Likewise.
4695
4696 2010-06-18  Rafael Espindola  <espindola@google.com>
4697
4698         * plugin.cc (add_input_file,add_input_library)
4699         (Plugin_manager::add_input_file): Make filename arguments const.
4700         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4701         const.
4702
4703 2010-06-16  Doug Kwan  <dougkwan@google.com>
4704
4705         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4706         .ARM.attributes section if we have not merged any input
4707         attributes sections.
4708
4709 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4710
4711         * arm.cc: Allow combining objects with no EABI version
4712         information.
4713
4714 2010-06-15  Rafael Espindola  <espindola@google.com>
4715
4716         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4717
4718 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4719
4720         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4721         (struct iovec): Correct !HAVE_READV definition.
4722
4723 2010-06-10  Cary Coutant  <ccoutant@google.com>
4724
4725         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4726         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4727         reloc sections.
4728         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4729
4730         PR 11683
4731         * symtab.h (Symbol::is_placeholder): New member function.
4732         * target-reloc.h (relocate_section): Check for placeholder symbols.
4733
4734         * testsuite/Makefile.am (plugin_test_8): New test.
4735         (plugin_test_9): New test.
4736         * testsuite/Makefile.in: Regenerate.
4737
4738 2010-06-09  Nick Clifton  <nickc@redhat.com>
4739
4740         * yyscript.y (input_list_element): Allow strings prefixed with
4741         the '-' character.  Treat these as libraries.
4742         * script.cc (script_add_library): New function.  Adds a library
4743         specified by "-l<name>" found in an input script.
4744         * script-c.h: Add prototype for script_add_library.
4745
4746 2010-06-07  Doug Kwan  <dougkwan@google.com>
4747
4748         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4749         Restrict stub-group size to be within long conditional branch
4750         range when working around cortex-A8 erratum.
4751
4752 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4753
4754         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4755         #ifdef typo.
4756
4757 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4758
4759         PR gold/11658
4760         * output.cc
4761         (Output_section::Input_section_sort_entry::compare_section_ordering):
4762         Change to return non-zero correctly.
4763         (Output_section::Input_section_sort_section_order_index_compare
4764         ::operator()): Change to fix ambiguity in comparisons.
4765
4766 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4767
4768         * gold.h (is_wildcard_string): New function.
4769         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4770         (Layout::layout_eh_frame): Ditto.
4771         (Layout::find_section_order_index): New method.
4772         (Layout::read_layout_from_file): New method.
4773         * layout.h (Layout::find_section_order_index): New method.
4774         (Layout::read_layout_from_file): New method.
4775         (Layout::input_section_position_): New private member.
4776         (Layout::input_section_glob_): New private member.
4777         * main.cc (main): Call read_layout_from_file here.
4778         * options.h (--section-ordering-file): New option.
4779         * output.cc (Output_section::input_section_order_specified_): New
4780         member.
4781         (Output_section::Output_section): Initialize new member.
4782         (Output_section::add_input_section): Add new parameter.
4783         Keep input sections when --section-ordering-file is used.
4784         (Output_section::set_final_data_size): Sort input sections when
4785         section ordering file is specified.
4786         (Output_section::Input_section_sort_entry): Add new parameter.
4787         Check sorting type.
4788         (Output_section::Input_section_sort_entry::compare_section_ordering):
4789         New method.
4790         (Output_section::Input_section_sort_compare::operator()): Change to
4791         consider section_order_index.
4792         (Output_section::Input_section_sort_init_fini_compare::operator()):
4793         Change to consider section_order_index.
4794         (Output_section::Input_section_sort_section_order_index_compare
4795         ::operator()): New method.
4796         (Output_section::sort_attached_input_sections): Change to sort
4797         according to section order when specified.
4798         (Output_section::add_input_section<32, true>): Add new parameter.
4799         (Output_section::add_input_section<64, true>): Add new parameter.
4800         (Output_section::add_input_section<32, false>): Add new parameter.
4801         (Output_section::add_input_section<64, false>): Add new parameter.
4802         * output.h (Output_section::add_input_section): Add new parameter.
4803         (Output_section::input_section_order_specified): New
4804         method.
4805         (Output_section::set_input_section_order_specified): New method.
4806         (Input_section::Input_section): Initialize section_order_index_.
4807         (Input_section::section_order_index): New method.
4808         (Input_section::set_section_order_index): New method.
4809         (Input_section::section_order_index_): New member.
4810         (Input_section::Input_section_sort_section_order_index_compare): New
4811         struct.
4812         (Output_section::input_section_order_specified_): New member.
4813         * script-sections.cc (is_wildcard_string): Delete and move modified
4814         method to gold.h.
4815         (Output_section_element_input::Output_section_element_input): Modify
4816         call to is_wildcard_string.
4817         (Output_section_element_input::Input_section_pattern
4818         ::Input_section_pattern): Ditto.
4819         (Output_section_element_input::Output_section_element_input): Ditto.
4820         * testsuite/Makefile.am (final_layout): New test case.
4821         * testsuite/Makefile.in: Regenerate.
4822         * testsuite/final_layout.cc: New file.
4823         * testsuite/final_layout.sh: New file.
4824
4825 2010-06-01  Rafael Espindola  <espindola@google.com>
4826
4827         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4828
4829 2010-06-01  Rafael Espindola  <espindola@google.com>
4830
4831         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4832         visibility of symbols.
4833
4834 2010-05-27  Doug Kwan  <dougkwan@google.com>
4835
4836         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4837         from start of output section instead of address for a local symbol
4838         in a merged or relaxed section when doing a relocatable link.
4839
4840 2010-05-26  Rafael Espindola  <espindola@google.com>
4841
4842        PR 11604
4843         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4844         adding sections the garbage collector removed.
4845         * gold/testsuite/Makefile.am: Add test.
4846         * gold/testsuite/Makefile.in: Regenerate.
4847         * gold/testsuite/plugin_test_7.sh: New.
4848         * gold/testsuite/plugin_test_7_1.c: New.
4849         * gold/testsuite/plugin_test_7_2.c: New.
4850
4851 2010-05-26  Rafael Espindola  <espindola@google.com>
4852
4853         * script-sections.cc (Output_section_definition::set_section_addresses):
4854         Check for --section-start.
4855
4856 2010-05-26  Doug Kwan  <dougkwan@google.com>
4857
4858         * arm.cc (Arm_scan_relocatable_relocs): New class.
4859         (Target_arm::relocate_special_relocatable): New method.
4860         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4861         (Arm_relocate_functions::thumb_branch_common): Same.
4862         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4863         instead of Default_scan_relocatable_relocs.
4864         * target-reloc.h (relocate_for_relocatable): Let target handle
4865         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4866         * target.h (Sized_target::relocate_special_relocatable): New method.
4867
4868 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4869
4870         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4871
4872 2010-05-23  Doug Kwan  <dougkwan@google.com>
4873
4874         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4875         instead of a cast.
4876         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4877         with a direct branch, not a conditional branch, to a stub.
4878         * merge.cc (Output_merge_base::record_input_section): New method
4879         defintion.
4880         (Output_merge_data::do_add_input_section): Record input section if
4881         keeps-input-sections flag is set.
4882         (Output_merge_string::do_add_input_section): Ditto.
4883         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4884         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4885         INPUT_SECTIONS_.
4886         (Output_merge_base::keeps_input_sections,
4887         Output_merge_base::set_keeps_input_sections,
4888         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4889         method definitions.
4890         (Output_merge_base::Input_sections): New type declaration.
4891         (Output_merge_base::input_sections_begin,
4892         Output_merge_base::input_sections_end,
4893         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4894         (Output_merge_base::bool keeps_input_sections_,
4895         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4896         Output_merge_base::input_sections_): New data members.
4897         (Output_merge_data::do_set_keeps_input_sections): New method
4898         defintion.
4899         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4900         * output.cc (Output_section::Input_section::relobj): Move method
4901         defintion from class declaration to here and handle merge sections.
4902         (Output_section::Input_section::shndx): Ditto.
4903         (Output_section::Output_section): Remove initializations of removed
4904         data members and initialize new data member LOOKUP_MAPS_.
4905         (Output_section::add_input_section): Set keeps-input-sections flag
4906         for a newly created merge output section as appropriate.  Adjust code
4907         to use Output_section_lookup_maps class.
4908         (Output_section::add_relaxed_input_section): Adjst code for lookup
4909         maps code refactoring.
4910         (Output_section::add_merge_input_section): Add a new parameter
4911         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4912         class.  If adding input section to a newly created merge output
4913         section fails, remove the new merge section.
4914         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4915         Adjust code for use of the Output_section_lookup_maps class.
4916         (Output_section::find_merge_section): Ditto.
4917         (Output_section::build_lookup_maps): New method defintion.
4918         (Output_section::find_relaxed_input_section): Adjust code to use
4919         Output_section_lookup_maps class.
4920         (Output_section::get_input_sections): Export merge sections.  Adjust
4921         code to use Output_section_lookup_maps class.
4922         (Output_section:::add_script_input_section): Adjust code to use
4923         Output_section_lookup_maps class.  Update lookup maps for merge
4924         sections also.
4925         (Output_section::discard_states): Use Output_section_lookup_maps.
4926         (Output_section::restore_states): Same.
4927         * output.h (Merge_section_properties): Move class defintion out of
4928         Output_section.
4929         (Output_section_lookup_maps): New class.
4930         (Output_section::Input_section::is_merge_section): New method
4931         defintion.
4932         (Output_section::Input_section::relobj): Move defintion out of class
4933         defintion.  Declare method only.
4934         (Output_section::Input_section::shndx): Ditto.
4935         (Output_section::Input_section::output_merge_base): New method defintion.
4936         (Output_section::Input_section::u2_.pomb): New union field.
4937         (Output_section::Merge_section_by_properties_map,
4938         Output_section::Output_section_data_by_input_section_map,
4939         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4940         Remove types.
4941         (Output_section::add_merge_input_section): Add new parameter
4942         KEEPS_INPUT_SECTIONS.
4943         (Output_section::build_lookup_maps): New method declaration.
4944         (Output_section::merge_section_map_,
4945         Output_section::merge_section_by_properties_map_,
4946         Output_section::relaxed_input_section_map_,
4947         Output_section::is_relaxed_input_section_map_valid_): Remove data
4948         members.
4949         (Output_section::lookup_maps_): New data member.
4950
4951 2010-05-21  Doug Kwan  <dougkwan@google.com>
4952
4953         PR gold/11619
4954         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4955         avoid a compilation error.
4956
4957 2010-05-19  Rafael Espindola  <espindola@google.com>
4958
4959         * script-sections.cc (Output_section_definition::allocate_to_segment):
4960         Update the phdrs_list even when the output section is NULL.
4961         * testsuite/Makefile.am: Add test.
4962         * testsuite/Makefile.in: Regenerate.
4963         * testsuite/script_test_9.cc: New.
4964         * testsuite/script_test_9.sh: New.
4965         * testsuite/script_test_9.t: New.
4966
4967 2010-05-19  Doug Kwan  <dougkwan@google.com>
4968
4969         * arm.cc (Arm_input_section::original_size): New method.
4970         (Arm_input_section::do_addralign): Add a cast.
4971         (Arm_input_section::do_output_offset): Remove static cast.
4972         (Arm_input_section::original_addralign,
4973          Arm_input_section::original_size_): Change type to uint32_t.
4974         (Arm_input_section::init): Add safe casts for section alignment
4975         and size.
4976         (Arm_input_section::set_final_data_size): Do not set address and
4977         offset of stub table.
4978         (Arm_output_section::fix_exidx_coverage): Change use of of
4979         Output_section::Simple_input_section to that of
4980         Output_section::Input_section.
4981         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4982         except for the first pass.
4983         * output.cc (Output_section::get_input_sections): Change type of
4984         input_sections to std::list<Input_section>.
4985         (Output_section::add_script_input_section): Rename from
4986         Output_section::add_simple_input_section.  Change type of SIS
4987         parameter from Simple_input_section to Input_section.
4988         * output.h (Output_section::Simple_input_section): Remove class.
4989         (Output_section::Input_section): Change class visibility to public.
4990         (Output_section::Input_section::addralign): Use stored alignments
4991         for special input sections if set.
4992         (Output_section::Input_section::set_addralign): New method.
4993         (Output_section::get_input_sections): Change parameter type from
4994         list of Simple_input_section to list of Input_section.
4995         (Output_section::add_script_input_section): Rename from
4996         Output_section::add_simple_input_section. Change first parameter's
4997         type from Simple_input_section to Input_section and remove the
4998         second and third parameters.
4999         * script-sections.cc (Input_section::Input_section_list): Change
5000         type to list of Output_section::Input_section/
5001         (Input_section_info::Input_section_info): Change parameter type of
5002         INPUT_SECTION to Output_section::Input_section.
5003         (Input_section_info::input_section): Change return type.
5004         (Input_section_info::input_section_): Change type to
5005         Output_section::Input_section.
5006         (Output_section_element_input::set_section_addresses): Adjust code
5007         to use Output_section::Input_section instead of
5008         Output_section::Simple_input_section.  Adjust code for renaming
5009         of Output_section::add_simple_input_section.
5010         (Orphan_output_section::set_section_addresses): Ditto.
5011
5012 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5013
5014         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5015         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5016
5017 2010-05-18  Rafael Espindola  <espindola@google.com>
5018
5019         * options.cc (General_options::finalize): Handle -nostdlib.
5020         * options.h (nostdlib): New option.
5021         * script.cc (script_add_search_dir): Handle -nostdlib.
5022
5023 2010-05-12  Doug Kwan  <dougkwan@google.com>
5024
5025         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5026         attributes section only if there no attributes section after merging.
5027         (Target_arm::merge_object_attributes): Move value of
5028         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5029         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5030         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5031         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5032         and arm_attr_merge_7.stdout.
5033         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5034         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5035         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5036         arm_attr_merge_7b.o): New rules.
5037         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5038         arm_attr_merge_7
5039         * testsuite/Makefile.in: Regenerate.
5040         * testsuite/arm_attr_merge.sh: New file.
5041         * testsuite/arm_attr_merge_[67][ab].s: Same.
5042
5043 2010-05-05  Nick Clifton  <nickc@redhat.com>
5044
5045         * po/es.po: Updated Spanish translation.
5046
5047 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5048
5049         * Makefile.am (install-exec-local): Properly install gold as
5050         default cross linker.
5051         * Makefile.in: Regenerated.
5052
5053 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5054             Nick Clifton  <nickc@redhat.com>
5055
5056         * configure.ac (install_as_default): Define and set to false
5057         unless --enable-gold or --enable-gold=both/gold has been
5058         specified.
5059         * configure: Regenerate.
5060
5061         * Makefile.am (install-exec-local): Install the executable as
5062         'ld.gold'.  If install_as_default is true then also install it as
5063         'ld'.
5064         * Makefile.in: Regenerated.
5065
5066 2010-04-24  Ian Lance Taylor  <iant@google.com>
5067
5068         * layout.cc (Layout::layout_reloc): In relocatable link don't
5069         combine reloc sections for grouped sections.
5070
5071 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5072
5073         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5074         sections that are not ordinary to icf.
5075         * icf.cc (get_section_contents): Handle relocation pointing to section
5076         with no object or shndx information.
5077         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5078         * testsuite/Makefile.in: Regenerate.
5079         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5080         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5081
5082 2010-04-22  Ian Lance Taylor  <iant@google.com>
5083
5084         * expression.cc (Expression::Expression_eval_info): Add
5085         result_alignment_pointer field.
5086         (Expression::eval_with_dot): Add result_alignment_pointer
5087         parameter.  Change all callers.
5088         (Expression::eval_maybe_dot): Likewise.
5089         (class Binary_expression): Add alignment_pointer parameter to
5090         left_value and right_value.  Change all callers.
5091         (BINARY_EXPRESSION): Set result alignment.
5092         (class Trinary_expression): Add alignment_pointer parameter to
5093         arg2_value and arg3_value.  Change all callers.
5094         (Trinary_cond::value): Set result alignment.
5095         (Max_expression::value, Min_expression::value): Likewise.
5096         (Align_expression::value): Likewise.
5097         * script-sections.cc (class Sections_element): Add dot_alignment
5098         parameter to set_section_addresses virtual function.  Update
5099         instantiations.
5100         (class Output_section_element): Likewise.
5101         (Script_sections::create_segments): Add dot_alignment parameter.
5102         Change all callers.
5103         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5104         (Script_sections::set_phdrs_clause_addresses): Likewise.
5105         * script-sections.h: Update declarations.
5106         * script.h: Update declarations.
5107         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5108         min_p_align.
5109         * testsuite/script_test_3.t: Set large alignment.
5110         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5111         segment has expected alignment.
5112
5113 2010-04-22  Nick Clifton  <nickc@redhat.com>
5114
5115         * po/gold.pot: Updated by the Translation project.
5116         * po/vi.po: Updated Vietnamese translation.
5117
5118 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5119
5120         * testsuite/Makefile.am (check_PROGRAMS): Add
5121         icf_virtual_function_folding_test.
5122         * testsuite/Makefile.in: Regenerated.
5123
5124 2010-04-15  Andrew Haley  <aph@redhat.com>
5125
5126         * options.h (merge_exidx_entries): New option.
5127         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5128         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5129         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5130         (Target_arm::merge_exidx_entries): New function.
5131         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5132         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5133         to Arm_exidx_fixup constructor.
5134         Add new arg, merge_exidx_entries.
5135         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5136         Arm_output_section::fix_exidx_coverage.
5137
5138 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5139
5140         * icf.cc (get_section_contents): Check for preemptible functions.
5141         Ignore addend when appropriate.
5142         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5143         section folded.
5144         (add_from_relobj): Check for section folded.
5145         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5146         * symtab.h (should_add_dynsym_entry): Add new parameter.
5147         * target-reloc.h (scan_relocs): Check for section folded.
5148         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5149         Check reloc types for function pointers in shared objects.
5150         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5151         case.
5152         (icf_preemptible_functions_test): New test case.
5153         (icf_string_merge_test): New test case.
5154         * testsuite.Makefile.in: Regenerate.
5155         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5156         bar_glob.  Refactor code.
5157         * testsuite/icf_preemptible_functions_test.cc: New file.
5158         * testsuite/icf_preemptible_functions_test.sh: New file.
5159         * testsuite/icf_string_merge_test.cc: New file.
5160         * testsuite/icf_string_merge_test.sh: New file.
5161         * testsuite/icf_virtual_function_folding_test.cc: New file.
5162         * testsuite/icf_virtual_function_folding_test.sh: New file.
5163
5164 2010-04-14  Doug Kwan  <dougkwan@google.com>
5165
5166         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5167         for local symbol recounting if we remove a section due to ICF.
5168         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5169         there are no regular objects in input.
5170
5171 2010-04-13  Doug Kwan  <dougkwan@google.com>
5172
5173         * arm.cc (Arm_input_section::set_final_data_size): Compute
5174         accurate final data size instead of using current data size.
5175
5176 2010-04-09  Doug Kwan  <dougkwan@google.com>
5177
5178         * layout.cc (Layout::choose_output_section): Handle script section
5179         types.
5180         (Layout::make_output_section_for_script): Add section type parameter.
5181         Handle script section types.
5182         * layout.h (Layout::make_output_section_for_script): Add section
5183         type parameter.
5184         * output.cc (Output_section::Output_section): Initialize data member
5185         is_noload_.
5186         (Output_section::do_reset_address_and_file_offset): Do not set address
5187         to 0 if section is a NOLOAD section.
5188         * output.h (Output_section::is_noload): New method.
5189         (Output_section::set_is_noload): Ditto.
5190         (Output_section::is_noload_): New data member.
5191         * script-c.h (Script_section_type): New enum type.
5192         (struct Parser_output_section_header): Add new file section_type.
5193         * script-sections.cc (Sections_element::output_section_name): Add
5194         parameter for returning script section type.
5195         (Output_section_definition::output_section_name): Ditto.
5196         (Output_section_definition::section_type)P; New method.
5197         (Output_section_definiton::script_section_type_name): Ditto.
5198         (Output_section_definition::script_section_type_): New data member.
5199         (Output_section_definition::Output_section_definition): Initialize
5200         data member Output_section_definition::script_section_type_.
5201         (Output_section_definition::create_sections): Pass script section type
5202         to Layout::make_output_section_for_script.
5203         (Output_section_definition::output_section_name): Return script
5204         section type to caller.
5205         (Output_section_definition::set_section_address): Do not advance
5206         dot value and load address if section type is NOLOAD.  Set address
5207         of NOLOAD sections regardless of section flags.
5208         (Output_section_definition::print): Print section type if it is
5209         not SCRIPT_SECTION_TYPE_NONE.
5210         (Output_section_definition::section_type): New method.
5211         (Output_section_definition::script_section_type_name): Ditto.
5212         (Script_sections::output_section_name): Add new parameter
5213         PSECTION_TYPE for returning script section type.  Pass it to
5214         section elements.  Handle discard sections.
5215         (Sort_output_sections::operator()): Handle NOLOAD sections.
5216         * script-sections.h (Script_sections::Section_type): New enum type.
5217         (Script_sections::output_section_name): Add a new parameter for
5218         returning script section type.
5219         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5220         INFO and NOLOAD.
5221         * yyscript.y (union): Add new field SECTION_TYPE.
5222         (COPY, DSECT, INFO, NOLOAD): New tokens.
5223         (opt_address_and_section_type): Change type to output_section_header.
5224         (section_type): New non-terminal
5225         (section_header): Handle section type.
5226         (opt_address_and_section_type): Return section type value.
5227
5228 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5229
5230         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5231         * testsuite/plugin_common_test_2.c (foo): Likewise.
5232
5233 2010-04-08  Doug Kwan  <dougkwan@google.com>
5234
5235         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5236         Output_merge_data.
5237         * output.cc (Output_section::add_merge_input_section): Simplify
5238         code and return status of Output_merge_base::add_input_section.
5239         Update merge section map only if Output_merge_base::add_input_section
5240         returns true.
5241
5242 2010-04-07  Doug Kwan  <dougkwan@google.com>
5243
5244         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5245         if section is marked as containing instructions but has no mapping
5246         symbols.
5247         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5248         correct section index.
5249         (Arm_relobj::find_linked_text_section): Ditto.
5250
5251 2010-04-07  Cary Coutant  <ccoutant@google.com>
5252
5253         * archive.cc (include_member): Destroy Read_symbols_data object before
5254         releasing file.
5255         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5256         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5257         (Read_symbols_data::~Read_symbols_data) New destructor.
5258         (Section_relocs::Section_relocs) New constructor.
5259         (Section_relocs::~Section_relocs) New destructor.
5260         (Read_relocs_data::Read_relocs_data) New constructor.
5261         (Read_relocs_data::~Read_relocs_data) New destructor.
5262         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5263         pointers to NULL after deleting.
5264
5265 2010-04-07  Doug Kwan  <dougkwan@google.com>
5266
5267         * arm.cc: Replace "endianity" with "endianness" in comments.
5268         (Arm_exidx_cantunwind): Ditto.
5269         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5270         (Arm_relobj::merge_flags_and_attributes): New method.
5271         (Arm_relobj::merge_flags_and_attributes_): New data member.
5272         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5273         (Arm_relobj::scan_sections_for_stubs): Ditto.
5274         (Arm_relobj::do_read_symbols): Check to see if we really want to
5275         merge processor-specific flags and attributes.  Exit early if
5276         an object is empty except for section names and the undefined symbol.
5277         (Target_arm::do_finalize_sections): Move check for ELF format to
5278         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5279         attributes from a regular object only when we have determined that
5280         it is aapropriate.  Do not create an .ARM.attributes section in
5281         output if there is no regular input object.
5282         (Target_arm::merge_processor_specific_flags): Check
5283         --warn-mismatch before printing any error.
5284         (Target_arm::merge_object_attributes): Ditto.
5285         * gold.cc (queue_middle_tasks): Handle the case in which there is
5286         no regular object in input.
5287         * options.cc (General_options::parse_EB): New method.
5288         (General_options::parse_EL): Same.
5289         (General_options::General_options): Initialize endianness_.
5290         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5291         New options.
5292         (General_options::Endianness): New enum.
5293         (General_options::endianness): New method.
5294         (General_options::endianness_): New data member.
5295         * parameters.cc (Parameters::set_options): Check target endianness.
5296         (Parameters::set_target_once): Ditto.
5297         (Parameters::check_target_endianness): New method.
5298         (parameters_force_valid_target): If either -EL or -EB is specified,
5299         use it to define endianness of default target.
5300         * parameters.h (Parameters::check_target_endianness): New method
5301         declaration.
5302         * target.h (class Target): Change "endianity" to "endianness"
5303         in comments.
5304
5305 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5306
5307         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5308         * configure: Regenerate.
5309         * Makefile.in: Regenerate.
5310         * testsuite/Makefile.in: Regenerate.
5311
5312 2010-04-06  Cary Coutant  <ccoutant@google.com>
5313
5314         gcc PR lto/42757
5315         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5316         prevailing definitions of common symbols.
5317         * testsuite/plugin_test_6.sh: New test case.
5318         * testsuite/plugin_common_test_1.c: New test case.
5319         * testsuite/plugin_common_test_2.c: New test case.
5320         * testsuite/Makefile.am (plugin_test_6): New test case.
5321         * testsuite/Makefile.in: Regenerate.
5322
5323 2010-04-06  Nick Clifton  <nickc@redhat.com>
5324
5325         * po/vi.po: New Vietnamese translation.
5326
5327 2010-03-30  Doug Kwan  <dougkwan@google.com>
5328
5329         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5330
5331 2010-03-25  Doug Kwan  <dougkwan@google.com>
5332
5333         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5334         to avoid a conversion warning on a 32-bit host.
5335
5336 2010-03-24  Ian Lance Taylor  <iant@google.com>
5337
5338         * testsuite/script_test_3.t: Add a TLS segment.
5339         * testsuite/Makefile.am (check_PROGRAMS): Add
5340         tls_phdrs_script_test.
5341         (tls_phdrs_script_test_SOURCES): Define.
5342         (tls_phdrs_script_test_DEPENDENCIES): Define.
5343         (tls_phdrs_script_test_LDFLAGS): Define.
5344         (tls_phdrs_script_test_LDADD): Define.
5345         * testsuite/Makefile.in: Rebuild.
5346
5347 2010-03-23  Cary Coutant  <ccoutant@google.com>
5348
5349         * fileread.cc (find_or_make_view): Fix comment.
5350
5351 2010-03-23  Ian Lance Taylor  <iant@google.com>
5352
5353         * script-sections.cc (class Orphan_section_placement): Define
5354         PLACE_TLS and PLACE_TLS_BSS.
5355         (Orphan_section_placement::Orphan_section_placement): Initialize
5356         new places.
5357         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5358         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5359         (tls_script_test_SOURCES): Define.
5360         (tls_script_test_DEPENDENCIES): Define.
5361         (tls_script_test_LDFLAGS): Define.
5362         (tls_script_test_LDADD): Define.
5363         * testsuite/Makefile.in: Rebuild.
5364
5365 2010-03-22  Doug Kwan  <dougkwan@google.com>
5366
5367         * arm.cc (Arm_relocate_functions::abs8,
5368         Arm_relocate_functions::abs16): Use correct check for overflow
5369         specified in the ARM ELF specs.
5370         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5371         target of a BLX instruction specially.
5372         (Reloc_stub::stub_type_for_reloc): Ditto.
5373         (Relocate::relocate): Use symbolic names instead of numeric relocation
5374         codes to report error.
5375         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5376         workaround.
5377         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5378         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5379         thumb2_blx_out_of_range.stdout
5380         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5381         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5382         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5383         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5384         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5385         thumb2_blx_in_range, thumb2_blx_in_range.o,
5386         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5387         thumb2_blx_out_of_range.o): New rules.
5388         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5389         thumb2_blx_in_range and thumb2_blx_out_of_range.
5390         * testsuite/Makefile.in: Regenerate.
5391         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5392         * testsuite/thumb_blx_in_range.s: New file.
5393         * testsuite/thumb_blx_out_of_range.s: New file.
5394
5395 2010-03-22  Rafael Espindola  <espindola@google.com>
5396
5397         * archive.cc (Should_include): Move to archive.h.
5398         (should_include_member): Make it a member of Archive.
5399         (Lib_group): New.
5400         (Add_lib_group_symbols): New.
5401         * archive.h: Include options.h.
5402         (Archive_member): Moved from Archive.
5403         (Should_include): Moved from archive.cc.
5404         (Lib_group): New.
5405         (Add_lib_group_symbols): New.
5406         * dynobj.cc (do_should_include_member): New.
5407         * dynobj.h (do_should_include_member): New.
5408         * gold.cc (queue_initial_tasks): Update call to queue.
5409         * main.cc (main): Print lib group stats.
5410         * object.cc (do_should_include_member): New.
5411         * object.h: Include archive.h.
5412         (Object::should_include_member): New.
5413         (Object::do_should_include_member): New.
5414         (Sized_relobj::do_should_include_member): New.
5415         * options.cc (General_options::parse_start_lib): New.
5416         (General_options::parse_end_lib): New.
5417         (Input_arguments::add_file): Handle lib groups.
5418         (Input_arguments::start_group): Check we are not in a lib.
5419         (Input_arguments::start_lib): New.
5420         (Input_arguments::end_lib): New.
5421         * options.h (General_options): Add start_lib and end_lib.
5422         (Input_argument::lib_): New.
5423         (Input_argument::lib): New.
5424         (Input_argument::is_lib): New.
5425         (Input_file_lib): New.
5426         (Input_arguments::in_lib_): New.
5427         (Input_arguments::in_lib): New.
5428         (Input_arguments::start_lib): New.
5429         (Input_arguments::end_lib_): New.
5430         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5431         in unused members as preempted.
5432         (Sized_pluginobj::do_should_include_member): New.
5433         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5434         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5435         return the blocker.
5436         (Read_symbols::do_whole_lib_group): New.
5437         (Read_symbols::do_lib_group): New.
5438         (Read_symbols::do_read_symbols): Handle lib groups.
5439         (Read_symbols::get_name): Handle lib groups.
5440         * readsyms.h (Read_symbols): Add an archive member pointer.
5441         (Read_symbols::do_whole_lib_group): New.
5442         (Read_symbols::do_lib_group): New.
5443         (Read_symbols::member_): New.
5444         * script.cc (read_input_script): Update call to queue_soon.
5445
5446 2010-03-19  Doug Kwan  <dougkwan@google.com>
5447
5448         * arm.cc (Stub_table::Stub_table): Initialize new data members
5449         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5450         (Stub_table::add_reloc_stub): Assign stub offset and update
5451         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5452         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5453         New data members.
5454         (Stub_table::update_data_size_and_addralign): Use
5455         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5456         instead of going over all reloc stubs.
5457         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5458         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5459         Stringpool_template::offset_ to size of Stringpool_char.
5460         (Stringpool_template::new_key_offset): Remove code to initialize
5461         Stringpool_template::offset_.
5462         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5463         Stringpool_template::offset_ to zero.
5464
5465 2010-03-15  Doug Kwan  <dougkwan@google.com>
5466
5467         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5468         offset_.
5469         (Stringpool_template::new_key_offset): New method.
5470         (Stringpool_template::add_string): Assign offsets when adding new
5471         strings.
5472         (Stringpool_template::set_string_offsets): Do not set string offsets
5473         when not optimizing.
5474         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5475         member size_.
5476         (Chunked_vector::clear): Clear size_.
5477         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5478         (Chunked_vector::size): Return size_.
5479         (Chunked_vector::push_back): Use size_ to find insert position.
5480         (Chunked_vector::size_): New data member.
5481         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5482         (Stringpool_template::new_key_offset): New method declaration.
5483         (Stringpool_template::offset_): New data member.
5484
5485 2010-03-15   Rafael Espindola  <espindola@google.com>
5486
5487         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5488         Add_symbols' constructor.
5489         * readsyms.h (Add_symbols): Remove the input_group member.
5490
5491 2010-03-10  Ian Lance Taylor  <iant@google.com>
5492
5493         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5494         target to ask whether a reference to a symbol requires a stack
5495         split.
5496         * target.h (Target::is_call_to_non_split): New function.
5497         (Target::do_is_call_to_non_split): Declare virtual function.
5498         * target.cc: Include "symtab.h".
5499         (Target::do_is_call_to_non_split): New function.
5500         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5501
5502 2010-03-10  Cary Coutant  <ccoutant@google.com>
5503
5504         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5505         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5506         (File_read::open[2]): Add whole_file_view_ to list of views.
5507         (File_read::make_view): Remove test of whole_file_view_.
5508         (File_read::find_or_make_view): Create whole_file_view_ if
5509         necessary.
5510         (File_read::clear_views): Replace bool parameter with enum;
5511         adjust all callers.  Don't delete views with permanent data;
5512         do delete cached views and views from archives if
5513         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5514         if clearing the corresponding view.
5515         * fileread.h (File_read::Clear_views_mode): New enum.
5516         (File_read::View::is_permanent_view): New method.
5517         (File_read::clear_views): Replace bool parameter
5518         with enum; adjust all callers.
5519         * options.h (General_options): Change keep_files_mapped option;
5520         add map_whole_files.
5521         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5522         releasing the file.
5523         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5524         the file.
5525
5526 2010-03-10  David S. Miller  <davem@davemloft.net>
5527
5528         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5529
5530 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5531
5532         * icf.cc (get_section_contents): Add '@' marker after processing the
5533         merge reloc.
5534
5535 2010-03-08  Doug Kwan  <dougkwan@google.com>
5536
5537         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5538         due to a conversion warning.
5539         (Arm_relobj::update_output_local_symbol_count): Check for local
5540         symbol with unset output index.
5541
5542 2010-03-05  Ian Lance Taylor  <iant@google.com>
5543
5544         * options.h (class General_options): Add --spare-dynamic-tags.
5545         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5546         --spare-dynamic-tags.
5547
5548 2010-03-05  Ian Lance Taylor  <iant@google.com>
5549
5550         * incremental.cc: Include "libiberty.h".
5551
5552 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5553
5554         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5555         function, is_info_ member.
5556         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5557         (Versions::Versions): Update caller.
5558         (Versions::define_base_version): Likewise.
5559         (Versions::add_def): Likewise.
5560
5561 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5562
5563         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5564         (Scan::possible_function_pointer_reloc): New function.
5565         (Scan::local_reloc_may_be_function_pointer): Change to call
5566         possible_function_pointer_reloc.
5567         (Scan::global_reloc_may_be_function_pointer): Ditto.
5568         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5569         relocations in ".data.rel.ro._ZTV" section.
5570         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5571         * testsuite/icf_safe_so_test.cc: Ditto.
5572         * testsuite/icf_safe_test.cc: Ditto.
5573         * testsuite/icf_safe_test.sh: Ditto.
5574
5575 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5576             Ian Lance Taylor  <iant@google.com>
5577
5578         * target-reloc.h (relocate_section): Check the symbol table index
5579         for -1U before setting the local symbol index.
5580         (scan_relocatable_relocs): If copying the relocation, record that
5581         the local symbol is required.
5582         * object.h (Symbol_value::is_output_symtab_index_set): New
5583         function.
5584         (Symbol_value::may_be_discarded_from_output_symtab): New
5585         function.
5586         (Symbol_value::has_output_symtab_entry): New function.
5587         (Symbol_value::needs_output_symtab_entry): Remove.
5588         (Symbol_value::output_symtab_index): Make sure the symbol index is
5589         set.
5590         (Symbol_value::set_output_symtab_index): Make sure the symbol
5591         index is not set.  Make sure the new index is valid.
5592         (Symbol_value::set_must_have_output_symtab_entry): New function.
5593         (Symbol_value::has_output_dynsym_entry): New function.
5594         (Symbol_value::set_output_dynsym_index): Make sure the new index
5595         is valid.
5596         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5597         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5598         local symbol if permitted.
5599         (Sized_relobj::do_finalize_local_symbols): Call
5600         is_output_symtab_index_set rather than needs_output_symtab_entry.
5601         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5602         rather than needs_output_symtab_entry.  Call
5603         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5604         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5605         is_output_symtab_index_set rather than needs_output_symtab_entry.
5606         * testsuite/discard_locals_relocatable_test.c: New file.
5607         * testsuite/discard_locals_test.sh: Test -r.
5608         * testsuite/Makefile.am (check_DATA): Add
5609         discard_locals_relocatable_test1.syms,
5610         discard_local_relocatable_test2.syms.
5611         (MOSTLYCLEANFILES): Likewise.  Also add
5612         discard_locals_relocatable_test1.lout and
5613         discard_locals_relocatable_test2.out.
5614         (discard_locals_relocatable_test1.syms): New target.
5615         (discard_locals_relocatable_test.o): New target.
5616         (discard_locals_relocatable_test1.out): New target.
5617         (discard_locals_relocatable_test2.syms): New target.
5618         (discard_locals_relocatable_test2.out): New target.
5619         (various): Add missing ../ld-new dependencies.
5620         * testsuite/Makefile.in: Rebuild.
5621
5622 2010-03-03  Nick Clifton  <nickc@redhat.com>
5623
5624         * po/fi.po: New Finnish translation.
5625
5626 2010-03-01  Doug Kwan  <dougkwan@google.com>
5627
5628         * layout.cc (Layout::Layout): Force section types of .init_array*,
5629         .preinit_array* and .fini_array* sections.
5630         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5631         Fix check of return value of std::string::find.().
5632         (Output_section::Input_section_sort_compare::operator()): Remove
5633         comment about .init_array.
5634         (Output_section::Input_section_sort_init_fini_compare::operator()):
5635         New method.
5636         (Output_section::sort_attached_input_sections): Handle .init_array
5637         and .fini_array specially.
5638         * output.h (Output_section::Inut_section_sort_compare): Update
5639         comment.
5640         (Output_section::Input_section_sort_init_fini_compare): New struct.
5641
5642 2010-02-26  Doug Kwan  <dougkwan@google.com>
5643
5644         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5645         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5646         * testsuite/debug_msg.sh: Avoid matching source line number for
5647         use of global variable undef_int.
5648
5649 2010-02-26  Doug Kwan  <dougkwan@google.com>
5650
5651         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5652         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5653         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5654         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5655         * options.cc (General_options::General_options): Initialize member
5656         fix_v4bx_.
5657         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5658         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5659         and rm_no_fix_v4bx.stdout
5660         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5661         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5662         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5663         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5664         and arm_no_fix_v4bx.
5665         * Makefile.in: Regenerate.
5666         * testsuite/arm_fix_v4bx.s: New file.
5667         * testsuite/arm_fix_v4bx.sh: Ditto.
5668
5669 2010-02-24  Doug Kwan  <dougkwan@google.com>
5670
5671         * arm.cc (Target_arm::got_section): Make the .got section the first
5672         non RELRO section in the data segment.
5673         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5674         suffixes of section names.
5675
5676 2010-02-24  Doug Kwan  <dougkwan@google.com>
5677
5678         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5679         flags and attributes merging if an input file is a binary file.
5680         * fileread.cc (Input_file::open): Record format of original file.
5681         * fileread.h (Input_file::Format): New enum type.
5682         (Input_file::Input_file): Initialize data member format_.
5683         (Input_file::format): New method definition.
5684         (Input_file::format_):: New data member.
5685
5686 2010-02-24  Doug Kwan  <dougkwan@google.com>
5687
5688         * arm.cc (Arm_output_data_got): New class.
5689         (ARM_TCB_SIZE): New constant
5690         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5691         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5692         If user uses a script with a SECTIONS clause, issue only a warning
5693         for a misplaced EXIDX input section.  Otherwise, issue an error.
5694         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5695         garbage collection.
5696         (Target_arm::got_mode_index_entry): Handle static linking.
5697         (Target_arm::Scan::local): Ditto.
5698         (Target_arm::Scan::global): Ditto.
5699         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5700         all incorrectly implemented relocations.
5701         (Target_arm::fix_exidx_coverage): Pass layout to
5702         Arm_output_section::fix_exidx_coverage.
5703         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5704         from ".ARM.exidx." and ".ARM.extab.".
5705
5706 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5707
5708         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5709         section if it does not already exist.
5710         * attributes.cc (Attributes_section_data::Attributes_section_data):
5711         Don't crash if size is zero.
5712
5713 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5714             Ian Lance Taylor  <iant@google.com>
5715
5716         * gold.cc (queue_middle_tasks): If no input files were opened,
5717         exit.
5718         * workqueue.h (Task_function::Task_function): Assert that there is
5719         a blocker.
5720
5721 2010-02-22  Doug Kwan  <dougkwan@google.com>
5722
5723         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5724         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5725         types to avoid warnings due to different uint64_t implementations
5726         on different hosts.
5727
5728 2010-02-21  Doug Kwan  <dougkwan@google.com>
5729
5730         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5731         handling of the maximum backward branch offset.
5732         (Arm_relocate_functions::thumb_branch_common): Ditto.
5733         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5734         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5735         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5736         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5737         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5738         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5739         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5740         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5741         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5742         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5743         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5744         thumb2_bl_out_of_range.o): New rules.
5745         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5746         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5747         thumb2_bl_out_of_range
5748         * testsuite/Makefile.in: Regenerate.
5749         * testsuite/arm_bl_in_range.s: New file.
5750         * testsuite/arm_bl_out_of_range.s: Ditto.
5751         * testsuite/arm_branch_in_range.sh: Ditto.
5752         * testsuite/arm_branch_range.t: Ditto.
5753         * testsuite/thumb2_branch_range.t: Ditto.
5754         * testsuite/thumb_bl_in_range.s: Ditto.
5755         * testsuite/thumb_bl_out_of_range.s: Ditto.
5756         * testsuite/thumb_branch_range.t: Ditto.
5757
5758 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5759
5760         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5761         Add reloc offset information.
5762         * icf.cc (get_section_contents): Change iterators to point to the new
5763         vectors. Add reloc offset information to the contents.
5764         * icf.h (Icf::Sections_reachable_info): New typedef.
5765         (Icf::Sections_reachable_list): New typedef.
5766         (Icf::Offset_info): New typedef.
5767         (Icf::Reloc_info): New struct typedef.
5768         (Icf::Reloc_info_list): New typedef.
5769         (Icf::symbol_reloc_list): Delete method.
5770         (Icf::addend_reloc_list): Delete method.
5771         (Icf::section_reloc_list): Delete method.
5772         (Icf::reloc_info_list): New method.
5773         (Icf::reloc_info_list_): New member.
5774
5775 2010-02-19  Doug Kwan  <dougkwan@google.com>
5776
5777         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5778         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5779         * arm.cc (Arm_relocation_functions): New forward declaration.
5780         (Target_arm::Target_arm): Initialize new data members
5781         got_mod_index_offset_ and tls_base_symbol_defined_.
5782         (Target_arm::Relocate::relocate_tls): New method.
5783         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5784          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5785         New methods.
5786         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5787         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5788         (Target_arm::got_mod_index_offset_,
5789         Target_arm::tls_base_symbol_defined_): New data members.
5790         (Target_arm::Scan::local, Target::Scan::global,
5791         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5792         relocations.
5793
5794 2010-02-18  Doug Kwan  <dougkwan@google.com>
5795
5796         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5797         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5798         text section as a parameter becuase some broken tools may not set
5799         the link in section header.
5800         (Target_arm::has_got_section): New method.
5801         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5802         without any mapping symbol as data only.  Remove warning.
5803         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5804         link in its section header, try to discover the link by inspecting the
5805         REL31 relocation at the beginning of the section.
5806         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5807         in error message.
5808         (Target_arm::Scan::global): Treat any reference to the symbol
5809         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5810
5811 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5812
5813         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5814         (Scan::global_reloc_may_be_function_pointer): New function.
5815         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5816         (Scan::global_reloc_may_be_function_pointer): New function.
5817         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5818         (Scan::global_reloc_may_be_function_pointer): New function.
5819         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5820         (Scan::global_reloc_may_be_function_pointer): New function.
5821         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5822         (Scan::global_reloc_may_be_function_pointer): New function.
5823         (Scan::possible_function_pointer_reloc): New function.
5824         (Target_x86_64::can_check_for_function_pointers): New function.
5825         * gc.h (gc_process_relocs): Scan relocation types to determine if
5826         function pointers were taken for targets that support it.
5827         * icf.cc (Icf::find_identical_sections): Include functions for
5828         folding in safe ICF whose pointer is not taken.
5829         * icf.h (Secn_fptr_taken_set): New typedef.
5830         (fptr_section_id_): New member.
5831         (section_has_function_pointers): New function.
5832         (set_section_has_function_pointers): New function.
5833         (check_section_for_function_pointers): New function.
5834         * options.h: Fix comment for safe ICF option.
5835         * target.h (can_check_for_function_pointers): New function.
5836         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5837         Modify icf_safe_test for X86-64.
5838         * testsuite/Makefile.in: Regenerate.
5839         * testsuite/icf_safe_so_test.cc: New file.
5840         * testsuite/icf_safe_so_test.sh: New file.
5841         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5842         (main): Change to take pointer to function kept_func_3.
5843         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5844         folding is done correctly for X86-64.
5845
5846 2010-02-12  David S. Miller  <davem@davemloft.net>
5847
5848         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5849         is_symbolless parameter.
5850         (Output_reloc<SHT_REL>::is_symbolless): New.
5851         (Output_reloc<SHT_REL>::is_symbolless_): New.
5852         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5853         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5854         (Output_reloc<SHT_RELA>::is_symbolless): New.
5855         (Output_data_reloc::add_global): Handle is_symbolless.
5856         (Output_data_reloc::add_global_relative): Likewise.
5857         (Output_data_reloc::add_local): Likewise.
5858         (Output_data_reloc::add_local_relative): Likewise.
5859         (Output_data_reloc::add_symbolless_global_addend): New.
5860         (Output_data_reloc::add_symbolless_local_addend): New.
5861         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5862         is_symbolless.
5863         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5864         instead of ->is_relative_
5865         (Output_reloc::write): Likewise.
5866         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5867         (Output_reloc::write_rel): Simplify.
5868
5869         * sparc.cc (Target_sparc::Scan::local): Use
5870         ->add_symbolless_local_addend as needed.
5871         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5872         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5873         based upon relocation offset.
5874
5875 2010-02-11  Doug Kwan  <dougkwan@google.com>
5876
5877         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5878         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5879         beginning of function.
5880         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5881         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5882         parameter is_32bit in calls to should_apply_static_reloc.
5883         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5884         (check_DATA): Add arm_abs_global.stdout.
5885         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5886         arm_abs_global.stdout): New rules.
5887         (MOSTLLYCLEANFILES): Add arm_abs_global
5888         * Makefile.in: Regenerate.
5889         * testsuite/arm_abs_global.s: New file.
5890         * testsuite/arm_abs_global.sh: Ditto.
5891         * testsuite/arm_abs_lib.s: Ditto.
5892
5893 2010-02-11  Ian Lance Taylor  <iant@google.com>
5894
5895         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5896         Read_relocs task.
5897         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5898         Allocate_commons_task first.
5899         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5900         task, rather than symtab_lock_.
5901         (Gc_process_relocs::~Gc_process_relocs): New function.
5902         (Gc_process_relocs::is_runnable): Check this_blocker_.
5903         (Gc_process_relocs::locks): Use next_blocker_ rather than
5904         blocker_.
5905         (Scan_relocs::~Scan_relocs): New function.
5906         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5907         symtab_lock_.
5908         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5909         next_blocker_.
5910         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5911         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5912         constructor accordingly.
5913         (class Gc_process_relocs): Likewise.
5914         (class Scan_relocs): Likewise.
5915         * common.h (class Allocate_commons_task): Remove symtab_lock_
5916         field, and corresponding constructor parameter.
5917         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5918         symtab_lock_.
5919         (Allocate_commons_task::locks): Likewise.
5920
5921 2010-02-11  Ian Lance Taylor  <iant@google.com>
5922
5923         * gold-threads.h (class Once): Define.
5924         (class Initialize_lock): Rewrite as child of Once.
5925         * gold-threads.cc (class Once_initialize): Define.
5926         (once_pointer_control): New static variable.
5927         (once_pointer, once_arg): New static variables.
5928         (c_run_once): New static function.
5929         (Once::Once, Once::run_once, Once::internal_run): New functions.
5930         (class Initialize_lock_once): Remove.
5931         (initialize_lock_control): Remove.
5932         (initialize_lock_pointer): Remove.
5933         (initialize_lock_once): Remove.
5934         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5935         (Initialize_lock::initialize): Rewrite.
5936         (Initialize_lock::do_run_once): New function.
5937         * archive.cc (Archive::interpret_header): Only clear name if it is
5938         not already empty.
5939         * fileread.cc: Include "gold-threads.h"
5940         (file_counts_lock): New static variable.
5941         (file_counts_initialize_lock): Likewise.
5942         (File_read::release): Only increment counts when using --stats.
5943         Use a lock around the increment.
5944         * parameters.cc (class Set_parameters_target_once): Define.
5945         (set_parameters_target_once): New static variable.
5946         (Parameters::Parameters): Move here from parameters.h.
5947         (Parameters::set_target): Rewrite.
5948         (Parameters::set_target_once): New function.
5949         (Parameters::clear_target): Move here and rewrite.
5950         * parameters.h (class Parameters): Update declarations.  Add
5951         set_parameters_target_once_ field.
5952         (Parameters::Parameters): Move to parameters.cc.
5953         (Parameters::clear_target): Likewise.
5954         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5955         task.
5956         (Start_group::~Start_group): New function.
5957         (Start_group::is_runnable): New function.
5958         (Start_group::locks, Start_group::run): New functions.
5959         (Finish_group::run): Change saw_undefined to size_t.
5960         * readsyms.h (class Start_group): Define.
5961         (class Finish_group): Change saw_undefined_ field to size_t.
5962         (Finish_group::Finish_group): Remove saw_undefined and
5963         this_blocker parameters.  Change all callers.
5964         (Finish_group::set_saw_undefined): New function.
5965         (Finish_group::set_blocker): New function.
5966         * symtab.h (class Symbol_table): Change saw_undefined to return
5967         size_t.  Change saw_undefined_ field to size_t.
5968         * target-select.cc (Set_target_once::do_run_once): New function.
5969         (Target_selector::Target_selector): Initialize set_target_once_
5970         field.  Don't initialize lock_ and initialize_lock_ fields.
5971         (Target_selector::instantiate_target): Rewrite.
5972         (Target_selector::set_target): New function.
5973         * target-select.h (class Set_target_once): Define.
5974         (class Target_selector): Update declarations.  Make
5975         Set_target_once a friend.  Remove lock_ and initialize_lock_
5976         fields.  Add set_target_once_ field.
5977
5978 2010-02-10  Ian Lance Taylor  <iant@google.com>
5979
5980         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5981         queueing any tasks.
5982         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5983         (queue_middle_tasks): Add all blockers before queueing any tasks.
5984         (queue_final_tasks): Likewise.
5985         * token.h (Task_token::add_blockers): New function.
5986         * object.h (Input_objects::number_of_relobjs): New function.
5987
5988 2010-02-10  Ian Lance Taylor  <iant@google.com>
5989
5990         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5991         shared, not if not position independent.
5992         * x86_64.cc (Relocate::relocate_tls): Likewise.
5993         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5994         (tls_pie_pic_test): New target.
5995         * testsuite/Makefile.in: Rebuild.
5996
5997         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5998         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5999         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6000         * testsuite/Makefile.in: Rebuild.
6001
6002 2010-02-09  David S. Miller  <davem@davemloft.net>
6003
6004         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6005         R_SPARC_RELATIVE using ->add_local_relative().
6006         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6007
6008         * output.h (Output_data_dynamic::add_section_size): New method
6009         that takes two Output_data objects.
6010         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6011         entry param.  Handle it in initializers.
6012         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6013         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6014         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6015         arg.
6016         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6017         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6018         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6019         for dynrel_includes_plt.
6020         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6021         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6022         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6023         before .rela.plt
6024         (Target_sparc::do_finalize_sections): Update to pass true for
6025         dynrel_includes_plt.
6026         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6027         output before .rela.plt
6028         (Target_powerpc::do_finalize_sections): Update to pass true for
6029         dynrel_includes_plt when 32-bit.
6030
6031 2010-02-08  Doug Kwan  <dougkwan@google.com>
6032
6033         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6034         method.
6035         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6036         Arm_relobj::scan_section_for_cortex_a8_stubs,
6037         Arm_relobj::do_relocation_section): Instead of calling
6038         Output_section::output_address, use faster
6039         Arm_relobj::simple_input_section_output_address.
6040
6041 2010-02-08  David S. Miller  <davem@davemloft.net>
6042
6043         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6044         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6045         relocation helper function.
6046
6047         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6048         just like R_SPARC_GOT{10,13,22}.
6049         (Target_sparc::Scan::local): Likewise.
6050         (Target_sparc::Relocate:relocate): Likewise.
6051
6052 2010-02-06  Ian Lance Taylor  <iant@google.com>
6053
6054         * configure.ac: Rewrite targetobjs duplicate removal code to use
6055         only shell constructs.
6056         * configure: Rebuild.
6057
6058 2010-02-05  Doug Kwan  <dougkwan@google.com>
6059
6060         PR 11247
6061         * arm.cc (Arm_relobj::section_is_scannable): New method.
6062         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6063         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6064
6065 2010-02-04  Doug Kwan  <dougkwan@google.com>
6066
6067         PR 11247
6068         * arm-reloc-property.cc (cstdio): Include.
6069         * configure.ac (targetobjs): Remove duplicates.
6070         * configure: Regenerate.
6071         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6072         big and little endian version for a given address size.
6073
6074 2010-02-03  Doug Kwan  <dougkwan@google.com>
6075
6076         * arm-reloc-property.cc
6077         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6078         definition.
6079         * arm-reloc-property.h
6080         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6081         New method definition.
6082         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6083         declaration.
6084         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6085         overflow to N.
6086         (GOT_PREL): Change implemented to Y.
6087         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6088         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6089         (Arm_relocate_functions::movw_abs_nc): Remove method.
6090         (Arm_relocate_functions::movt_abs): Ditto.
6091         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6092         (Arm_relocate_functions::thm_movt_abs): Ditto.
6093         (Arm_relocate_functions::movw_rel_nc): Ditto.
6094         (Arm_relocate_functions::movw_rel): Ditto.
6095         (Arm_relocate_functions::movt_rel): Ditto.
6096         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6097         (Arm_relocate_functions:thm_movw_rel): Ditto.
6098         (Arm_relocate_functions:thm_movt_rel): Ditto.
6099         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6100         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6101         New method definitions.
6102         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6103         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6104         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6105         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6106         (Target_arm::Relocate::relocate): Check for non-static or
6107         unimplemented relocation code and exit early.  Change calls to
6108         Target_arm::reloc_uses_thumb_bit and
6109         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6110         instead.  Refactor code to handle similar relocations to increase
6111         code sharing.  Remove check for unsupported relocation code in switch
6112         statement.
6113         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6114         relocation property table to find out size.  Change error message to
6115         print out the name of a relocation code instead of the numeric value.
6116         (Target_arm::scan_reloc_for_stub): Use relocation property table
6117         instead of calling Target_arm::reloc_uses_thumb_bit().
6118
6119 2010-02-02  Doug Kwan  <dougkwan@google.com>
6120
6121         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6122         types of relaxed input section.
6123
6124 2010-02-02  Doug Kwan  <dougkwan@google.com>
6125
6126         * Makefile.am (HFILES): Add arm-reloc-property.h.
6127         (DEFFILES): New.
6128         (TARGETSOURCES): Add arm-reloc-property.cc
6129         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6130         (libgold_a_SOURCES): $(DEFFILES)
6131         * Makefile.in: Regenerate.
6132         * arm-reloc-property.cc: New file.
6133         * arm-reloc-property.h: New file.
6134         * arm-reloc.def: New file.
6135         * arm.cc: Update comments.
6136         (arm-reloc-property.h): New included header.
6137         (arm_reloc_property_table): New global variable.
6138         (Target_arm::do_select_as_default_target): New method definition.
6139         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6140         arm-reloc-property to targ_extra_obj.
6141         * parameters.cc (set_parameters_target): Call
6142         Target::select_as_default_target().
6143         * target.h (Target::select_as_default_target): New method definition.
6144         (Target::do_select_as_default_target): Same.
6145
6146 2010-02-01  Doug Kwan  <dougkwan@google.com>
6147
6148         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6149         first_output_text_section_.
6150         (Arm_exidx_fixup::first_output_text_section): New method definition.
6151         (Arm_exidx_fixup::first_output_text_section_): New data member.
6152         (Arm_exidx_fixup::process_exidx_section): Record the first text
6153         output section seen.
6154         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6155         and entsize in output section header.
6156
6157 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6158
6159         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6160         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6161         (Arm_relocate_functions::thm_alu11): New Method.
6162         (Arm_relocate_functions::thm_pc8): New Method.
6163         (Arm_relocate_functions::thm_pc12): New Method.
6164         (Target_arm::Scan::local): Handle the relocations.
6165         (Target_arm::Scan::global): Likewise.
6166         (Target_arm::Relocate::relocate): Likewise.
6167         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6168
6169 2010-01-29  Doug Kwan  <dougkwan@google.com>
6170
6171         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6172         of relocation types as ld.
6173
6174 2010-01-29  Doug Kwan  <dougkwan@google.com>
6175
6176         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6177         to public.
6178         (Arm_relocate_functions::thumb_branch_common): Ditto.
6179         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6180         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6181         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6182         Arm_relocate_functions::jump24): Remove.
6183         (Target_arm::Relocate::relocate): Adjust code to call
6184         Arm_relocation_functions::arm_branch_common and
6185         Arm_relocation_functions::thumb_branch_common instead of their removed
6186         wrappers.  Merge switch-cases together to reduce source code size.
6187
6188 2010-01-29  Doug Kwan  <dougkwan@google.com>
6189
6190         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6191         output_local_symbol_count_needs_update_.
6192         (Arm_relobj::output_local_symbol_count_needs_update,
6193          Arm_relobj::set_output_local_symbol_count_needs_update,
6194          Arm_relobj::update_output_local_symbol_count): New methods.
6195         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6196         member.
6197         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6198         of pointed function as in a R_ARM_PREL31 relocation.
6199         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6200         for output local symbol count updating.
6201         (Target_arm::do_relax): Update output local symbol counts in objects
6202         if necessary.
6203         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6204
6205 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6206
6207         * arm.cc: Added support for the ARM relocations:
6208         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6209         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6210         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6211         movw_prel_nc).
6212         (Arm_relocate_functions::movw_rel): New method.
6213         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6214         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6215         thm_movw_prel_nc).
6216         (Arm_relocate_functions::thm_movw_rel): New method.
6217         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6218         thm_movt_prel).
6219         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6220         relocations.
6221         (Target_arm::Scan::global): Likewise.
6222         (Target_arm::Relocate::relocate): Likewise.
6223         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6224         Likewise.
6225
6226 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6227
6228         * arm.cc: Added support for ARM group relocations.
6229         (Target_arm::reloc_needs_sym_origin): New method.
6230         (Arm_relocate_functions::calc_grp_kn): New method.
6231         (Arm_relocate_functions::calc_grp_residual): New method.
6232         (Arm_relocate_functions::calc_grp_gn): New method.
6233         (Arm_relocate_functions::arm_grp_alu): New Method.
6234         (Arm_relocate_functions::arm_grp_ldr): New Method.
6235         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6236         (Arm_relocate_functions::arm_grp_ldc): New Method.
6237         (Target_arm::Scan::local): Handle the ARM group relocations.
6238         (Target_arm::Scan::global): Likewise.
6239         (Target_arm::Relocate::relocate): Likewise.
6240         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6241         Likewise.
6242
6243 2010-01-26  Doug Kwan  <dougkwan@google.com>
6244
6245         * arm.cc (set): Include.
6246         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6247         pointer type.
6248         (Arm_output_section::Text_section_list): New type.
6249         (Arm_output_section::append_text_sections_to_list): New method.
6250         (Arm_output_section::fix_exidx_coverage): Ditto.
6251         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6252         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6253         Relobj::set_section_offset() instead of
6254         Sized_relobj::invalidate_section_offset().
6255         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6256         parameter for section headers. Ignore relocation sections for
6257         unallocated sections and EXIDX sections.
6258         (Target_arm::fix_exidx_coverage): New method.
6259         (Target_arm::output_section_address_less_than): New type.
6260         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6261         linked text section instead of the EXIDX section.
6262         (Arm_output_section::create_stub_group): Add an assertion to check
6263         that this is not an EXIDX output section.
6264         (Arm_output_section::append_text_sections_to_list): New method.
6265         (Arm_output_section::fix_exidx_coverage): Ditto.
6266         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6267         Arm_relobj::section_needs_reloc_stub_scanning.
6268         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6269         first pass.
6270         (Target_arm::fix_exidx_coverage): New method.
6271         * object.h (Relobj::set_output_section): New method.
6272         (Sized_relobj::invalidate_section_offset): Remove method.
6273         (Sized_relobj::do_invalidate_section_offset): Remove method.
6274         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6275
6276 2010-01-25  Doug Kwan  <dougkwan@google.com>
6277
6278         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6279         Fix warning due to signed and unsigned comparison on a 32-bit host.
6280
6281 2010-01-22  Doug Kwan  <dougkwan@google.com>
6282
6283         * arm.cc (Target_arm::do_relax): Record an output section for section
6284         offset adjustment it contains any stub table that has changed.
6285         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6286         offsets in an output section if necessary.
6287         * output.cc (Output_section::Output_section): Initialize
6288         section_offsets_need_adjustments_.
6289         (Output_section::add_input_section_for_script): Renamed to
6290         Output_section::add_simple_input_section.
6291         (Output_section::save_states): Add a comment.
6292         (Output_section::discard_states): New method defintion.
6293         (Output_section::adjust_section_offsets): Same.
6294         * output.h (Output_section::add_input_section_for_script): Renamed to
6295         Output_section::add_simple_input_section.
6296         (Output_section::discard_states): New method declaration.
6297         (Output_section::adjust_section_offsets): Same.
6298         (Output_section::section_offsets_need_adjustment,
6299         Output_section::set_section_offsets_need_adjustment): New method
6300         definitions.
6301         (Output_section::section_offsets_need_adjustment_): New data member.
6302         * script-sections.cc
6303         (Output_section_element_input::set_section_address): Adjust code for
6304         renaming of Output_section::add_input_section_for_script.
6305         (Orphan_output_section::set_section_address): Same.
6306
6307 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6308
6309         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6310         Fix_v4bx enum values .
6311         * gold/options.h (General_options): New option definitions.
6312         (General_options::fix_v4bx): New method.
6313         (General_options::Fix_v4bx): New enum.
6314         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6315         (General_options::parse_fix_v4bx_interworking): New method.
6316
6317 2010-01-22  Doug Kwan  <dougkwan@google.com>
6318
6319         * arm.cc (Arm_exidx_fixup): New class.
6320
6321 2010-01-21  Doug Kwan  <dougkwan@google.com>
6322
6323         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6324         classes.
6325         (Arm_exidx_section_offset_map): New type.
6326
6327 2010-01-21  Doug Kwan  <dougkwan@google.com>
6328
6329         * arm.cc (Arm_exidx_input_section): New class.
6330         (Arm_relobj::exidx_input_section_by_link,
6331         Arm_relobj::exidx_input_section_by_shndx,
6332         Arm_relobj::make_exidx_input_section): New methods.
6333         (read_arm_attributes_section): Remove.
6334         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6335         information about them.
6336         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6337         to here.
6338
6339 2010-01-20  Doug Kwan  <dougkwan@google.com>
6340
6341         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6342         Input_section_specifier to Section_id.
6343         (Target_arm::new_arm_input_section: Adjust code for change of key
6344         type.
6345         (Target_arm::find_arm_input_section): Ditto.
6346         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6347         (Section_id): Remove.
6348         (Garbage_collection::Section_id_hash): Remove.
6349         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6350         (Section_id): Remove.
6351         (Icf::Section_id_hash): Remove.
6352         * object.h (Section_id, Const_section_id, Section_id_hash,
6353         Const_section_id_hash): New type definitions.
6354         * output.cc (Output_section::add_relaxed_input_section): Change to
6355         use Const_section_id instead of Input_section_specifier as key type.
6356         (Output_section::add_merge_input_section): Ditto.
6357         (Output_section::build_relaxation_map): Change to use Section_id
6358         instead of Input_section_specifier as key type.
6359         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6360         Ditto.
6361         (Output_section::convert_input_sections_to_relaxed_sections): Change
6362         to use Const_section_id instead of Input_section_specifier as key type.
6363         (Output_section::find_merge_section): Ditto.
6364         (Output_section::find_relaxed_input_section): Ditto.
6365         * output.h (Input_section_specifier): Remove class.
6366         (Output_section::Output_section_data_by_input_section_map): Change
6367         key type to Const_section_id.
6368         (Output_section::Output_relaxed_input_section_by_input_section_map):
6369         Ditto.
6370         (Output_section::Relaxation_map): Change key type to Section_id.
6371
6372 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6373
6374         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6375         (class Arm_v4bx_stub): New class.
6376         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6377         (Stub_factory::make_arm_v4bx_stub): New method.
6378         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6379         (Stub_table::empty): Handle v4bx stubs.
6380         (Stub_table::add_arm_v4bx_stub): New method.
6381         (Stub_table::find_arm_v4bx_stub): New method.
6382         (Arm_relocate_functions::v4bx): New method.
6383         (Target_arm::fix_v4bx): New method.
6384         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6385         (Stub_table::relocate_stubs): Likewise.
6386         (Stub_table::do_write): Likewise.
6387         (Stub_table::update_data_size_and_addralign): Likewise.
6388         (Stub_table::finalize_stubs):  Likewise.
6389         (Target_arm::Scan::local): Likewise.
6390         (Target_arm::Scan::global): Likewise.
6391         (Target_arm::do_finalize_sections): Likewise.
6392         (Target_arm::Relocate::relocate): Likewise.
6393         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6394         Likewise.
6395         (Target_arm::scan_reloc_for_stub): Likewise.
6396         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6397
6398 2010-01-19  Ian Lance Taylor  <iant@google.com>
6399
6400         * output.cc (Output_section_headers::do_sized_write): Write large
6401         segment count to sh_info field.
6402         (Output_file_header::do_sized_write): For large segment count,
6403         write PN_XNUM to e_phnum field.
6404
6405 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6406
6407         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6408         (Arm_relocate_functions::thm_jump8): New function.
6409         (Arm_relocate_functions::thm_jump11): New function.
6410         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6411         R_ARM_THM_JUMP11.
6412         (Target_arm::Scan::global): Likewise.
6413         (Target_arm::Relocate::relocate): Likewise.
6414         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6415         Likewise.
6416
6417 2010-01-14  Doug Kwan  <dougkwan@google.com>
6418
6419         * arm.cc (map, utility): Include headers.
6420         (Target_arm::apply_cortex_a8_workaround): New method.
6421         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6422         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6423         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6424         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6425         the --[no-]fix-cortex-a8 command line options.
6426         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6427         (Target_arm::relocate_stub): Use addend in instruction template.
6428         * options.h (DEFINE_bool): Set the user-set flag.
6429         (General_options): Add --[no-]-fix-cortex options.
6430         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6431         : Update fast look-up map after conversion.
6432
6433 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6434
6435         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6436         in the first pass of do_layout.
6437
6438 2010-01-13  Doug Kwan  <dougkwan@google.com>
6439
6440         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6441         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6442         apparent compiler problem of not folding static constant integral
6443         data members of elfcpp::Elf_sizes<32>.
6444
6445 2010-01-13  Doug Kwan  <dougkwan@google.com>
6446
6447         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6448         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6449         Arm_relobj::scan_section_for_cortex_a8_erratum,
6450         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6451         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6452         sections to scan for relocation stubs into a new method
6453         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6454         relocation and Cortex-A8 stub scanning.
6455         (Target_arm::do_relax): Force stubs to be after stubbed sections
6456         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6457         the beginning of a new relaxation pass.  Update a comment.
6458         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6459
6460 2010-01-12  Ian Lance Taylor  <iant@google.com>
6461
6462         * target-reloc.h (visibility_error): New inline function.
6463         (relocate_section): Call visibility_error.
6464         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6465         (MOSTLYCLEANFILES): Likewise.
6466         (protected_4_pic.o, protected_3.err): New targets.
6467         * testsuite/protected_4.cc: New file.
6468
6469 2010-01-12  Doug Kwan  <dougkwan@google.com>
6470
6471         * arm.cc (Cortex_a8_reloc): New class.
6472         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6473         and cortex_a8_relocs_info_.
6474         (Target_arm::fix_cortex_a8): New method definition.
6475         (Target_arm::Cortex_a8_relocs_info): New type.
6476         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6477         New data member declarations.
6478         (Target_arm::scan_reloc_for_stub): Record information about
6479         relocations for THUMB branches that might be exempted from the
6480         Cortex-A8 workaround.
6481         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6482         at the beginning of a relaxation pass.
6483
6484 2010-01-12  Doug Kwan  <dougkwan@google.com>
6485
6486         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6487         (Arm_relobj::Mapping_symbol_position,
6488          Arm_reloj::Mapping_symbol_position_less,
6489          Arm_relobj::Mapping_symbols_info): New types.
6490         (Target_arm::is_mapping_symbol_name): New method definition.
6491         (Arm_relobj::do_count_local_symbols): Save information about mapping
6492         symbols.
6493
6494 2010-01-11  Doug Kwan  <dougkwan@google.com>
6495
6496         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6497         Arm_relocate_functions::thumb32_branch_upper,
6498         Arm_relocate_functions::thumb32_branch_lower,
6499         Arm_relocate_functions::thumb32_cond_branch_offset,
6500         Arm_relocate_functions::thumb32_cond_branch_upper,
6501         Arm_relocate_functions::thumb32_cond_branch_lower,
6502         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6503         branch offset encoding.
6504         (Arm_relocate_functions::thumb_branch_common): Use new branch
6505         offset encoding methods to avoid code duplication.
6506         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6507         (Stub_addend_reader::operator()): Use new branch encoding method
6508         to avoid code duplication.
6509
6510 2010-01-11  Doug Kwan  <dougkwan@google.com>
6511
6512         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6513         (Target_arm::do_finalize_sections): Define special EXIDX section
6514         symbols only if referenced.
6515         * gc.h (Garbage_collection::add_reference): New method.
6516         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6517         code duplication.
6518
6519 2010-01-11  Ian Lance Taylor  <iant@google.com>
6520
6521         * script.cc (Version_script_info::build_expression_list_lookup):
6522         Change complaing about duplicate wildcard match from error to
6523         warning.
6524
6525         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6526         of 2009-12-30.
6527         (Version_script_info::Version_script_info): Initialize globs_,
6528         default_version_, default_is_global_, and exact_.  Don't
6529         initialize globals_ or locals_.
6530         (Version_script_info::build_lookup_tables): Build local symbols
6531         first.
6532         (Version_script_info::unquote): New function.
6533         (Version_script_info::add_exact_match): New function.
6534         (Version_script_info::build_expression_list_lookup): Remove lookup
6535         parameter.  Add is_global parameter.  Change all callers.  Handle
6536         wildcard pattern specially.  Unquote pattern.  Call
6537         add_exact_match.
6538         (Version_script_info::get_name_to_match): New function.
6539         (Version_script_info::get_symbol_version): New function.
6540         (Version_script_info::get_symbol_version_helper): Remove.
6541         (Version_script_info::check_unmatched_names): Call unquote.
6542         * script.h (class Version_script_info): Change get_symbol_version
6543         to be non-inline and add is_global parameter; change all callers.
6544         Rewrite symbol_is_local.  Update declarations.  Define struct
6545         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6546         Remove globals_ and locals_ members.  Add exact_, globs_,
6547         default_version_, is_global_.
6548         (Version_script_info::Glob): Remove pattern, add expression and
6549         is_global.  Update constructor.  Change all callers.
6550         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6551         default version.
6552         (Versions::symbol_section_contents): If a symbol is undefined, or
6553         defined in a dynamic object, set the version index to
6554         VER_NDX_LOCAL.
6555         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6556         symbol_is_local.
6557         (Symbol_table::add_from_pluginobj): Likewise.
6558         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6559
6560 2010-01-11  Doug Kwan  <dougkwan@google.com>
6561
6562         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6563         (incremental_dump_LDADD): Add linking option for libintl.
6564         * Makefile.in: Regenerate.
6565
6566 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6567
6568         PR gold/11144
6569         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6570         instead of -Ds.
6571         * testsuite/Makefile.in: Regenerated.
6572
6573 2010-01-10  Doug Kwan  <dougkwan@google.com>
6574
6575         * options.h (DEFINE_var): Use parentheses around argument varname__
6576         in macro body to avoid any unintended subsequent substitutions.
6577
6578 2010-01-10  Ian Lance Taylor  <iant@google.com>
6579
6580         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6581         candidates before doing symbol resolution.
6582
6583         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6584         ODR candidates if only one is weak.
6585
6586 2010-01-08  Ian Lance Taylor  <iant@google.com>
6587
6588         * script.cc (Version_script_info::build_expression_list_lookup):
6589         Don't warn about ambiguous version, just record the ambiguity.
6590         (Version_script_info::get_symbol_version_helper): Give error if
6591         version is ambiguous.
6592
6593 2010-01-08  Doug Kwan  <dougkwan@google.com>
6594
6595         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6596           prev_data_size_ and prev_addralign_.  Remove initializer for
6597           deleted data member has_been_changed_.
6598           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6599           to determine if the table is empty.
6600           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6601           Remove.
6602           (Stub_table::add_reloc_stub): Define method in class definition
6603           instead of just declaring it there.
6604           (Stub_table::add_cortex_a8_stub): New method definition.
6605           (Stub_table::update_data_size_and_addralign): Ditto.
6606           (Stub_table::finalize_stubs): Ditto.
6607           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6608           (Stub_table::do_addralign_): Return address alignment in the
6609           (Stub_table::do_reset_address_and_file_offset): Define method in
6610           class definition instead of declaring it there.  Set current data
6611           size to be the data size of the previous pass.
6612           (Stub_table::set_final_data_size): Use current data size as the
6613           final data size.
6614           (Stub_table::relocate_stub): Change parameter type of stub from
6615           Reloc_stub pointer to Stub pointer.
6616           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6617           (Stub_table::Cortex_a8_stub_list): New typedef.
6618           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6619            Stub_table::prev_addralign_): New data member.
6620           (Arm_relobj::Arm_relobj): Initialize data member
6621           section_has_cortex_a8_workaround_.
6622           (Arm_relobj::section_has_cortex_a8_workaround,
6623            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6624            definitions.
6625           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6626           declarations.
6627           (Target_arm::relocate_stub): Change parameter type of stub from
6628           Reloc_stub pointer to Stub pointer.
6629           (Insn_template::size, Insn_template::alignment): Handle
6630           THUMB16_SPECIAL_TYPE.
6631           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6632            Stub_table::update_data_size_and_addralign,
6633            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6634           definitions.
6635           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6636           (Stub_table::do_write): Ditto.
6637           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6638
6639 2010-01-08  Ian Lance Taylor  <iant@google.com>
6640
6641         PR 11108
6642         * symtab.h (class Symbol): Remove fields is_target_special_ and
6643         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6644         (Symbol::is_defined_in_discarded_section): New function.
6645         (Symbol::set_is_defined_in_discarded_section): New function.
6646         (Symbol::has_plt_offset): Rewrite.
6647         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6648         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6649         Don't initialize is_target_special_ or has_plt_offset_.
6650         Initialize is_defined_in_discarded_section_.
6651         (Symbol_table::add_from_relobj): If appropriate, set
6652         is_defined_in_discarded_section.
6653         * resolve.cc (Symbol::override_base_with_special): Don't test
6654         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6655         * target-reloc.h (relocate_section): Do special handling for
6656         symbols defined in discarded sections for global symbols as well
6657         as local symbols.
6658
6659 2010-01-08  Ian Lance Taylor  <iant@google.com>
6660
6661         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6662         the SHT_SYMTAB case.
6663
6664 2010-01-08  Ian Lance Taylor  <iant@google.com>
6665
6666         * object.cc (Sized_relobj::do_layout): Don't get confused if
6667         layout_eh_frame returns NULL.
6668
6669 2010-01-08  Ian Lance Taylor  <iant@google.com>
6670
6671         PR 11084
6672         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6673         dynamic symbol table, use the normal symbol table.
6674         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6675         symbol table.
6676
6677 2010-01-08  Ian Lance Taylor  <iant@google.com>
6678
6679         PR 11072
6680         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6681         sections.
6682
6683 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6684
6685         * version.cc (print_version): Change to "Copyright 2010".
6686
6687 2010-01-08  Ian Lance Taylor  <iant@google.com>
6688
6689         PR 10287
6690         PR 11063
6691         * i386.cc (class Target_i386): Change return type of plt_section
6692         to be non-const.
6693         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6694         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6695         tls_desc_rel_ field.
6696         (Output_data_plt_i386::rel_tls_desc): New function.
6697         (Target_i386::rel_tls_desc_section): New function.
6698         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6699         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6700         R_386_TLS_DESC reloc in rel_tls_desc_section.
6701         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6702         Define struct Tlsdesc_info.
6703         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6704         (Target_x86_64::do_reloc_symbol_index): New function.
6705         (Target_x86_64::add_tlsdesc_info): New function.
6706         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6707         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6708         tlsdesc_rel_ field.
6709         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6710         all callers.
6711         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6712         (Target_x86_64::rela_tlsdesc_section): New function.
6713         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6714         handling.
6715         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6716         (Target_x86_64::do_reloc_addend): New function.
6717         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6718         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6719         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6720         (Output_reloc::type): New function.
6721         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6722         (Output_reloc::is_target_specific): New function.
6723         (Output_reloc::target_arg): New function.
6724         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6725         absolute relocs and target specific relocs.
6726         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6727         add_target_specific.
6728         (class Output_data_reloc) [SHT_RELA]: Likewise.
6729         * output.cc (Output_reloc::Output_reloc): Add four new versions
6730         for absolute relocs and target specific relocs.
6731         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6732         (Output_reloc::get_symbol_index): Likewise.
6733         (Output_reloc::local_section_offset): Check that local_sym_index_
6734         is not TARGET_CODE or 0.
6735         (Output_reloc::symbol_value): Likewise.
6736         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6737         reloc.
6738         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6739         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6740         functions.
6741         * layout.cc (add_target_dynamic_tags): Use output section for
6742         DT_PLTRELSZ and DT_JMPREL.
6743
6744 2010-01-07  Ian Lance Taylor  <iant@google.com>
6745
6746         PR 11061
6747         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6748         function.
6749         (class Output_data_reloc_generic): Define.
6750         (class Output_data_reloc_base): Change base class to
6751         Output_data_reloc_generic.  Change add() method to call
6752         bump_relative_reloc_count for a relative reloc.  Remove
6753         sort_relocs_ field.
6754         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6755         to sort_relocs().
6756         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6757         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6758         appropriate.
6759         * layout.h (class Layout): Update declaration.
6760
6761 2010-01-07  Ian Lance Taylor  <iant@google.com>
6762
6763         * output.h (class Output_data): Add const version of
6764         output_section and do_output_section.
6765         (class Output_section_data): Add const version of
6766         do_output_section.
6767         (class Output_section): Likewise.
6768         * layout.cc (Layout::add_target_dynamic_tags): New function.
6769         * layout.h (class Layout): Update declarations.
6770         * arm.cc (Target_arm::do_finalize_sections): Use
6771         add_target_dynamic_tags.
6772         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6773         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6774         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6775         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6776
6777 2010-01-07  Ian Lance Taylor  <iant@google.com>
6778
6779         PR 11042
6780         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6781         object as needed.
6782
6783 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6784             Ian Lance Taylor  <iant@google.com>
6785
6786         PR 11019
6787         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6788         Xindex::read_symtab_xindex.
6789
6790 2010-01-07  Doug Kwan  <dougkwan@google.com>
6791
6792         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6793         (Insn_template::thumb16_bcond_insn): New method declaration.
6794         (Insn_template): Fix spelling.
6795         (Stub::thumb16_special): New method declaration.
6796         (Stub::do_write): Define virtual method which was previously pure
6797         virtual.
6798         (Stub::do_thumb16_special): New method declaration.
6799         (Stub::do_fixed_endian_write): New template member.
6800         (Reloc_stub::do_write): Remove.
6801         (Reloc_stub::do_fixed_endian_write): Remove.
6802         (Cortex_a8_stub): New class definition.
6803         (Stub_factory::make_cortex_a8_stub): New method definition.
6804         (Stub_factory::Stub_factory): Add missing static storage class
6805         qualifier for elf32_arm_stub_a8_veneer_blx.
6806
6807 2010-01-07  Ian Lance Taylor  <iant@google.com>
6808
6809         PR 10980
6810         * options.h (class General_options): Add --warn-unresolved-symbols
6811         and --error-unresolved-symbols.
6812         * errors.cc (Errors::undefined_symbol): Implement
6813         --warn-unresolved-symbols.
6814
6815         * options.h (class General_options): Add -z text and -z textoff.
6816         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6817
6818 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6819
6820         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6821         (Garbage_collection::cident_sections): New function.
6822         (Garbage_collection::add_cident_section): New function.
6823         (Garbage_collection::cident_sections_): New member.
6824         (gc_process_relocs): Add references to sections whose names are C
6825         identifiers.
6826         * gold.h (cident_section_start_prefix): New constant.
6827         (cident_section_stop_prefix): New constant.
6828         (is_cident): New function.
6829         * layout.cc (Layout::define_section_symbols): Replace string constants
6830         with the newly defined constants.
6831         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6832         C identifiers.
6833         * testsuite/Makefile.am: Add gc_orphan_section_test.
6834         * testsuite/Makefile.in: Regenerate.
6835         * testsuite/gc_orphan_section_test.cc: New file.
6836         * testsuite/gc_orphan_section_test.sh: New file.
6837
6838 2010-01-06  Ian Lance Taylor  <iant@google.com>
6839
6840         PR 10980
6841         * options.h (class General_options): Add --warn-shared-textrel.
6842         * layout.cc (Layout::finish_dynamic_section): Implement
6843         --warn-shared-textrel.
6844
6845         PR 10980
6846         * options.h (class General_options): Add --warn-multiple-gp.
6847
6848 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6849
6850         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6851         $(THREADSLIB) and $(LIBDL).
6852         * Makefile.in: Rebuild.
6853
6854 2010-01-06  Ian Lance Taylor  <iant@google.com>
6855
6856         PR 10980
6857         * options.cc (General_options::parse_section_start): New function.
6858         (General_options::section_start): New function.
6859         (General_options::General_options): Initialize all members.
6860         * options.h: Include <map>
6861         (class General_options): Add --section-start.  Add section_starts_
6862         member.
6863         * layout.cc (Layout::attach_allocated_section_to_segment): If
6864         --section-start was used, set the address of the segment.  Remove
6865         local sort_sections.
6866         (Layout::relaxation_loop_body): If the address of the load segment
6867         has been set by --section-start, don't use it.
6868         * output.h (Output_segment::update_flags_for_output_section): New
6869         function.
6870         * output.cc (Output_segment::add_output_section): Call
6871         update_flags_for_output_section.
6872
6873 2010-01-05  Ian Lance Taylor  <iant@google.com>
6874
6875         PR 10980
6876         * options.h (class General_options): Add --undefined-version.
6877         * script.cc (struct Version_expression): Add was_matched_by_symbol
6878         field.
6879         (Version_script_info::matched_symbol): New function.
6880         (Version_script_info::get_symbol_version_helper): Call
6881         matched_symbol.
6882         (Version_script_info::check_unmatched_names): New function.
6883         * script.h (class Version_script_info): Update declarations.
6884         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6885
6886         * options.h (class General_options): Use DEFINE_bool_alias for
6887         allow_multiple_definition.
6888         * resolve.cc (Symbol_table::should_override): Don't test
6889         allow_multiple_definition.
6890
6891         PR 10980
6892         * options.h (class General_options): Add --cref.
6893         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6894         until after printing cref table.
6895         * cref.cc: Include "symtab.h".
6896         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6897         (Cref_table_compare::operator()): New function.
6898         (Cref_inputs::gather_cref): New function.
6899         (filecol): New static const.
6900         (Cref_inputs::print_cref): New function.
6901         (Cref::print_cref): New function.
6902         * cref.h: Include <cstdio>.
6903         (class Cref): Update declarations.
6904         * mapfile.h (Mapfile::file): New function.
6905         * object.h (class Object): Define Symbols.  Declare virtual
6906         do_get_global_symbols.
6907         (Object::get_global_symbols): New function.
6908         * object.cc (Input_objects::add_object): Pass object to cref_ if
6909         --cref.
6910         (Input_objects::archive_start): Likewise.
6911         (Input_objects::archive_stop): Likewise.
6912         (Input_objects::print_cref): New function.
6913         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6914         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6915         --cref.
6916         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6917         function.
6918         * plugin.h (class Sized_pluginobj): Update declarations.
6919
6920 2010-01-05  Ian Lance Taylor  <iant@google.com>
6921
6922         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6923         to is_default_version.  Rename insdef to insdefault.
6924         (Symbol_table::add_from_relobj): Rename def to is_default_version
6925         and local to is_forced_local.
6926         (Symbol_table::add_from_pluginobj): Likewise.
6927         (Symbol_table::add_from_dynobj): Likewise.
6928         (Symbol_table::define_special_symbol): Rename insdef to
6929         insdefault.
6930
6931 2010-01-04  Ian Lance Taylor  <iant@google.com>
6932
6933         PR 10980
6934         * options.h (class General_options): Add
6935         --allow-multiple-definition and -z muldefs.
6936         * resolve.cc (Symbol_table::should_override): Don't warn about a
6937         multiple symbol definition if --allow-multiple-definition or -z
6938         muldefs.
6939
6940         PR 10980
6941         * options.h (class General_options): Add --add-needed and
6942         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6943         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6944         error if --copy-dt-needed-entries aka --add-needed is used and
6945         would cause a change in behaviour.
6946
6947         PR 10980
6948         * options.h (class General_options): Add -G as a short version of
6949         --shared.  Add no-op options -assert, -g, and -i.
6950
6951 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6952
6953         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6954         check for .text or .gnu.linkonce.t sections.
6955         * icf.cc (Icf::find_identical_sections): Ditto.
6956         Change the detection for mangled function name within the section
6957         name.
6958         * icf.h (is_section_foldable_candidate): New function.
6959
6960 2009-12-30  Ian Lance Taylor  <iant@google.com>
6961
6962         PR 10980
6963         * options.h (class General_options): Permit two dashes with
6964         --retain-symbols-file.
6965
6966 2009-12-30  Ian Lance Taylor  <iant@google.com>
6967
6968         PR 10979
6969         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6970         don't put the file header and segment headers in the text
6971         segment.
6972
6973         PR 10979
6974         * common.cc (Sort_commons::operator()): Stabilize sort when both
6975         entries are NULL.
6976         (Symbol_table::do_allocate_commons_list): When allocating common
6977         symbols, skip a symbol which is no longer common.
6978         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6979         an object before checking its type.
6980         * testsuite/common_test_2.c: New file.
6981         * testsuite/common_test_3.c: New file.
6982         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6983         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6984         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6985         (common_test_2_pic.o, common_test_2.so): New targets.
6986         (common_test_3_pic.o, common_test_3.so): New targets.
6987         * testsuite/Makefile.in: Rebuild.
6988
6989         PR 10979
6990         * script.cc (read_input_script): If we see a new SECTIONS clause,
6991         and we have added an input section, give an error.
6992         * layout.h (class Layout): Add have_added_input_section function.
6993         Add have_added_input_section_ field.
6994         * layout.cc (Layout::Layout): Initialize
6995         have_added_input_section_.
6996         (Layout::layout): Set have_added_input_section_.
6997         (Layout::layout_eh_frame): Likewise.
6998
6999 2009-12-30  Ian Lance Taylor  <iant@google.com>
7000
7001         PR 10931
7002         * options.h (class General_options): Add --sort-common option.
7003         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7004         * common.cc (Sort_common): Add sort_order parameter to
7005         constructor.  Add sort_order_ field.
7006         (Sort_commons::operator): Check sort_order_.
7007         (Symbol_table::allocate_commons): Determine the sort order.
7008         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7009         Change all callers.
7010         (Symbol_table::do_allocate_commons_list): Likewise.
7011
7012 2009-12-30  Ian Lance Taylor  <iant@google.com>
7013
7014         PR 10916
7015         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7016         symbols from this object, don't change the visibility of an
7017         undefined symbol.
7018         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7019
7020 2009-12-30  Ian Lance Taylor  <iant@google.com>
7021
7022         PR 10861
7023         * script.h (class Version_script_info): Define Language enum.
7024         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7025         new fields globals_, locals_, and is_finalized_.
7026         * script.cc: Various formatting fixes.
7027         (class Parser_closure): Change language_stack_ from a vector of
7028         std::string to one of Version_script_info::Language.  Adjust all
7029         uses accordingly.
7030         (class Lazy_demangler): Remove.
7031         (struct Version_expression): Change language from std::string to
7032         Version_script_info::Language.
7033         (Version_script_info::Version_script_info): New function.
7034         (Version_script_info::~Version_script_info): Don't call clear.
7035         (Version_script_info::finalize): New function.
7036         (Version_script_info::build_lookup_tables): New function.
7037         (Version_script_info::build_expression_list_lookup): New
7038         function.
7039         (Version_script_info::get_symbol_version_helper): Rewrite to use
7040         lookup tables.
7041         (Version_script_info::print_expression_list): Adjust to use
7042         Version_script_info::Language.
7043         (script_push_lex_into_version_mode): Check that the version script
7044         has not been finalized.
7045         (version_script_push_lang): Change language string to
7046         Version_script_info::Language.
7047         * options.cc (Command_line::version_script): New function.
7048         * options.h (class General_options): Add finalize_dynamic_list
7049         function.  Change version_script from declaration to definition.
7050         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7051         * testsuite/version_script.map: Remove duplicate def of foo.
7052         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7053         version_script.map.
7054         * testsuite/Makefile.in: Rebuild.
7055
7056 2009-12-30  Ian Lance Taylor  <iant@google.com>
7057
7058         PR 10843
7059         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7060         if the input symbol index is 0, make the output symbol index 0.
7061
7062 2009-12-30  Ian Lance Taylor  <iant@google.com>
7063
7064         PR 10670
7065         * options.h (class General_options): Add -x/--discard-all.
7066         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7067         --discard-all.  If the local symbol needs a dynamic entry, check
7068         that before handling --discard-locals.
7069
7070 2009-12-30  Ian Lance Taylor  <iant@google.com>
7071
7072         PR 10450
7073         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7074         flags to PF_R.
7075         (Output_segment::add_output_section): Don't change the flags if
7076         the type is PT_TLS.
7077
7078         PR 10450
7079         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7080         GNU hash table if they need a dynamic value.  Otherwise, don't add
7081         them if they are defined in a dynamic object or are forced local.
7082
7083 2009-12-29  Ian Lance Taylor  <iant@google.com>
7084
7085         PR 10450
7086         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7087         .gnu.hash table for a 32-bit target.
7088
7089         PR 10450
7090         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7091         regular and a dynamic object only needs a dynamic symbol table
7092         entry if it is externally visible.
7093
7094         PR 10450
7095         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7096         constructor.  Add global_offset_table_ field.
7097         (Target_i386::got_section): Set global_offset_table_.
7098         (Target_i386::do_finalize_sections): Set global_offset_table_
7099         size.
7100         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7101         in constructor.  Add global_offset_table_ field.
7102         (Target_x86_64::got_section): Set global_offset_table_.
7103         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7104         size.
7105
7106         * layout.cc (Layout::Layout): Initialize increase_relro_.
7107         (Layout::get_output_section): Add is_relro, is_last_relro, and
7108         is_first_non_relro parameters.  Change all callers.
7109         (Layout::choose_output_section): Likewise.
7110         (Layout::add_output_section_data): Likewise.
7111         (Layout::make_output_section): Likewise.
7112         (Layout::set_segment_offsets): Clear increase_relro when using a
7113         linker script.
7114         * layout.h (class Layout): Add increase_relro method.  Add
7115         increase_relro_ field.  Update declarations.
7116         * output.cc (Output_section::Output_section): Initialize
7117         is_last_relro_ and is_first_non_relro_.
7118         (Output_segment::add_output_section): Group relro sections is
7119         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7120         (Output_segment::maximum_alignment): Remove relro handling.
7121         (Output_segment::set_section_addresses): Add increase_relro
7122         parameter.  Change all callers.  Add initial alignment to align
7123         relro sections on separate page.  Remove old relro handling.
7124         (Output_segment::set_section_list_addresses): Remove in_relro
7125         parameter.  Change all callers.
7126         (Output_segment::set_offset): Add increase parameter.  Change all
7127         callers.  Remove old relro handling.
7128         * output.h (class Output_section): Add new methods: is_last_relro,
7129         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7130         Add is_last_relro_ and is_first_non_relro_ fields.
7131         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7132         Create separate .got.plt section.  Call increase_relro.
7133         * x86_64.cc (Target_x86_64::got_section): Likewise.
7134         * testsuite/relro_script_test.t: Add .got.plt.
7135
7136         PR 10450
7137         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7138         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7139         (Layout::finalize): Call set_dynamic_symbol_size.
7140         (Layout::set_dynamic_symbol_size): New function.
7141         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7142         set_dynamic_symbol_size.
7143
7144         PR 10450
7145         * output.h (class Output_section): Add is_entsize_zero_ field.
7146         * output.cc (Output_section::Output_section): Initialize
7147         is_entsize_zero_.
7148         (Output_section::set_entsize): If two different entsizes are
7149         requested, force it to zero.
7150         (Output_section::add_input_section): Set flags for .debug_str
7151         before updating section flags.  Set entsize.
7152         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7153         and SHF_STRING if all input sections have those flags.
7154
7155 2009-12-29   Rafael Espindola  <espindola@google.com>
7156
7157         * main.cc (main): Fix the sys time reporting.
7158         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7159         reporting.
7160
7161 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7162
7163         * options.cc (General_options::parse_version): Allow -v to exit
7164         without an error if there is nothing to link.
7165
7166 2009-12-29  Ian Lance Taylor  <iant@google.com>
7167
7168         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7169         using a version of gcc before 4.1.
7170         * configure: Rebuild.
7171
7172 2009-12-28  Chris Demetriou  <cgd@google.com>
7173
7174         * attributes.cc (Output_attributes_section_data::do_write): Use
7175         std::vector::front rather than std::vector::data.
7176
7177 2009-12-28  Ian Lance Taylor  <iant@google.com>
7178
7179         * symtab.h (class Symbol_table): Add enum Defined.
7180         * resolve.cc (Symbol_table::should_override): Add defined
7181         parameter.  Change all callers.  Test whether object is NULL
7182         before calling a method on it.
7183         (Symbol_table::report_resolve_problem): Add defined parameter.
7184         Change all callers.
7185         (Symbol_table::should_override_with_special): Likewise.
7186         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7187         parameter.  Change all callers.
7188         (Symbol_table::do_define_in_output_data): Likewise.
7189         (Symbol_table::define_in_output_segment): Likewise.
7190         (Symbol_table::do_define_in_output_segment): Likewise.
7191         (Symbol_table::define_as_constant): Likewise.
7192         (Symbol_table::do_define_as_constant): Likewise.
7193         * script.h (class Symbol_assignment): Add is_defsym parameter to
7194         constructor; change all callers.
7195         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7196         parameter.  Change all callers.  Add is_defsym_ field.
7197         (class Parser_closure): Add parsing_defsym parameter to
7198         constructor; change all callers.  Add parsing_defsym accessor
7199         function.  Add parsing_defsym_ field.
7200
7201 2009-12-28  Ian Lance Taylor  <iant@google.com>
7202
7203         * gold.cc (queue_middle_tasks): Fix formatting.
7204         * object.cc (Relobj::is_section_name_included): Likewise.
7205
7206 2009-12-23  Ian Lance Taylor  <iant@google.com>
7207
7208         * i386.cc (Target_i386::do_calls_non_split): Recognize
7209         -fsplit-stack prologue for a function with a static chain.
7210         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7211         -fsplit-stack prologue when using %r11.
7212
7213 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7214
7215         * options.cc (General_options::parse_version): Make -v continue and do
7216         the link like GNU ld does.
7217
7218 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7219
7220         * Makefile.am (CCFILES): Add timer.cc.
7221         (HFILES): Add timer.h.
7222         * configure.ac: Check for sysconf and times.
7223         * main.cc: include timer.h.
7224         (main): Use Timer instead of get_run_time.
7225         * timer.cc: New.
7226         * timer.h: New.
7227         * workqueue.cc: include timer.h.
7228         (Workqueue::find_and_run_task):
7229         Report user, sys and wall time.
7230         * Makefile.in: Regenerate.
7231         * config.in: Regenerate.
7232         * configure: Regenerate.
7233
7234 2009-12-16  Doug Kwan  <dougkwan@google.com>
7235
7236         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7237         sections.
7238         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7239         relaxed input sections.
7240         * output.cc (Output_section::find_relaxed_input_section): Change
7241         return type to Output_relaxed_input_section pointer.  Adjust code
7242         for new type of relaxed_input_section_map_.
7243         * output.h (Output_section::find_relaxed_input_section): Change
7244         return type to Output_relaxed_input_section pointer.
7245         (Output_section::Output_relaxed_input_section_by_input_section_map):
7246         New type.
7247         (Output_section::relaxed_input_section_map_): Change type to
7248         Output_section::Output_relaxed_input_section_by_input_section_map.
7249         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7250         input section.
7251
7252 2009-12-15  Ian Lance Taylor  <iant@google.com>
7253
7254         * layout.cc (Layout::create_shstrtab): Only write out after input
7255         sections if we are compressing debug sections.
7256
7257 2009-12-15  Ian Lance Taylor  <iant@google.com>
7258
7259         * archive.cc (Archive::add_symbols): Only look up a symbol without
7260         a version if there is, in fact, a version.
7261
7262 2009-12-14  Ian Lance Taylor  <iant@google.com>
7263
7264         Revert -Wshadow changes, all changes from:
7265         2009-12-11  Doug Kwan  <dougkwan@google.com>
7266         2009-12-11  Nick Clifton  <nickc@redhat.com>
7267         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7268
7269 2009-12-11  Doug Kwan  <dougkwan@google.com>
7270
7271         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7272         due to -Wshadow.
7273         * attributes.cc (Object_attribute::size): Ditto.
7274         (Attributes_section_data::size): Ditto.
7275         (Attributes_section_data::Attributes_section_data): Ditto.
7276         (Output_attributes_section_data::do_write): Ditto.
7277         * attributes.h (Object_attribute::set_type): Ditto.
7278         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7279
7280 2009-12-11  Nick Clifton  <nickc@redhat.com>
7281
7282         * archive.cc: Fix shadowed variable warnings.
7283         * arm.cc: Likewise.
7284         * compressed_output.cc: Likewise.
7285         * compressed_output.h: Likewise.
7286         * configure: Likewise.
7287         * dwarf_reader.cc: Likewise.
7288         * dynobj.cc: Likewise.
7289         * dynobj.h: Likewise.
7290         * ehframe.cc: Likewise.
7291         * ehframe.h: Likewise.
7292         * errors.cc: Likewise.
7293         * expression.cc: Likewise.
7294         * fileread.cc: Likewise.
7295         * fileread.h: Likewise.
7296         * freebsd.h: Likewise.
7297         * i386.cc: Likewise.
7298         * icf.cc: Likewise.
7299         * incremental.h: Likewise.
7300         * layout.cc: Likewise.
7301         * layout.h: Likewise.
7302         * mapfile.cc: Likewise.
7303         * merge.cc: Likewise.
7304         * merge.h: Likewise.
7305         * object.cc: Likewise.
7306         * object.h: Likewise.
7307         * options.h: Likewise.
7308         * output.cc: Likewise.
7309         * output.h: Likewise.
7310         * parameters.cc: Likewise.
7311         * plugin.cc: Likewise.
7312         * powerpc.cc: Likewise.
7313         * reduced_debug_output.cc: Likewise.
7314         * reduced_debug_output.h: Likewise.
7315         * reloc.cc: Likewise.
7316         * reloc.h: Likewise.
7317         * resolve.cc: Likewise.
7318         * script-sections.cc: Likewise.
7319         * script.cc: Likewise.
7320         * script.h: Likewise.
7321         * sparc.cc: Likewise.
7322         * symtab.cc: Likewise.
7323         * symtab.h: Likewise.
7324         * target-select.cc: Likewise.
7325         * target-select.h: Likewise.
7326         * token.h: Likewise.
7327         * workqueue.cc: Likewise.
7328         * workqueue.h: Likewise.
7329         * x86_64.cc: Likewise.
7330
7331 2009-12-10  Doug Kwan  <dougkwan@google.com>
7332
7333         * arm.cc (attributes.h): New include.
7334         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7335         (Arm_relobj::~Arm_relobj): Delete object pointed by
7336         attributes_section_data_.
7337         (Arm_relobj::attributes_section_data): New method definition.
7338         (Arm_relobj::attributes_section_data_): New data member declaration.
7339         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7340         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7341         attributes_section_data_.
7342         (Arm_dynobj::attributes_section_data): New method definition.
7343         (Arm_dynobj::attributes_section_data_): New data member declaration.
7344         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7345         initialization value of may_use_blx_ to false.
7346         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7347         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7348         object attributes to compute results instead of hard-coding.
7349         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7350         Target_arm::get_secondary_compatible_arch,
7351         Target_arm::set_secondary_compatible_arch
7352         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7353         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7354         New method declarations.
7355         (Target_arm::get_aeabi_object_attribute): New method definition.
7356         (Target_arm::attributes_section_data_): New data member declaration.
7357         (read_arm_attributes_section): New template definition.
7358         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7359         (Arm_dynobj::do_read_symbols): Ditto.
7360         (Target_arm::do_finalize_sections): Merge attributes sections from
7361         input.  Check for BLX use after attributes section merging.
7362         Fix __exidx_start and __exidx_end visibility.  Create an
7363         .ARM.attributes section if necessary.
7364         (Target_arm::get_secondary_compatible_arch,
7365         Target_arm::set_secondary_compatible_arch,
7366         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7367         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7368         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7369         New method definitions.
7370
7371 2009-12-09  Ian Lance Taylor  <iant@google.com>
7372
7373         * plugin.cc (Plugin::load): Don't cast from void* to a function
7374         pointer.
7375
7376 2009-12-09  Ian Lance Taylor  <iant@google.com>
7377
7378         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7379         information fields.
7380
7381 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7382
7383         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7384         Replace two_file_shared_1.so with two_file_shared_2.so.
7385         * testsuite/Makefile.in: Regenerated.
7386
7387 2009-12-08  Doug Kwan  <dougkwan@google.com>
7388
7389         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7390         (HFILES): Add attributes.h and int_encoding.h.
7391         * Makefile.in: Regenerate.
7392         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7393         function definitions to int_encoding.cc
7394         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7395         prototypes to int_encoding.h
7396         * reduced_debug_output.cc (int_encoding.h): New include.
7397         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7398         function definitions to int_encoding.cc
7399         (insert_into_vector, read_from_pointer): Move template definitions to
7400         int_encoding.h
7401         * attributes.cc: New file.
7402         * attributes.h: New file.
7403         * int_encoding.cc: New file.
7404         * int_encoding.h: New file.
7405
7406 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7407
7408         PR gold/11055
7409         * incremental-dump.cc (dump_incremental_inputs): New.
7410         (main): Use dump_incremental_inputs.
7411
7412 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7413
7414         PR gold/10893
7415         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7416         checking elfcpp::STT_FUNC.
7417         (Target_i386::Relocate::relocate): Likewise.
7418         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7419
7420         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7421         symbols from shared libraries into normal FUNC symbols.
7422
7423         * symtab.h (Symbol): Add is_func and use it.
7424
7425 2009-12-05  Doug Kwan  <dougkwan@google.com>
7426
7427         * arm.cc (Target_arm::arm_info): Initialize new fields
7428         attributes_section and attributes_vendor.
7429         * i386.cc (Target_i386::i386_info): Same.
7430         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7431         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7432         fields attributes_section and attributes_vendor.
7433         * sparc.cc (Target_sparc::sparc_info): Same.
7434         * target.h (Target::attributes_section, Target::attributes_vendor,
7435         Target::is_attributes_section, Target::attribute_arg_type,
7436         Target::attributes_order): New method definitions.
7437         (Target::Target_info::attributes_section,
7438         Target::Target_info::attributes_vendor): New fields.
7439         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7440         virtual method definitions.
7441         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7442         attributes_section and attributes_vendor.
7443         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7444
7445 2009-12-05  Doug Kwan  <dougkwan@google.com>
7446
7447         * arm.cc: Update comments about interworking and stub generation.
7448         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7449         considered as non-PIC.
7450         (Arm_relocate_functions::base_abs): Fix formatting.
7451         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7452         of function to use GOT entry address instead of offset.
7453         (Target_arm::Scan::global): Issue an error if a symbol would need a
7454         PLT does not get one because it is untyped.  Remove code to create
7455         dynamic symbols for relative branches.
7456         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7457         takes unsigned integer instead of boolean.
7458
7459 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7460
7461         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7462         (two_file_test_LDADD): Likewise.
7463         (common_test_1_LDADD): Likewise.
7464         (exception_test_LDADD) Likewise.
7465         (weak_test_LDADD): Likewise.
7466         (many_sections_test_LDADD): Likewise.
7467         (initpri1_LDADD): Likewise.
7468         (script_test_1_LDADD): Likewise.
7469         (script_test_2_LDADD): Likewise.
7470         (justsyms_LDADD): Likewise.
7471         (binary_test_LDADD): Likewise.
7472         (large_LDADD): Likewise.
7473         * testsuite/Makefile.in: Regenerated.
7474
7475 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7476
7477         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7478         (Symbol_table::override_with_special): Likewise.
7479         (Symbol_table::add_from_object): Likewise.
7480
7481 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7482
7483         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7484         Don't set the data_offset twice.
7485
7486 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7487
7488         * testsuite/Makefile.in: Regenerate.
7489
7490 2009-12-03  Doug Kwan  <dougkwan@google.com>
7491
7492         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7493         (Target_arm::do_finalize_sections): Add parameter for symbol table
7494         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7495         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7496         parameter for symbol table pointer.
7497         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7498         an additional parameter for a pointer to symbol table.
7499         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7500         parameter for a symbol table pointer.
7501         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7502         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7503         Ditto.
7504         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7505         parameter for a symbol table pointer.
7506
7507 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7508
7509         * incremental.cc (Incremental_inputs_header)
7510         (Incremental_inputs_header_write, Incremental_inputs_entry)
7511         (Incremental_inputs_entry_write): Move ...
7512         * incremental.h (Incremental_inputs_header)
7513         (Incremental_inputs_header_write, Incremental_inputs_entry)
7514         (Incremental_inputs_entry_write): here.
7515
7516 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7517
7518         * incremental.cc (make_sized_incremental_binary): Set the target.
7519         Error if it is incompatible.
7520         * output.h (Output_file): Add filename method.
7521
7522 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7523
7524         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7525         from the get_* methods.
7526
7527 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7528
7529         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7530         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7531         Write 0 for the data_offset of scripts.
7532
7533 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7534
7535         * testsuite/Makefile.am: Add the incremental_test.sh test.
7536         * testsuite/incremental_test.sh: New.
7537         * testsuite/incremental_test_1.c: New.
7538         * testsuite/incremental_test_2.c: New.
7539
7540 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7541
7542        * incremental-dump.cc (main): Fix typos.
7543
7544 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7545
7546         PR gold/11025
7547         * incremental-dump.cc (main): Use llu to print 64 bit values.
7548
7549 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7550             H.J. Lu  <hongjiu.lu@intel.com>
7551
7552         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7553         $(LIBDL).
7554         (incremental_dump_LDADD): Likewise.
7555         * Makefile.in: Regenerated.
7556
7557 2009-11-25  Doug Kwan  <dougkwan@google.com>
7558
7559         Revert:
7560
7561         2009-11-25  Doug Kwan  <dougkwan@google.com>
7562
7563                 * arm.cc (Target_arm::Target_arm): Move method definition
7564                 outside of class definition.  Add code to handle
7565                 --target1-rel, --target1-abs and --target2= options.
7566                 (Target_arm::get_reloc_reloc_type): Change method to be
7567                 non-static and const.
7568                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7569                 New data member declaration.
7570                 (Target_arm::Scan::local, Target_arm::Scan::global,
7571                 Target_arm::Relocate::relocate,
7572                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7573                 Adjust call to Target_arm::get_real_reloc_type.
7574                 (Target_arm::get_real_reloc_type): Use command line options
7575                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7576                 * options.h (--target1-rel, --target1-abs, --target2): New
7577                 ARM-only options.
7578
7579 2009-11-25  Doug Kwan  <dougkwan@google.com>
7580
7581         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7582         class definition.  Add code to handle --target1-rel, --target1-abs
7583         and --target2= options.
7584         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7585         and const.
7586         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7587         member declaration.
7588         (Target_arm::Scan::local, Target_arm::Scan::global,
7589         Target_arm::Relocate::relocate,
7590         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7591         call to Target_arm::get_real_reloc_type.
7592         (Target_arm::get_real_reloc_type): Use command line options to
7593         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7594         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7595         options.
7596
7597 2009-11-25  Doug Kwan  <dougkwan@google.com>
7598
7599         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7600         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7601         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7602         formatting.
7603         (Arm_relocate_functions::thm_call): Replace body with a call to
7604         Arm_relocate_functions::thumb_branch_common.
7605         (Arm_relocate_functions::thm_jump24,
7606         Arm_relocate_functions::thm_xpc22): New method definitions.
7607         (Arm_relocate_functions::thumb_branch_common): New method definition.
7608         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7609         operator.
7610         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7611         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7612
7613 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7614
7615         * Makefile.am: Build incremental-dump
7616         * Makefile.in: Regenerate.
7617         * incremental-dump.cc: New.
7618         * incremental.cc (Incremental_inputs_header_data,
7619         Incremental_inputs_entry_data): Move to incremental.h
7620         * incremental.h: (Incremental_inputs_header_data,
7621         Incremental_inputs_entry_data): Move from incremental.cc
7622
7623 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7624
7625         * incremental.cc (Incremental_inputs_header,
7626         Incremental_inputs_header_write, Incremental_inputs_entry,
7627         Incremental_inputs_entry_write): Add a typedef with the data type.
7628
7629 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7630
7631         * incremental.cc (Incremental_inputs_header,
7632         Incremental_inputs_header_write, Incremental_inputs_entry,
7633         Incremental_inputs_entry_write): Update comment about which
7634         type has the filed descriptions.
7635
7636 2009-11-15  Doug Kwan  <dougkwan@google.com>
7637
7638         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7639         (Arm_relocate_functions::arm_branch_common): Change method defintion
7640         in class definition to a method declaration and update list of formal
7641         parameters.
7642         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7643         Arm_relocation_functions::jump24): Adjust call to
7644         Arm_relocate_functions::arm_branch_common.  Update list of formal
7645         parameters.
7646         (Arm_relocate_functions::xpc25): New method definition.
7647         (Arm_relocate_functions::arm_branch_common): Move method defintion
7648         out from class definition.  Use stubs for mode-switching and extending
7649         branch ranges.
7650         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7651         specially.  Change code to enable use of stubs in ARM branches.
7652
7653 2009-11-10  Doug Kwan  <dougkwan@google.com>
7654
7655         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7656         in method declaration.
7657         (Target_arm::relocate_stub): New method declaration.
7658         (Target_arm::default_target): Change to return a pointer instead of
7659         a const reference.
7660         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7661         Target_arm::default_target.
7662         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7663         method definition.
7664         (Target_arm::relocate_section): Adjust view.
7665         (Target_arm::relocate_stub): New method definition.
7666
7667 2009-11-10  Doug Kwan  <dougkwan@google.com>
7668
7669         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7670         a format warning.
7671         * incremental.cc (open_incremental_binary): Initialized local
7672         variables to avoid warnings.
7673         * object.cc (make_elf_object): Ditto.
7674         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7675         a format warning.
7676
7677 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7678
7679         PR gold/10930
7680         * testsuite/plugin_test.c: Include "config.h".
7681
7682 2009-11-09  Doug Kwan  <dougkwan@google.com>
7683
7684         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7685         (arm_symbol_value): Remove.
7686         (Arm_relocate_functions::arm_branch_common,
7687         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7688         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7689         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7690         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7691         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7692         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7693         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7694         Arm_relocate_functions::thm_mobw_abs_nc,
7695         Arm_relocate_functions::thm_mov_abs,
7696         Arm_relocate_functions::movw_prel_nc,
7697         Arm_relocate_functions::thm_movt_abs,
7698         Arm_relocate_functions::movt_prel,
7699         Arm_relocate_functions::thm_movw_prel_nc,
7700         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7701         (Target_arm::Relocate::relocate): Only decompose address into two
7702         parts if relocation type uses the thumb-bit and pass the actual
7703         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7704         calls to methods in Arm_relocate_functions for this change.
7705
7706 2009-11-08  Ian Lance Taylor  <iant@google.com>
7707
7708         PR 10925
7709         * reloc.cc: Instantiate
7710         Sized_relobj::initialize_input_to_output_maps and
7711         Sized_relobj:free_input_to_output_maps.
7712
7713 2009-11-06  Ian Lance Taylor  <iant@google.com>
7714
7715         PR 10876
7716         * defstd.cc (in_segment): Set only_if_ref true for "end".
7717
7718 2009-11-06  Doug Kwan  <dougkwan@google.com>
7719
7720         * arm.cc (class Reloc_stub): Correct a comment.
7721         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7722         (Target_arm::scan_section_for_stubs): New method declaration.
7723         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7724         Change methods from private to protected.
7725         (Target_arm::do_may_relax): New method definition.
7726         (Target_arm::do_relax, Target_arm::group_sections,
7727         Target_arm::scan_reloc_for_stub,
7728         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7729         (Target_arm::arm_input_section_map_): New data member declaration.
7730         (Target_arm::scan_reloc_for_stub,
7731         Target_arm::scan_reloc_section_for_stubs,
7732         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7733         Target_arm::do_relax): New method definitions.
7734
7735 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7736
7737         * configure.ac: Check for (struct stat)::st_mtim
7738         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7739         * config.in: Regenerate.
7740         * configure: Regenerate.
7741
7742 2009-11-05  Ian Lance Taylor  <iant@google.com>
7743
7744         PR 10910
7745         * output.cc (Output_segment::add_output_section): Add missing
7746         return statement.
7747
7748 2009-11-04  Ian Lance Taylor  <iant@google.com>
7749
7750         PR 10880
7751         * object.h (class Object): Add is_needed and set_is_needed
7752         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7753         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7754         defined in a dynamic object and referenced by a regular object,
7755         set is_needed for the dynamic object.
7756         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7757         if the file is marked with as_needed and it is not needed.
7758
7759 2009-11-04  Ian Lance Taylor  <iant@google.com>
7760
7761         PR 10887
7762         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7763         tags if data is discarded by linker script.
7764         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7765         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7766         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7767         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7768
7769 2009-11-04  Ian Lance Taylor  <iant@google.com>
7770
7771         * layout.cc (Layout::get_output_section): Add is_interp and
7772         is_dynamic_linker_section parameters.  Change all callers.
7773         (Layout::choose_output_section): Likewise.
7774         (Layout::make_output_section): Likewise.
7775         (Layout::add_output_section_data): Add is_dynamic_linker_section
7776         parameter.  Change all callers.
7777         * layout.h (class Layout): Update declarations.
7778         * output.h (class Output_section): Add is_interp, set_is_interp,
7779         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7780         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7781         generate_code_fills_at_write_ to a bitfield.
7782         * output.cc (Output_section::Output_sections): Initialize new
7783         fields.
7784         (Output_segment::add_output_section): Add do_sort parameter.
7785         Change all callers.
7786
7787 2009-11-03  Ian Lance Taylor  <iant@google.com>
7788
7789         PR 10860
7790         * options.h (class General_options): Add --warn-common.
7791         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7792         merging two common symbols.
7793         (Symbol_table::should_override): Handle --warn-common when merging
7794         a common symbol with a defined symbol.  Use report_resolve_problem
7795         for multiple definitions.
7796         (Symbol_table::report_resolve_problem): New function.
7797         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7798
7799 2009-11-03  Doug Kwan  <dougkwan@google.com>
7800
7801         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7802         stub_factory_.
7803         (Target_arm::stub_factory): New method definition.
7804         (Target_arm::new_arm_input_section,
7805         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7806         Target_arm::reloc_uses_thumb_bit): New method declarations.
7807         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7808         New type definitions.
7809         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7810         member declarations.
7811         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7812         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7813         New method definitions.
7814
7815 2009-11-03  Ian Lance Taylor  <iant@google.com>
7816
7817         * options.h (class General_options): Add --warn_constructors.
7818
7819 2009-11-03  Ian Lance Taylor  <iant@google.com>
7820
7821         PR 10893
7822         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7823         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7824
7825 2009-11-03  Ian Lance Taylor  <iant@google.com>
7826
7827         PR 10895
7828         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7829         --msgid-bugs-address.
7830         (install-pdf): New target.
7831         (install-data_yes): Look up one directory to find mkinstalldirs.
7832
7833 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7834
7835         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7836         tree.
7837
7838 2009-10-30  Doug Kwan  <dougkwan@google.com>
7839
7840         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7841
7842 2009-10-30  Doug Kwan  <dougkwan@google.com>
7843
7844         * arm.cc (Stub_addend_reader): New struct template definition
7845         and partial specializations.
7846         (Stub_addend_reader::operator()): New method definition for a
7847         partially specialized template.
7848
7849 2009-10-30  Doug Kwan  <dougkwan@google.com>
7850
7851         * arm.cc (Arm_relobj::processor_specific_flags): New method
7852         definition.
7853         (Arm_relobj::do_read_symbols): New method declaration.
7854         (Arm_relobj::processor_specific_flags_): New data member declaration.
7855         (Arm_dynobj): New class definition.
7856         (Target_arm::do_finalize_sections): Add input_objects parameter.
7857         (Target_arm::do_adjust_elf_header): New method declaration.
7858         (Target_arm::are_eabi_versions_compatible,
7859         (Target_arm::merge_processor_specific_flags): New method declaration.
7860         (Target_arm::do_make_elf_object): New overloaded method definitions
7861         and declaration.
7862         (Arm_relobj::do_read_symbols): New method definition.
7863         (Arm_dynobj::do_read_symbols): Ditto.
7864         (Target_arm::do_finalize_sections): Add input_objects parameters.
7865         Merge processor-specific flags from all input objects.
7866         (Target_arm::are_eabi_versions_compatible,
7867         Target_arm::merge_processor_specific_flags,
7868         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7869         New method definitions.
7870         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7871         Input_objects pointer type parameter.
7872         * layout.cc (Layout::finalize): Pass input objects to target's.
7873         finalize_sections function.
7874         * output.cc (Output_file_header::do_sized_write): Set ELF file
7875         header's processor-specific flags.
7876         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7877         Input_objects pointer type parameter.
7878         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7879         * target.h (Input_objects): New forward class declaration.
7880         (Target::processor_specific_flags,
7881         Target::are_processor_specific_flags_sect): New method definitions.
7882         (Target::finalize_sections): Add input_objects parameter.
7883         (Target::Target): Initialize processor_specific_flags_ and
7884         are_processor_specific_flags_set_.
7885         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7886         parameter.
7887         (Target::set_processor_specific_flags): New method definition.
7888         (Target::processor_specific_flags_,
7889         Target::are_processor_specific_flags_set_): New data member
7890         declarations.
7891         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7892         Input_objects pointer type parameter.
7893
7894 2009-10-30  Doug Kwan  <dougkwan@google.com>
7895
7896         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7897
7898 2009-10-28  Ian Lance Taylor  <iant@google.com>
7899
7900         * object.h (class Relobj): Drop options parameter from
7901         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7902         do_scan_relocs, do_relocate.  Change all callers.
7903         (class Sized_relobj): Drop options parameters from
7904         do_gc_process_relocs, do_scan_relocs, do_relocate,
7905         do_relocate_sections, relocate_sections, emit_relocs_scan,
7906         emit_relocs_scan_reltype.  Change all callers.
7907         (struct Relocate_info): Remove options field and all references to
7908         it.
7909         * reloc.h (class Read_relocs): Remove options constructor
7910         parameter and options_ field.  Change all callers.
7911         (class Gc_process_relocs, class Scan_relocs): Likewise.
7912         (class Relocate_task): Likewise.
7913         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7914         all callers.
7915         (scan_relocatable_relocs): Likewise.
7916         * target.h (class Sized_target): Remove options parameter from
7917         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7918         all callers.
7919         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7920         callers.
7921         * arm.cc: Update functions to remove options parameters.
7922         * i386.cc: Likewise.
7923         * powerpc.cc: Likewise.
7924         * sparc.cc: Likewise.
7925         * x86_64.cc: Likewise.
7926         * testsuite/testfile.cc: Likewise.
7927
7928 2009-10-28  Doug Kwan  <dougkwan@google.com>
7929
7930         * arm.cc (Arm_relobj): New class definition.
7931         (Arm_relobj::scan_sections_for_stubs,
7932         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7933         New method definitions.
7934
7935 2009-10-28  Cary Coutant  <ccoutant@google.com>
7936
7937         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7938         (Plugin::cleanup_done_): New member.
7939         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7940         (Plugin_manager::cleanup_done_): Remove.
7941         (Plugin_manager::add_input_file): Edit error message.
7942         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7943         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7944
7945 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7946
7947         * fileread.cc: (File_read::View::~View): Use the new
7948         data_ownership_ filed.
7949         (File_read::~File_read): Dispose the new whole_file_view_.
7950         (File_read::open): Mmap the whole file if needed.
7951         (File_read::open): Use whole_file_view_ instead of contents_.
7952         (File_read::find_view): Use whole_file_view_ if applicable.
7953         (File_read::do_read): Use whole_file_view_ instead of contents_.
7954         (File_read::make_view): Use whole_file_view_ instead of contents_,
7955         update File_read::View::View call.
7956         (File_read::find_or_make_view): Update File_read::View::View
7957         call.
7958         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7959         remove contents_
7960         (File_read::View::Data_ownership): New enum.
7961         (File_read::View::View): Replace bool mapped_ with Data_ownership
7962         argument.
7963         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7964         (File_read::View::data_ownership_): New field.
7965         (File_read::contents_): Remove (replaced by whole_file_view_).
7966         (File_read::whole_file_view_): New field.
7967         * options.h (class General_options): Add --keep-files-mapped.
7968
7969 2009-10-27  Cary Coutant  <ccoutant@google.com>
7970
7971         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7972         * testsuite/Makefile.am (plugin_test_5): New test case.
7973         * testsuite/Makefile.in: Regenerate.
7974
7975 2009-10-25  Doug Kwan  <dougkwan@google.com>
7976
7977         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7978         from private to protected to allow access by child class.
7979         (Sized_relobj::do_relocate_sections): New method declaration.
7980         (Sized_relobj::relocate_sections): Virtualize.
7981         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7982         Sized_relobj::relocate_sections.  Instantiate template explicitly
7983         for different target sizes and endianity.
7984
7985 2009-10-24  Doug Kwan  <dougkwan@google.com>
7986
7987         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7988         (Arm_input_section::as_arm_input_section): New method.
7989         (Arm_output_section): New class definition.
7990         (Arm_output_section::create_stub_group,
7991         Arm_output_section::group_sections): New method definitions.
7992
7993 2009-10-22  Doug Kwan  <dougkwan@google.com>
7994
7995         * arm.cc (Arm_input_section): New class definition.
7996         (Arm_input_section::init, Arm_input_section:do_write,
7997         Arm_input_section::set_final_data_size,
7998         Arm_input_section::do_reset_address_and_file_offset): New method
7999         definitions.
8000
8001 2009-10-21  Doug Kwan  <dougkwan@google.com>
8002
8003         * arm.cc (Stub_table, Arm_input_section): New forward class
8004         declarations.
8005         (Stub_table): New class defintion.
8006         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8007         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8008         New method definition.
8009
8010 2009-10-21  Doug Kwan  <dougkwan@google.com>
8011
8012         * arm.cc: Update copyright comments.
8013         (Target_arm): New forward class template declaration.
8014         (Arm_address): New type.
8015         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8016         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8017         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8018         constants.
8019         (Insn_template): Same.
8020         (DEF_STUBS): New macro.
8021         (Stub_type): New enum type.
8022         (Stub_template): New class definition.
8023         (Stub): Same.
8024         (Reloc_stub): Same.
8025         (Stub_factory): Same.
8026         (Target_arm::Target_arm): Initialize may_use_blx_ and
8027         should_force_pic_veneer_.
8028         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8029         Target_arm::should_force_pic_veneer,
8030         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8031         Target_arm::using_thumb_only, Target_arm:;default_target): New
8032         method defintions.
8033         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8034         New data member declarations.
8035         (Insn_template::size, Insn_template::alignment): New method defintions.
8036         (Stub_template::Stub_template): New method definition.
8037         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8038         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8039         (Stub_factory::Stub_factory): New method definition.
8040         * gold.h (string_hash): New template.
8041         * output.h (Input_section_specifier::hash_value): Use
8042         gold::string_hash.
8043         (Input_section_specifier::string_hash): Remove.
8044         * stringpool.cc (Stringpool_template::string_hash): Use
8045         gold::string_hash.
8046
8047 2009-10-20  Doug Kwan  <dougkwan@google.com>
8048
8049         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8050         symbols of relaxed input sections.
8051         * output.h (Output_section::find_relaxed_input_section): Make
8052         method public.
8053
8054 2009-10-16  Doug Kwan  <dougkwan@google.com>
8055
8056         * dynobj.cc (Versions::Versions): Initialize version_script_.
8057         Only insert base version symbol definition for a shared object
8058         if version script defines any version versions.
8059         (Versions::define_base_version): New method definition.
8060         (Versions::add_def): Check that base version is not needed.
8061         (Versions::add_need): Define base version lazily.
8062         * dynobj.h (Versions::define_base_version): New method declaration.
8063         (Versions::needs_base_version_): New data member declaration.
8064         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8065         (check_DATA): Add no_version_test.stdout.
8066         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8067         New make rules.
8068         * testsuite/Makefile.in: Regenerate.
8069         * testsuite/no_version_test.c: New file.
8070         * testsuite/no_version_test.sh: Ditto.
8071
8072 2009-10-16  Doug Kwan  <dougkwan@google.com>
8073
8074         * expression.cc (class Segment_start_expression): New class definition.
8075         (Segment_start_expression::value): New method definition.
8076         (script_exp_function_segment_start): Return a new
8077         Segment_start_expression.
8078         * gold/script-c.h (script_saw_segment_start_expression): New function
8079         prototype.
8080         * script-sections.cc (Script_sections::Script_sections): Initialize
8081         SAW_SEGMENT_START_EXPRESSION_ to false.
8082         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8083         and -Tbbs options to specify section addresses if given in
8084         command line and no SEGMENT_START expression is seen in a script.
8085         * script-sections.h (Script_sections::saw_segment_start_expression,
8086         Script_sections::set_saw_segment_start_expression): New method
8087         definition.
8088         (Script_sections::saw_segment_start_expression_): New data member
8089         declaration.
8090         * script.cc (script_saw_segment_start_expression): New function.
8091         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8092         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8093         script_test_7.sh and script_test_8.sh.
8094         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8095         script_test_8.stdout.
8096         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8097         (script_test_6, script_test_6.stdout, script_test_7,
8098         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8099         * Makefile.in: Regenerate.
8100         * testsuite/script_test_6.sh: New file.
8101         * testsuite/script_test_6.t: Same.
8102         * testsuite/script_test_7.sh: Same.
8103         * testsuite/script_test_7.t: Same.
8104         * testsuite/script_test_8.sh: Same.
8105
8106 2009-10-16  Doug Kwan  <dougkwan@google.com>
8107
8108         * output.cc (Output_segment::set_section_list_address): Cast
8109         expressions to unsigned long long type to avoid format warnings.
8110
8111 2009-10-15  Ian Lance Taylor  <iant@google.com>
8112
8113         * script.cc (Script_options::add_symbol_assignment): Always add a
8114         dot assignment to script_sections_.
8115         * script-sections.cc (Script_sections::add_dot_assignment):
8116         Initialize if necessary.
8117
8118         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8119         program headers with no load segment if there is a linker script.
8120
8121         * layout.cc (Layout::set_segment_offsets): Align the file offset
8122         to the segment aligment for -N or -n with no load segment.
8123         * output.cc (Output_segment::add_output_section): Don't crash if
8124         the first section is a TLS section.
8125         (Output_segment::set_section_list_addresses): Print an error
8126         message if the address moves backward in a linker script.
8127         * script-sections.cc
8128         (Output_section_element_input::set_section_addresses): Don't
8129         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8130         (Orphan_output_section::set_section_addresses): Likewise.
8131
8132 2009-10-15  Doug Kwan  <dougkwan@google.com>
8133
8134         * layout.cc (Layout::finish_dynamic_section): Generate tags
8135         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8136         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8137         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8138
8139 2009-10-14  Ian Lance Taylor  <iant@google.com>
8140
8141         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8142         fields.
8143         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8144         data_shdr fields of relinfo.
8145         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8146         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8147         R_386_TLS_LDO_32, adjust based on section flags.
8148         (Target_i386::Relocate::fix_up_ldo): Remove.
8149
8150 2009-10-13  Ian Lance Taylor  <iant@google.com>
8151
8152         Add support for -pie.
8153         * options.h (class General_options): Add -pie and
8154         --pic-executable.
8155         (General_options::output_is_position_independent): Test -pie.
8156         (General_options::output_is_executable): Return true if not shared
8157         and not relocatable.
8158         (General_options::output_is_pie): Remove.
8159         * options.cc (General_options::finalize): Reject incompatible uses
8160         of -pie.
8161         * gold.cc (queue_middle_tasks): A -pie link is not static.
8162         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8163         * symtab.cc (Symbol::final_value_is_known): Return false if
8164         output_is_position_independent.
8165         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8166         output_is_position_independent.
8167         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8168         output_is_position_independent.
8169         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8170         output_is_position_independent.
8171         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8172         two_file_pie_test.
8173         (basic_pie_test.o, basic_pie_test): New targets.
8174         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8175         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8176         (two_file_pie_test): New target.
8177         * testsuite/Makefile.in: Rebuild.
8178         * README: Remove note saying that -pie is not supported.
8179
8180 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8181
8182         * options.h (class General_options): Add -init and -fini.
8183         * layout.cc (Layout::finish_dynamic_section): Emit
8184         given init and fini functions.
8185
8186 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8187
8188         * gc.h (gc_process_relocs): Check if icf is enabled using new
8189         function.
8190         * gold.cc (queue_initial_tasks): Likewise.
8191         (queue_middle_tasks): Likewise.
8192         * object.cc (do_layout): Likewise.
8193         * symtab.cc (is_section_folded): Likewise.
8194         * main.cc (main): Likewise.
8195         * reloc.cc (Read_relocs::run): Likewise.
8196         (Sized_relobj::do_scan_relocs): Likewise.
8197         * icf.cc (is_function_ctor_or_dtor): New function.
8198         (Icf::find_identical_sections): Check if function is ctor or dtor when
8199         safe icf is chosen.
8200         * options.h (General_options::icf): Change option to be an enum.
8201         (Icf_status): New enum.
8202         (icf_enabled): New method.
8203         (icf_safe_folding): New method.
8204         (set_icf_status): New method.
8205         (icf_status_): New variable.
8206         * (options.cc) (General_options::finalize): Set icf_status_.
8207         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8208         icf_test and icf_keep_unique_test to use the --icf enum flag.
8209         * testsuite/icf_safe_test.sh: New file.
8210         * testsuite/icf_safe_test.cc: New file.
8211
8212 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8213
8214         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8215         includes to gc.h and icf.h.
8216         * arm.cc: Include gc.h.
8217         * gold.cc: Likewise.
8218         * i386.cc: Likewise.
8219         * powerpc.cc: Likewise.
8220         * sparc.cc: Likewise.
8221         * x86_64.cc: Likewise.
8222         * gc.h: Include icf.h.
8223
8224 2009-10-11  Ian Lance Taylor  <iant@google.com>
8225
8226         * plugin.cc: Include "gold.h" before other header files.
8227
8228 2009-10-10  Chris Demetriou  <cgd@google.com>
8229
8230         * options.h (Input_file_argument::Input_file_type): New enum.
8231         (Input_file_argument::is_lib_): Replace with...
8232         (Input_file_argument::type_): New member.
8233         (Input_file_argument::Input_file_argument): Take Input_file_type
8234         'type' rather than boolean 'is_lib' as second argument.
8235         (Input_file_argument::is_lib): Use type_.
8236         (Input_file_argument::is_searched_file): New function.
8237         (Input_file_argument::may_need_search): Handle is_searched_file.
8238         * options.cc (General_options::parse_library): Support -l:filename.
8239         (General_options::parse_just_symbols): Update for Input_file_argument
8240         changes.
8241         (Command_line::process): Likewise.
8242         * archive.cc (Archive::get_file_and_offset): Likewise.
8243         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8244         * script.cc (read_script_file, script_add_file): Likewise.
8245         * fileread.cc (Input_file::Input_file): Likewise.
8246         (Input_file::will_search_for): Handle is_searched_file.
8247         (Input_file::open): Likewise.
8248         * readsyms.cc (Read_symbols::get_name): Likewise.
8249         * testsuite/Makefile.am (searched_file_test): New test.
8250         * testsuite/Makefile.in: Regenerate.
8251         * testsuite/searched_file_test.cc: New file.
8252         * testsuite/searched_file_test_lib.cc: New file.
8253
8254 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8255             Ian Lance Taylor  <iant@google.com>
8256
8257         * descriptor.cc: Include <cstdio> and "binary-io.h".
8258         (Descriptors::open): Open the files in binary mode always.
8259         * script.cc (Lex::get_token): Treat \r as whitespace.
8260
8261 2009-10-09  Ian Lance Taylor  <iant@google.com>
8262
8263         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8264
8265 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8266             Ian Lance Taylor  <iant@google.com>
8267
8268         * configure.ac: Check for readv function also.
8269         * fileread.cc (readv): Define if not HAVE_READV.
8270         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8271         does not exist.
8272         * config.in: Regenerate.
8273         * configure: Regenerate.
8274
8275 2009-10-09  Doug Kwan  <dougkwan@google.com>
8276
8277         * layout.cc (Layout::make_output_section): Call target hook to make
8278         ordinary output section.
8279         (Layout::finalize): Adjust parameter list of call the
8280         Target::may_relax().
8281         * layout.h (class Layout::section_list): New method.
8282         * merge.h (Output_merge_base::entsize): Change visibility to public.
8283         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8284         New methods.
8285         (Output_merge_string::do_is_string): New method.
8286         * object.cc (Sized_relobj::do_setup): renamed from
8287         Sized_relobj::set_up.
8288         * object.h (Sized_relobj::adjust_shndx,
8289         Sized_relobj::initializ_input_to_output_maps,
8290         Sized_relobj::free_input_to_output_maps): Change visibilities to
8291         protected.
8292         (Sized_relobj::setup): Virtualize.
8293         (Sized_relobj::do_setup): New method declaration.
8294         (Sized_relobj::invalidate_section_offset,
8295         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8296         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8297         * options.cc (parse_int): New function.
8298         * options.h (parse_int): New declaration.
8299         (DEFINE_int): New macro.
8300         (stub_group_size): New option.
8301         * output.cc (Output_section::Output_section): Initialize memebers
8302         merge_section_map_, merge_section_by_properties_map_,
8303         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8304         (Output_section::add_input_section): Handled deferred code-fill
8305         generation and remove an old comment.
8306         (Output_section::add_relaxed_input_section): New method definition.
8307         (Output_section::add_merge_input_section): Use merge section by
8308         properties map to speed to search.  Update merge section maps
8309         as appropriate.
8310         (Output_section::build_relaxation_map): New method definition.
8311         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8312         Same.
8313         (Output_section::relax_input_section): Renamed to
8314         Output_section::convert_input_sections_to_relaxed_sections and change
8315         interface to take a vector of pointers to relaxed sections.
8316         (Output_section::find_merge_section,
8317         Output_section::find_relaxed_input_section): New method definitions.
8318         (Output_section::is_input_address_mapped,
8319         Output_section::output_offset, Output_section::output_address):
8320         Use output section data maps to speed up searching.
8321         (Output_section::find_starting_output_address): Add comments.
8322         (Output_section::do_write,
8323         Output_section::write_to_postprocessing_buffer): Do code-fill
8324         generation as appropriate.
8325         (Output_section::get_input_sections): Invalidate relaxed input section
8326         map.
8327         (Output_section::restore_states): Adjust type of checkpoint .
8328         Invalidate relaxed input section map.
8329         * output.h (Output_merge_base): New class declaration.
8330         (Input_section_specifier): New class defintion.
8331         (class Output_relaxed_input_section) Change base class to
8332         Output_section_data_build.
8333         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8334         base class initializer.
8335         (Output_section::add_relaxed_input_section): New method declaration.
8336         (Output_section::Input_section): Change visibility to protected.
8337         (Output_section::Input_section::relobj,
8338         Output_section::Input_section::shndx): Handle relaxed input sections.
8339         Output_section::input_sections) Change visibility to protected.  Also
8340         define overload to return a non-const pointer.
8341         (Output_section::Merge_section_properties): New class defintion.
8342         (Output_section::Merge_section_by_properties_map,
8343         Output_section::Output_section_data_by_input_section_map,
8344         Output_section::Relaxation_map): New types.
8345         (Output_section::relax_input_section): Rename method to
8346         Output_section::convert_input_sections_to_relaxed_sections and change
8347         interface to take a vector of relaxed section pointers.
8348         (Output_section::find_merge_section,
8349         Output_section::find_relaxed_input_section,
8350         Output_section::build_relaxation_map,
8351         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8352         New method declarations.
8353         (Output_section::merge_section_map_
8354         Output_section::merge_section_by_properties_map_,
8355         Output_section::relaxed_input_section_map_,
8356         Output_section::is_relaxed_input_section_map_valid_,
8357         Output_section::generate_code_fills_at_write_): New data members.
8358         * script-sections.cc
8359         (Output_section_element_input::set_section_addresses): Call
8360         current_data_size and addralign methods of relaxed input sections.
8361         (Orphan_output_section::set_section_addresses): Call current_data_size
8362         and addralign methods of relaxed input sections.
8363         * symtab.cc (Symbol_table::compute_final_value): Extract template
8364         from the body of Symbol_table::sized_finalize_symbol.
8365         (Symbol_table::sized_finalized_symbol): Call
8366         Symbol_table::compute_final_value.
8367         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8368         (Symbol_table::compute_final_value): New templated method declaration.
8369         * target.cc (Target::do_make_output_section): New method defintion.
8370         * target.h (Target::make_output_section): New method declaration.
8371         (Target::relax): Add more parameters for input objects, symbol table
8372         and layout.  Adjust call to do_relax.
8373         (Target::do_make_output_section): New method declaration.
8374         (Target::do_relax): Add parameters for input objects, symbol table
8375         and layout.
8376
8377 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8378
8379         * pread.c: Include stdio.h.
8380
8381 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8382
8383         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8384         defined.
8385
8386 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8387
8388         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8389         Change read_shndx type to unsigned int.
8390         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8391         int.
8392         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8393         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8394         Change read_shndx type to unsigned int.
8395         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8396         int.
8397         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8398         * layout.cc (Layout::create_symtab_sections): Cast the result of
8399         local_symcount * symsize to off_t in the gold_assert.
8400
8401 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8402
8403         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8404         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8405         R_ARM_BASE_ABS.
8406         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8407         (Arm_relocate_functions::thm_abs5): New function.
8408         (Arm_relocate_functions::abs12): New function.
8409         (Arm_relocate_functions::abs16): New function.
8410         (Arm_relocate_functions::base_abs): New function.
8411         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8412         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8413         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8414         R_ARM_BASE_ABS.
8415         (Scan::global): Likewise.
8416         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8417         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8418         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8419         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8420         R_ARM_BASE_ABS.
8421
8422 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8423
8424         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8425         (Arm_relocate_functions::movt_prel): New function.
8426         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8427         (Arm_relocate_functions::thm_movt_prel): New function.
8428         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8429         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8430         (Scan::global, Relocate::relocate): Likewise.
8431         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8432
8433 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8434
8435         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8436         Incremental_checker.
8437         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8438         unsigned int.
8439         (class Incremental_inputs_header): New class.
8440         (Incremental_inputs_header_writer): Edit comment.
8441         (Incremental_inputs_entry): New class.
8442         (Incremental_inputs_entry_writer): Edit comment.
8443         (Sized_incremental_binary::do_find_incremental_inputs_section):
8444         Add *strtab_shndx parameter, fill it.
8445         (Sized_incremental_binary::do_check_inputs): New method.
8446         (Incremental_checker::can_incrementally_link_output_file): Use
8447         Sized_incremental_binary::check_inputs.
8448         (Incremental_inputs::report_command_line): Save command line in
8449         command_line_.
8450         * incremental.h:
8451         (Incremental_binary::find_incremental_inputs_section): New
8452         method.
8453         (Incremental_binary::do_find_incremental_inputs_section): Add
8454         strtab_shndx parameter.
8455         (Incremental_binary::do_check_inputs): New pure virtual method.
8456         (Sized_incremental_binary::do_check_inputs): Declare.
8457         (Incremental_checker::Incremental_checker): Add incremental_inputs
8458         parameter, use it to initialize incremental_inputs_.
8459         (Incremental_checker::incremental_inputs_): New field.
8460         (Incremental_checker::command_line): New method.
8461         (Incremental_checker::inputs): New method.
8462         (Incremental_checker::command_line_): New field.
8463
8464 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8465
8466         * incremental.cc: Include <cstdarg> and "target-select.h".
8467         (vexplain_no_incremental): New function.
8468         (explain_no_incremental): New function.
8469         (Incremental_binary::error): New method.
8470         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8471         method.
8472         (make_sized_incremental_binary): New function.
8473         (open_incremental_binary): New function.
8474         (can_incrementally_link_file): Add checks if output is ELF and has
8475         inputs section.
8476         * incremental.h: Include "elfcpp_file.h" and "output.h".
8477         (Incremental_binary): New class.
8478         (Sized_incremental_binary): New class.
8479         (open_incremental_binary): Declare.
8480         * object.cc (is_elf_object): Use
8481         elfcpp::Elf_recognizer::is_elf_file.
8482         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8483         * output.h (Output_file::filesize): New method.
8484
8485 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8486
8487         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8488         New function.
8489         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8490         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8491         function.
8492         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8493         function.
8494         (Arm_relocate_functions::movw_abs_nc): New function.
8495         (Arm_relocate_functions::movt_abs): New function.
8496         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8497         (Arm_relocate_functions::thm_movt_abs): New function.
8498         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8499         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8500         (Scan::global): Likewise.
8501         (Relocate::relocate): Likewise.
8502         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8503
8504 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8505
8506         * arm.cc (Arm_relocate_functions::got_prel) New function.
8507         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8508         (Relocate::relocate): Likewise.
8509         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8510
8511 2009-10-06  Ian Lance Taylor  <iant@google.com>
8512
8513         * options.h (class General_options): Define
8514         split_stack_adjust_size parameter.
8515         * object.h (class Object): Add uses_split_stack_ and
8516         has_no_split_stack_ fields.  Add uses_split_stack and
8517         has_no_split_stack accessor functions.  Declare
8518         handle_split_stack_section.
8519         (class Reloc_symbol_changes): Define.
8520         (class Sized_relobj): Define Function_offsets.  Declare
8521         split_stack_adjust, split_stack_adjust_reltype, and
8522         find_functions.
8523         * object.cc (Object::handle_split_stack_section): New function.
8524         (Sized_relobj::do_layout): Call handle_split_stack_section.
8525         * dynobj.cc (Sized_dynobj::do_layout): Call
8526         handle_split_stack_section.
8527         * reloc.cc (Sized_relobj::relocate_sections): Call
8528         split_stack_adjust for executable sections in split_stack
8529         objects.  Pass reloc_map to relocate_section.
8530         (Sized_relobj::split_stack_adjust): New function.
8531         (Sized_relobj::split_stack_adjust_reltype): New function.
8532         (Sized_relobj::find_functions): New function.
8533         * target-reloc.h: Include "object.h".
8534         (relocate_section): Add reloc_symbol_changes parameter.  Change
8535         all callers.
8536         * target.h (class Target): Add calls_non_split method.  Declare
8537         do_calls_non_split virtual method.  Declare match_view and
8538         set_view_to_nop.
8539         * target.cc: Include "elfcpp.h".
8540         (Target::do_calls_non_split): New function.
8541         (Target::match_view): New function.
8542         (Target::set_view_to_nop): New function.
8543         * gold.cc (queue_middle_tasks): Give an error if mixing
8544         split-stack and non-split-stack objects with -r.
8545         * i386.cc (Target_i386::relocate_section): Add
8546         reloc_symbol_changes parameter.
8547         (Target_i386::do_calls_non_split): New function.
8548         * x86_64.cc (Target_x86_64::relocate_section): Add
8549         reloc_symbol_changes parameter.
8550         (Target_x86_64::do_calls_non_split): New function.
8551         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8552         parameter.
8553         * powerpc.cc (Target_powerpc::relocate_section): Add
8554         reloc_symbol_changes parameter.
8555         * sparc.cc (Target_sparc::relocate_section): Add
8556         reloc_symbol_changes parameter.
8557         * configure.ac: Call AM_CONDITIONAL for the default target.
8558         * configure: Rebuild.
8559         * testsuite/Makefile.am (TEST_AS): New variable.
8560         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8561         (check_DATA): Add split_i386 and split_x86_64 files.
8562         (SPLIT_DEFSYMS): Define.
8563         (split_i386_[1234n].o): New targets.
8564         (split_i386_[124]): New targets.
8565         (split_i386_[1234r].stdout): New targets.
8566         (split_x86_64_[1234n].o): New targets.
8567         (split_x86_64_[124]): New targets.
8568         (split_x86_64_[1234r].stdout): New targets.
8569         (MOSTLYCLEANFILES): Add new executables.
8570         * testsuite/split_i386.sh: New file.
8571         * testsuite/split_x86_64.sh: New file.
8572         * testsuite/split_i386_1.s: New file.
8573         * testsuite/split_i386_2.s: New file.
8574         * testsuite/split_i386_3.s: New file.
8575         * testsuite/split_i386_4.s: New file.
8576         * testsuite/split_i386_n.s: New file.
8577         * testsuite/split_x86_64_1.s: New file.
8578         * testsuite/split_x86_64_2.s: New file.
8579         * testsuite/split_x86_64_3.s: New file.
8580         * testsuite/split_x86_64_4.s: New file.
8581         * testsuite/split_x86_64_n.s: New file.
8582         * testsuite/testfile.cc (Target_test): Update relocation_section
8583         function.
8584         * testsuite/Makefile.in: Rebuild.
8585
8586 2009-10-06  Ian Lance Taylor  <iant@google.com>
8587
8588         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8589         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8590         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8591         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8592         the address on ldo_addrs_.
8593         (Target_i386::Relocate::fix_up_ldo): New function.
8594
8595 2009-10-06   Rafael Espindola  <espindola@google.com>
8596
8597         * plugin.cc (add_input_library): New.
8598         (Plugin::load): Add add_input_library to tv.
8599         (Plugin_manager::add_input_file): Add the is_lib argument.
8600         (add_input_file): Update call to Plugin_manager::add_input_file.
8601         (add_input_library): New.
8602         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8603
8604 2009-09-30  Doug Kwan  <dougkwan@google.com>
8605
8606         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8607         symbol and call Symbol::may_need_copy_reloc to determine if
8608         a copy reloc is needed.
8609         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8610         nocopyreloc is given in command line.
8611         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8612         given in command line.
8613         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8614         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8615         of the removed Target_i386::may_need_copy_reloc.
8616         * options.h (copyreloc): New option with default value false.
8617         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8618         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8619         instead of the removed Target_powerpc::may_need_copy_reloc.
8620         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8621         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8622         instead of the removed Target_sparc::may_need_copy_reloc.
8623         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8624         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8625         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8626         instead of the removed Target_x86_64::may_need_copy_reloc.
8627
8628 2009-09-30  Ian Lance Taylor  <iant@google.com>
8629
8630         * object.h (class Object): Remove target_ field, and target,
8631         sized_target, and set_target methods.
8632         (Object::sized_target): Remove.
8633         (class Sized_relobj): Update declarations.  Remove sized_target.
8634         * object.cc (Sized_relobj::setup): Remove target parameter.
8635         Change all callers.
8636         (Input_objects::add_object): Don't do anything with the target.
8637         (make_elf_sized_object): Add punconfigured parameter.  Change all
8638         callers.  Set or test parameter target.
8639         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8640         Change all callers.
8641         * parameters.cc (Parameters::set_target): Change parameter type to
8642         be non-const.
8643         (Parameters::default_target): Remove.
8644         (set_parameters_target): Change parameter type to be non-const.
8645         (parameters_force_valid_target): New function.
8646         (parameters_clear_target): New function.
8647         * parameters.h (class Parameters): Update declarations.  Remove
8648         default_target method.  Add sized_target and clear_target
8649         methods.  Change target_ to be non-const.
8650         (set_parameters_target): Update declaration.
8651         (parameters_force_valid_target): Declare.
8652         (parameters_clear_target): Declare.
8653         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8654         as NULL if we aren't searching.
8655         (Add_symbols::run): Don't check for compatible target.
8656         * fileread.cc (Input_file::open_binary): Call
8657         parameters_force_valid_target.
8658         * gold.cc (queue_middle_tasks): Likewise.
8659         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8660         set_target on object.
8661         * dynobj.h (class Sized_dynobj): Update declarations.
8662         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8663         make_elf_object returns NULL.
8664         (Archive::include_member): Don't check whether object target is
8665         compatible.
8666         * output.cc (Output_section::add_input_section): Get target from
8667         parameters.
8668         (Output_section::relax_input_section): Likewise.
8669         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8670         parameters.
8671         (Sized_relobj::do_scan_relocs): Likewise.
8672         (Sized_relobj::relocate_sections): Likewise.
8673         * resolve.cc (Symbol_table::resolve): Likewise.
8674         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8675         parameter.  Change all callers.
8676         (Symbol_table::add_from_object): Get target from parameters.
8677         (Symbol_table::add_from_relobj): Don't check object target.
8678         (Symbol_table::add_from_dynobj): Likewise.
8679         (Symbol_table::define_special_symbol): Get target from
8680         parameters.
8681         * symtab.h (class Symbol_table): Update declaration.
8682         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8683         parameter.  Change all callers.  Clear parameter target.
8684         (Binary_test): Test target here.
8685         * testsuite/object_unittest.cc (gold_testsuite): Remove
8686         target_test_pointer parameter.  Change all callers.
8687         (Object_test): Test target here.
8688
8689 2009-09-26  Ian Lance Taylor  <iant@google.com>
8690
8691         * testsuite/initpri1.c: Don't try to use constructor priorities if
8692         compiling with gcc before 4.3.
8693
8694 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8695
8696         * testsuite/retain_symbols_file_test.sh (check_present): Change
8697         output file name to retain_symbols_file_test.stdout.
8698         (check_absent): Likewise.
8699
8700 2009-09-18  Craig Silverstein  <csilvers@google.com>
8701
8702         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8703         * options.cc: Include <cerrno> and <fstream>.
8704         (General_options::finalize): Parse -retain-symbols-file tag.
8705         * options.h: New flag.
8706         (General_options): New method should_retain_symbol, new
8707         variable symbols_to_retain.
8708         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8709         should_retain_symbol map.
8710         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8711         * testsuite/Makefile.in: Regenerate.
8712         * testsuite/retain_symbols_file_test.sh: New file.
8713
8714 2009-09-18  Nick Clifton  <nickc@redhat.com>
8715
8716         * po/es.po: Updated Spanish translation.
8717
8718 2009-09-17  Doug Kwan  <dougkwan@google.com>
8719
8720         * debug.h (DEBUG_RELAXATION): New constant.
8721         (DEBUG_ALL): Add DEBUG_RELAXATION.
8722         (debug_string_to_enum): Add relaxation debug option.
8723         * layout.cc
8724         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8725         Layout::Relaxation_debug_check::read_sections,
8726         Layout::Relaxation_debug_check::read_sections): New method definitions.
8727         (Layout::Layout): Initialize data members
8728         record_output_section_data_from_scrips_,
8729         script_output_section_data_list_ and relaxation_debug_check_.
8730         (Layout::save_segments, Layout::restore_segments,
8731         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8732         Layout::relaxation_loop_body): New method definitions.
8733         (Layout::finalize): Support relaxation.  Move section layout code to
8734         Layout::relaxation_loop_body.
8735         (Layout::set_asection_address_from_script): Move code for orphan
8736         section placement out.
8737         (Layout::place_orphan_sections_in_script): New method definition.
8738         * layout.h (Output_segment_headers, Output_file_header):
8739         New forward class declarations.
8740         (Layout::~Layout): Define.
8741         (Layout::new_output_section_data_from_script): New method definition.
8742         (Layout::place_orphan_sections_in_script): New method declaration.
8743         (Layout::Segment_states): New type declaration.
8744         (Layout::save_segments, Layout::restore_segments,
8745         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8746         Layout::relaxation_loop_body): New method declarations.
8747         (Layout::Output_section_data_list): New type declaration.
8748         (Layout::Relaxation_debug_check): New class definition.
8749         (Layout::record_output_section_data_from_script_,
8750         Layout::script_output_section_data_list_, Layout::segment_states_,
8751         Layout::relaxation_debug_check_): New data members.
8752         * output.cc: (Output_section_headers::do_size): New method definition.
8753         (Output_section_headers::Output_section_headers): Move size
8754         computation to Output_section_headers::do_size.
8755         (Output_segment_headers::do_size): New method definition.
8756         (Output_file_header::Output_file_header): Move size computation to
8757         Output_file_header::do_size and call it.
8758         (Output_file_header::do_size): New method definition.
8759         (Output_data_group::Output_data_group): Adjust call to
8760         Output_section_data.
8761         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8762         (Output_symtab_xindex::do_write): Add array bound check.
8763         (Output_section::Input_section::print_to_mapfile): Handle
8764         RELAXED_INPUT_SECTION_CODE.
8765         (Output_section::Output_section): Initialize data member checkpoint_.
8766         (Output_section::~Output_section): Delete checkpoint object pointed
8767         by checkpoint_.
8768         (Output_section::add_input_section): Always add an Input_section if
8769         relaxing.
8770         (Output_section::add_merge_input_section): Add assert.
8771         (Output_section::relax_input_section): New method definition.
8772         (Output_section::set_final_data_size): Set load address to zero for
8773         an unallocated section.
8774         (Output_section::do_address_and_file_offset_have_reset_values):
8775         New method definition.
8776         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8777         Handle relaxed input section.
8778         (Output_section::sort_attached_input_sections): Checkpoint input
8779         section list lazily.
8780         (Output_section::get_input_sections): Change type of input_sections to
8781         list of Simple_input_section pointers.  Checkpoint input section list
8782         lazily.  Also handle relaxed input sections.
8783         (Output_section::add_input_section_for_script): Take a reference to
8784         a Simple_input_section object instead of Relobj pointer and section
8785         index as parameter.  Handle relaxed input sections.
8786         (Output_section::save_states, Output_section::restore_states): New
8787         method definitions.
8788         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8789         (Output_data::is_data_size_fixed): New method definition.
8790         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8791         if it is fixed.
8792         (Output_data::address_and_file_offset_have_reset_values): New method
8793         definition.
8794         (Output_data::do_address_and_file_offset_have_reset_values): New method
8795         definition.
8796         (Output_data::set_data_size): Check that data size is not fixed.
8797         (Output_data::fix_data_size): New method definition.
8798         (Output_data::is_data_size_fixed_): New data member.
8799         (Output_section_headers::set_final_data_size): New method definition.
8800         (Output_section_headers::do_size): New method declaration.
8801         (Output_segment_headers::set_final_data_size): New method definition.
8802         (Output_segment_headers::do_size): New method declaration.
8803         (Output_file_header::set_final_data_size)::New method definition.
8804         (Output_file_header::do_size)::New method declaration.
8805         (Output_section_data::Output_section_data): Add new parameter
8806         is_data_size_fixed and use it to fix data size.
8807         (Output_data_const::Output_data_const): Adjust call to base class
8808         constructor and fix data size.
8809         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8810         base class constructor and fix data size.
8811         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8812         base class constructor and fix data size.
8813         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8814         class constructor and fix data size.
8815         (Output_data_group::set_final_data_size): New method definition.
8816         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8817         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8818         class constructor and fix data size.
8819         (Output_relaxed_input_section): New class definition.
8820         (Output_section::Simple_input_section): New class definition.
8821         (Output_section::get_input_sections): Adjust parameter list.
8822         (Output_section::add_input_section_for_script): Same.
8823         (Output_section::save_states, Output_section::restore_states,
8824         Output_section::do_address_and_file_offset_have_reset_values,
8825         (Output_section::Input_section::Input_section): Handle
8826         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8827         Output_relaxed_input_section.
8828         (Output_section::Input_section::is_input_section,
8829         Output_section::Input_section::set_output_section): Handle relaxed
8830         input section.
8831         (Output_section::Input_section::is_relaxed_input_section,
8832         Output_section::Input_section::output_section_data,
8833         Output_section::Input_section::relaxed_input_section): New method
8834         definitions.
8835         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8836         value.
8837         (Output_section::Input_section::u1_): Update comments.
8838         (Output_section::Input_section::u2_): Add new union member poris.
8839         (Output_section::Checkpoint_output_section): New classs definition.
8840         (Output_section::relax_input_section): New method declaration.
8841         (Output_section::checkpoint_): New data member.
8842         (Output_segment): Update comments.
8843         (Output_segment::Output_segment): Un-privatize copy constructor.
8844         (Output_segment::operator=): Un-privatize.
8845         * script-sections.cc (Output_section_element::Input_section_list):
8846         Change element type to Output_section::Simple_input_section.
8847         (Output_section_element_dot_assignment::set_section_addresses):
8848         Register output section data for relaxation clean up.
8849         (Output_data_exression::Output_data_expression): Adjust call to base
8850         constructor to fix data size.
8851         (Output_section_element_data::set_section_addresses): Register
8852         Output_data_expression object for relaxation clean up.
8853         (struct Input_section_info): Replace Relobj pointer and section index
8854         pair with Output_section::Simple_input_section and Convert struct to a
8855         class.
8856         (Input_section_sorter::operator()): Adjust access to
8857         Input_section_info data member to use accessors.
8858         (Output_section_element_input::set_section_addresses): Use layout
8859         parameter.  Adjust code to use Output_section::Simple_input_section
8860         and Input_secction_info classes.  Register filler for relaxation
8861         clean up.
8862         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8863         and section index pair with Output_section::Simple_input_section
8864         class.  Adjust code accordingly.
8865         (Phdrs_element::release_segment): New method definition.
8866         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8867         segment list.
8868         (Script_sections::release_segments): New method definition.
8869         * gold/script-sections.h (Script_sections::release_segments): New
8870         method declaration.
8871         * gold/target.h (Target::may_relax, Target::relax,
8872         Target::do_may_relax, Target::do_relax): New method definitions.
8873
8874 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8875
8876         * arm.cc (has_signed_unsigned_overflow): New function.
8877         (Arm_relocate_functions::abs8): New function.
8878         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8879         (Target_arm::Scan::global): Likewise.
8880         (Target_arm::relocate::relocate): Likewise.
8881         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8882         Likewise.
8883
8884 2009-09-16  Cary Coutant  <ccoutant@google.com>
8885
8886         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8887         * testsuite/Makefile.in: Regenerate.
8888
8889 2009-09-11  Nick Clifton  <nickc@redhat.com>
8890
8891         * po/gold.pot: Updated by the Translation project.
8892
8893 2009-09-08  Cary Coutant  <ccoutant@google.com>
8894
8895         * output.cc (Output_file::open): Add execute permission to empty file.
8896         * testsuite/Makefile.am (permission_test): New test.
8897         * testsuite/Makefile.in: Regenerate.
8898
8899 2009-09-02  Ian Lance Taylor  <iant@google.com>
8900
8901         * output.cc (Output_file::resize): Call map_no_anonymous rather
8902         than map.
8903
8904 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8905
8906         * gold.cc: Include "incremental.h".
8907         (queue_initial_tasks): Call Incremental_checker methods.
8908         * incremental.cc: Include "output.h".
8909         (Incremental_checker::can_incrementally_link_output_file): New
8910         method.
8911         * incremental.h (Incremental_checker): New class.
8912
8913         * output.cc (Output_file::open_for_modification): New method.
8914         (Output_file::map_anonymous): Changed return type to bool.  Record
8915         map in base_ field.
8916         (Output_file::map_no_anonymous): New method, broken out of map.
8917         (Output_file::map): Use map_no_anonymous and map_anonymous.
8918         * output.h (class Output_file): Update declarations.
8919
8920 2009-08-24  Cary Coutant  <ccoutant@google.com>
8921
8922         * options.h (Command_line::Pre_options): New class.
8923         (Command_line::pre_options): New member.
8924         * options.cc (gold::options::ready_to_register): New variable.
8925         (One_option::register_option): Do nothing if not registering options.
8926         Assert if same short option registered twice.
8927         (General_options::General_options): Turn off option registration when
8928         done constructing.
8929         (Command_line::Pre_options::Pre_options): New constructor.
8930
8931 2009-08-24  Cary Coutant  <ccoutant@google.com>
8932
8933         * options.h (General_options::no_keep_memory): Remove incorrect
8934         short option.
8935
8936 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8937
8938         * Makefile.am (am__skiplex, am__skipyacc): New.
8939         * Makefile.in: Regenerate.
8940
8941 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8942
8943         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8944         (INCLUDES): ... this.
8945         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8946         (AM_CPPFLAGS): Renamed from ...
8947         (INCLUDE): ... this.
8948         * Makefile.in, testsuite/Makefile.in: Regenerate.
8949
8950         * Makefile.in: Regenerate.
8951         * aclocal.m4: Likewise.
8952         * config.in: Likewise.
8953         * configure: Likewise.
8954         * testsuite/Makefile.in: Likewise.
8955
8956         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8957         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8958         * Makefile.in: Regenerate.
8959         * testsuite/Makefile.in: Regenerate.
8960
8961 2009-08-19  Cary Coutant  <ccoutant@google.com>
8962
8963         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8964         symbols in shared libraries overridden by hidden or internal symbols
8965         in the main program.
8966
8967 2009-08-19  Chris Demetriou  <cgd@google.com>
8968
8969         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8970         checking source file names in error messages.
8971
8972 2009-08-18  Doug Kwan  <dougkwan@google.com>
8973
8974         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8975         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8976         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8977         an elfcpp::Ehdr as parameter.
8978         * object.cc (Object::set_target): Remove the version that looks up
8979         a target and sets it.
8980         (Sized_relobj::setup): Take a Target object instead of
8981         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8982         (make_elf_sized_object): Find target and ask target to
8983         make an ELF object.
8984         * object.h: (Object::set_target): Remove the version that looks up
8985         a target and sets it.
8986         (Sized_relobj::setup): Take a Target object instead of
8987         an elfcpp:Ehdr as parameter.
8988         * target.cc: Include dynobj.h.
8989         (Target::do_make_elf_object_implementation): New.
8990         (Target::do_make_elf_object): New.
8991         * target.h (Target::make_elf_object): New template declaration.
8992         (Target::do_make_elf_object): New method declarations.
8993         (Target::do_make_elf_object_implementation): New template declaration.
8994
8995 2009-08-14  Ian Lance Taylor  <iant@google.com>
8996
8997         * gold.h (FUNCTION_NAME): Define.
8998         (gold_unreachable): Use FUNCTION_NAME.
8999
9000 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9001
9002         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9003         symbol in the --keep-unique list is not found.
9004
9005 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9006
9007         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9008         been maked as --keep-unique.
9009         (Icf::unfold_section): New function.
9010         * icf.h (Icf::unfold_section): New function.
9011         * options.h (General_options::keep_unique): New option.
9012         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9013         * testsuite/Makefile.in: Regenerate.
9014         * testsuite/icf_keep_unique_test.sh: New file.
9015         * testsuite/icf_keep_unique_test.cc: New file.
9016
9017 2009-08-12  Cary Coutant  <ccoutant@google.com>
9018
9019         PR 10471
9020         * resolve.cc (Symbol_table::resolve): Check for references from
9021         dynamic objects to hidden and internal symbols.
9022         * testsuite/Makefile.am (hidden_test.sh): New test.
9023         * testsuite/Makefile.in: Regenerate.
9024         * testsuite/hidden_test.sh: New script.
9025         * testsuite/hidden_test_1.c: New test source.
9026         * testsuite/hidden_test_main.c: New test source.
9027
9028 2009-08-11  Doug Kwan  <dougkwan@google.com>
9029
9030         * arm.cc: Update comments.
9031         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9032         segment to locate the .ARM.exidx section if present.
9033
9034 2009-08-09  Doug Kwan  <dougkwan@google.com>
9035
9036         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9037         patch.
9038
9039 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9040         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9041         compiler warnings.
9042
9043 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9044
9045         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9046         valid tls_segment only for non-debug-section relocations.
9047         * testsuite/Makefile.am: Add gc_tls_test.
9048         * testsuite/Makefile.in: Regenerate.
9049         * testsuite/gc_tls_test.cc: New file.
9050         * testsuite/gc_tls_test.sh: New file.
9051
9052 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9053
9054         * icf.cc: New file.
9055         * icf.h: New file.
9056         * Makefile.am (CCFILES): Add icf.cc.
9057         (HFILES): Add icf.h
9058         * Makefile.in: Regenerate.
9059         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9060         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9061         section, symbol and addend information for the relocs.
9062         * gold.cc (queue_middle_tasks): Call identical code folding.
9063         * gold.h: Add defines for multimap.
9064         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9065         to the call of finalize_local_symbols.
9066         * main.cc (main): Create object of class Icf.
9067         * object.cc (Sized_relobj::do_layout): Allow this function to be
9068         called twice during icf.
9069         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9070         to sections marked as identical by icf.
9071         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9072         when available.
9073         (Sized_relobj::do_section_entsize): New function.
9074         * object.h (Object::section_entsize): New function.
9075         (Object::do_section_entsize): New pure virtual function.
9076         (Relobj::finalize_local_symbols): Add new parameter.
9077         (Relobj::do_section_entsize): New function.
9078         * options.h (General_options::icf): New option.
9079         (General_options::icf_iterations): New option.
9080         (General_options::print_icf_sections): New option.
9081         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9082         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9083         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9084         icf.
9085         * symtab.cc (Symbol_table::is_section_folded): New function.
9086         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9087         to sections marked as identical by icf.
9088         * symtab.h (Symbol_table::set_icf): New function.
9089         (Symbol_table::icf): New function.
9090         (Symbol_table::is_section_folded): New function.
9091         (Symbol_table::icf_): New data member.
9092         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9093         * testsuite/Makefile.am: Add commands to build icf_test.
9094         * testsuite/Makefile.in: Regenerate.
9095         * testsuite/icf_test.sh: New file.
9096         * testsuite/icf_test.cc: New file.
9097
9098 2009-07-24  Chris Demetriou  <cgd@google.com>
9099
9100         * layout.cc (is_compressible_debug_section): Fix incorrect
9101         comment about compressed section names.
9102
9103 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9104
9105         PR 10419
9106         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9107
9108 2009-07-16  Ian Lance Taylor  <iant@google.com>
9109
9110         PR 10400
9111         * layout.h: #include <map>.
9112         (class Kept_section): Change from struct to class.  Add accessors
9113         and setters.  Add section size to Comdat_group mapping.  Change
9114         Comdat_group to std::map.  Add is_comdat_ field.  Add
9115         linkonce_size field in union.
9116         (class Layout): Update declaration of find_or_add_kept_section.
9117         Don't declare find_kept_object.
9118         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9119         parameter.  Add object, shndx, is_comdat, and is_group_name
9120         parameters.  Change all callers.  Adjust for new Kept_section.
9121         (Layout::find_kept_object): Remove.
9122         * object.cc (Sized_relobj::include_section_group): Update use of
9123         Kept_section.  Rename secnum to shndx.  Only record
9124         Kept_comdat_section if sections are the same size.
9125         (Sized_relobj::include_linkonce_section): Update use of
9126         Kept_section.  Only record Kept_comdat_section if sections are the
9127         same size.  Set size of linkonce section.
9128         (Sized_relobj::map_to_kept_section): Update call to
9129         get_kept_comdat_section.
9130         * object.h (class Sized_relobj): Rename fields in
9131         Kept_comdat_section to drop trailing underscores; change object
9132         field to Relobj*.  Change Kept_comdat_section_table to store
9133         struct rather than pointer.
9134         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9135         Add kept_object and kept_shndx parameters.  Change all callers.
9136         (Sized_relobj::get_kept_comdat_section): Change return type to
9137         bool.  Add kept_object and kept_shndx parameters.  Change all
9138         callers.
9139         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9140         Layout::find_or_add_kept_section.
9141
9142 2009-07-09  Ian Lance Taylor  <iant@google.com>
9143
9144         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9145         Reserve space in the hash table.
9146
9147 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9148
9149         * fileread.cc (File_read::get_mtime): New method.
9150         * fileread.h (Timespec): New structure.
9151         (File_read::get_mtime): New method.
9152         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9153         Renamed from timestamp_nsec.
9154         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9155         Elf_Xword.
9156         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9157         timestamp_nsec.
9158         (Incremental_inputs::report_archive): Save mtime; style fix.
9159         (Incremental_inputs::report_obejct): Save mtime; style fix.
9160         (Incremental_inputs::report_script): Save mtime; style fix.
9161         (Incremental_inputs::finalize_inputs): Style fix.
9162         (Incremental_inputs::finalize): Style fix.
9163         (Incremental_inputs::create_input_section_data): Store inputs
9164         mtime.
9165         * incremental.h (Incremental_inputs::report_script): Add mtime
9166         argument.
9167         (Incremental_inputs::Input_info::Input_info): Intialize only one
9168         union member.
9169         (Incremental_inputs::Input_info::archive): Move to nameless
9170         union.
9171         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9172         (Incremental_inputs::Input_info::script): Move to nameless union.
9173         (Incremental_inputs::mtime): New field.
9174         * script.cc (read_input_script): Pass file mtime to
9175         Incremental_input.
9176         * script.h (Script_info::inputs): Style fix.
9177
9178 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9179
9180         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9181         instead of 32.
9182
9183 2009-06-24  Ian Lance Taylor  <iant@google.com>
9184
9185         PR 10156
9186         * layout.cc (Layout::choose_output_section): If we find an
9187         existing section, update the flags.
9188         (Layout::create_notes): New function, broken out of
9189         Layout::finalize.
9190         (Layout::finalize): Don't create note sections.
9191         (Layout::create_note): Don't crash if linker script discards
9192         section.
9193         (Layout::create_gold_note): Likewise.
9194         (Layout::create_build_id): Likewise.  Don't set
9195         after_input_sections on the section.
9196         (Layout::create_executable_stack_info): Remove target parameter.
9197         Change caller.
9198         * layout.h (class Layout): Declare create_notes.  Update
9199         declaration of create_executable_stack_info.
9200         * gold.cc (queue_middle_tasks): Call create_notes.
9201         * output.cc (Output_section::update_flags_for_input_section): Move
9202         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9203         invalid.
9204         * output.h (Output_data::mark_address_invalid): New function.
9205         (class Output_section): Only declare, not define,
9206         update_flags_for_input_section.  Remove set_flags.
9207
9208 2009-06-24  Ian Lance Taylor  <iant@google.com>
9209
9210         * script-sections.cc (Output_section_definition::
9211         set_section_addresses): Rename shadowing local load_address to
9212         laddr.
9213
9214 2009-06-24  Ian Lance Taylor  <iant@google.com>
9215
9216         PR 10244
9217         * reloc.cc (relocate_sections): Skip empty relocation sections.
9218
9219 2009-06-23  Ian Lance Taylor  <iant@google.com>
9220
9221         PR 10156
9222         * layout.cc (Layout::create_note): Use choose_output_section
9223         rather than make_output_section.
9224
9225 2009-06-23  Ian Lance Taylor  <iant@google.com>
9226
9227         PR 10237
9228         * options.cc (General_options::parse_V): Set printed_version_.
9229         (General_options::General_options): Initialize printed_version_.
9230         * options.h (class General_options): Add printed_version_ field.
9231         * gold.cc (queue_initial_tasks): If there are no input files,
9232         don't give a fatal error if we printed the version information.
9233         (queue_middle_tasks): If using -r with a shared object, give a
9234         fatal error rather than an ordinary error.
9235
9236 2009-06-23  Ian Lance Taylor  <iant@google.com>
9237
9238         PR 10219
9239         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9240         (Layout::make_output_section): Set have_stabstr_section_ if we see
9241         a .stab*str section.
9242         (Layout::finalize): Call link_stabs_sections.
9243         (Layout::link_stabs_sections): New file.
9244         * layout.h (class Layout): Add have_stabstr_section_ field.
9245         Declare link_stabs_sections.
9246
9247 2009-06-23  Doug Kwan  <dougkwan@google.com>
9248
9249         * Makefile.am (libgold_a_LIBADD): New.
9250         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9251         * Makefile.in: Regenerate.
9252         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9253         * configure: Regenerate.
9254         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9255         * fileread.cc: Include sys/state.h
9256         * gold.h: Declare memmem and strndup if found missing.
9257         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9258
9259 2009-06-23  Ian Lance Taylor  <iant@google.com>
9260
9261         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9262         * configure: Rebuild.
9263
9264 2009-06-23  Ian Lance Taylor  <iant@google.com>
9265
9266         PR 10147
9267         * object.cc (Object::section_contents): Don't try to get a view if
9268         the section has length zero.
9269         (Object::handle_gnu_warning_section): If the section is empty, use
9270         the name of the section as the warning.
9271
9272 2009-06-23  Ian Lance Taylor  <iant@google.com>
9273
9274         PR 10133
9275         * stringpool.h (class Stringpool_template): Add optimize_ field.
9276         (Stringpool_template::set_optimize): New function.
9277         * stringpool.cc (Stringpool_template::Stringpool_template):
9278         Initialize optimize_ field.
9279         (Stringpool_template::set_string_offsets): Test local optimize
9280         fild rather than parameter.
9281         * layout.cc (Layout::Layout): Call set_optimize on the section
9282         name stringpool.
9283
9284 2009-06-22  Ian Lance Taylor  <iant@google.com>
9285
9286         PR 10030
9287         * yyscript.y: Parse TARGET.
9288         * script.cc (script_set_target): New function.
9289         * script-c.h (script_set_target): Declare.
9290         * options.cc (General_options::string_to_object_format): Rename
9291         from string_to_object_format in anonymous namespace.  Change
9292         callers.
9293         * options.h (class General_options): Declare
9294         string_to_object_format.
9295
9296 2009-06-22  Ian Lance Taylor  <iant@google.com>
9297
9298         * script-sections.cc (Script_sections::create_segments): Don't put
9299         program headers in a PT_LOAD segment if -n or -N.
9300
9301 2009-06-22  Ian Lance Taylor  <iant@google.com>
9302
9303         PR 10141
9304         * options.h (class General_options): Add -z lazy and -z now.  Sort
9305         -z options into alphabetical order.
9306         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9307
9308 2009-06-21  Ian Lance Taylor  <iant@google.com>
9309
9310         * layout.cc (Layout::make_output_section): Call
9311         Target::new_output_section.
9312         (Layout::attach_allocated_section_to_segment): Put large section
9313         sections in a separate load segment with the large segment flag
9314         set.
9315         (Layout::segment_precedes): Sort large data segments after other
9316         load segments.
9317         (align_file_offset): New static function.
9318         (Layout::set_segment_offsets): Use align_file_offset.
9319         * output.h (class Output_section): Add is_small_section_ and
9320         is_large_section_ fields.
9321         (Output_section::is_small_section): New function.
9322         (Output_section::set_is_small_section):  New function.
9323         (Output_section::is_large_section): New function.
9324         (Output_section::set_is_large_section): New function.
9325         (Output_section::is_large_data_section): New function.
9326         (class Output_segment): Add is_large_data_segment_ field.
9327         (Output_segment::is_large_data_segment): New function.
9328         (Output_segment::set_is_large_data_segment): New function.
9329         * output.cc (Output_section::Output_section): Initialize new
9330         fields.
9331         (Output_segment::Output_segment): Likewise.
9332         (Output_segment::add_output_section): Add assertion that large
9333         data sections always go in large data segments.  Force small data
9334         sections to the end of the list of data sections.  Force small BSS
9335         sections to the start of the list of BSS sections.  For large BSS
9336         sections to the end of the list of BSS sections.
9337         * symtab.h (class Symbol): Declare is_common_shndx.
9338         (Symbol::is_defined): Check Symbol::is_common_shndx.
9339         (Symbol::is_common): Likewise.
9340         (class Symbol_table): Define enum Commons_section_type.  Update
9341         declarations.  Add small_commons_ and large_commons_ fields.
9342         * symtab.cc (Symbol::is_common_shndx): New function.
9343         (Symbol_table::Symbol_table): Initialize new fields.
9344         (Symbol_table::add_from_object): Put small and large common
9345         symbols in the right list.
9346         (Symbol_table::sized_finalized_symbol): Check
9347         Symbol::is_common_shndx.
9348         (Symbol_table::sized_write_globals): Likewise.
9349         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9350         common symbol lists.  Don't call do_allocate_commons_list if the
9351         list is empty.
9352         (Symbol_table::do_allocate_commons_list): Remove is_tls
9353         parameter.  Add comons_section_type parameter.  Change all
9354         callers.  Handle small and large common symbols.
9355         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9356         Symbol::is_common_shndx.
9357         * resolve.cc (symbol_to_bits): Likewise.
9358         * target.h (Target::small_common_shndx): New function.
9359         (Target::small_common_section_flags): New function.
9360         (Target::large_common_shndx): New function.
9361         (Target::large_common_section_flags): New function.
9362         (Target::new_output_section): New function.
9363         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9364         small_common_section_flags, and large_common_section_flags
9365         fields.
9366         (Target::do_new_output_section): New virtual function.
9367         * arm.cc (Target_arm::arm_info): Initialize new fields.
9368         * i386.cc (Target_i386::i386_info): Likewise.
9369         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9370         Likewise.
9371         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9372         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9373         (Target_x86_64::do_new_output_section): New function.
9374         * configure.ac: Define conditional MCMODEL_MEDIUM.
9375         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9376         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9377         (large_LDFLAGS): Define.
9378         * testsuite/large.c: New file.
9379         * testsuite/testfile.cc (Target_test::test_target_info):
9380         Initialize new fields.
9381         * configure, testsuite/Makefile.in: Rebuild.
9382
9383 2009-06-05  Doug Kwan  <dougkwan@google.com>
9384
9385         * Makefile.am (CCFILES): Add target.cc.
9386         * Makefile.in: Regenerate.
9387         * i386.cc (class Target_i386): Define new virtual method to
9388         override do_is_local_label_name in parent.
9389         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9390         local symbols if --discard-locals or -X is given.
9391         * options.h (class General_options): Declare new options
9392         '--discard-locals' and '-X' for discarding locals.
9393         * target.h (class Target): Define new methods is_local_label_name.
9394         Declare new virtual method do_is_local_label_name.
9395         * target.cc: New file.
9396         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9397         (check_SCRIPTS): Add discard_locals_test.sh.
9398         (check_DATA): Add discard_local_tests.syms.
9399         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9400         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9401         * testsuite/Makefile.in: Regenerate.
9402         * testsuite/discard_locals_test.c: New file.
9403         * testsuite/discard_locals_test.sh: Same.
9404
9405 2009-06-05  Doug Kwan  <dougkwan@google.com>
9406
9407         * object.cc (Sized_relobj::Sized_relobj): Initialize
9408         discarded_eh_frame_shndx_ to -1U.
9409         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9410         section.
9411         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9412         a discarded .eh_frame section.
9413         (Sized_relobj::do_finalize_local_symbols): Ditto.
9414         * object.h (class Sized_relobj): Declare new member
9415         discarded_eh_frame_shndx_.
9416         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9417         (local_labels_test.o, local_labels_test): New rules.
9418         * testsuite/Makefile.in: Regenerate.
9419
9420 2009-06-04  Doug Kwan  <dougkwan@google.com>
9421
9422         * layout.cc (Layout::section_name_mapping): Add mapping for
9423         special ARM sections.
9424
9425 2009-06-03  Doug Kwan  <dougkwan@google.com>
9426
9427         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9428         (utils::has_overflow): Same.
9429
9430 2009-06-03  Ian Lance Taylor  <iant@google.com>
9431
9432         * layout.cc (Layout::section_name_mapping): New array, replacing
9433         Layout::linkonce_mapping.
9434         (Layout::section_name_mapping_count): New variable, replacing
9435         Layout::linkonce_mapping_count.
9436         (Layout::linkonce_output_name): Remove.
9437         (Layout::output_section_name): Rewrite.
9438         * layout.h (class Layout): Rename Linkonce_mapping to
9439         Section_name_mapping, linkonce_mapping to section_name_mapping,
9440         linkonce_mapping_count to section_name_mapping_count.  Don't
9441         declare linkonce_output_name.
9442
9443 2009-06-03  Doug Kwan  <dougkwan@google.com>
9444
9445         * gold/arm.cc (namespace utils): New.
9446         (Target_arm::reloc_is_non_pic): Define new method.
9447         (class Arm_relocate_functions): New.
9448         (Target_arm::Relocate::relocate): Handle relocation types used by
9449         Android.
9450
9451 2009-06-03  Ian Lance Taylor  <iant@google.com>
9452
9453         * arm.cc (Target_arm::scan::global): Use || instead of |.
9454
9455 2009-06-02  Doug Kwan  <dougkwan@google.com>
9456
9457         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9458         issued_non_pic_error_.
9459         (class Target_arm::Scan): Declare new method check_non_pic.
9460         Define new method symbol_needs_plt_entry.
9461         Declare new data member issued_non_pic_error_.
9462         (class Target_arm::Relocate): Declare new method
9463         should_apply_static_reloc.
9464         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9465         (Target_arm::Scan::check_non_pic): Define new method.
9466         (Target_arm::Scan::local): Handle a small subset of reloc types used
9467         by Android.
9468         (Target_arm::Scan::local): Same.
9469         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9470
9471 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9472
9473         * incremental.cc (Incremental_inputs::report_command_line): Filter
9474         out --incremental-* options.
9475
9476 2009-05-29  Doug Kwan  <dougkwan@google.com>
9477
9478         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9479         template class.
9480         (class Target_arm): Update comment.
9481         (Target_arm::Target_arm): Initialize new data members GOT_,
9482         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9483         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9484         and Target_arm::rel_dyn_section.
9485         Declare new_enum Target_arm::Got_type.
9486         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9487         and DYNBSS_.
9488         Update commments for member do_dynsym_value.
9489         (Target_arm::got_size, Target_arm::plt_section,
9490         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9491         new methods inside class defintion.
9492         (Target_arm::got_section): Define new method.
9493         (Target_arm::rel_dyn_section): Same.
9494         (Output_data_plt_arm): New template class.
9495         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9496         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9497         (Output_data_plt_arm::add_entry): Same.
9498         (Output_data_plt_arm::first_plt_entry): Define new
9499         static data member for PLT instruction template.
9500         (Output_data_plt_arm::plt_entry): Same.
9501         (Output_data_plt_arm::do_write): Define new method.
9502         (Target_arm::make_plt_entry): Same.
9503         (Target_arm::do_finalize_sections): Same.
9504         (Target_arm::do_dynsym_value): Same.
9505
9506 2009-05-28  Doug Kwan  <dougkwan@google.com>
9507
9508         * Makefile.am (TARGETSOURCES): Add arm.cc.
9509         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9510         * Makefile.in: Regenerate.
9511         * arm.cc: New file.
9512         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9513
9514 2009-05-26  Doug Kwan  <dougkwan@google.com>
9515
9516         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9517         (General_options::check_excluded_libs): Strip off directories in
9518         archive name before matching like GNU ld does.
9519         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9520         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9521         (exclude_libs_test_LDFLAGS): Add linker option
9522         -Wl,--exclude-libs,libexclude_libs_test_3
9523         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9524         an explicit archive without using -l.
9525         (alt/libexclude_libs_test_3.a): New make rule.
9526         * testsuite/Makefile.in: Regenerate.
9527         * testsuite/exclude_libs_test.c : Declare lib3_default().
9528         (main): Call it.
9529         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9530         * exclude_libs_test_3.c: New file.
9531
9532 2009-05-26  Nick Clifton  <nickc@redhat.com>
9533
9534         * po/id.po: New Indonesian translation.
9535         * po/gold.pot: Updated template file.
9536
9537 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9538
9539         * testsuite/Makefile.am: Add -ffunction-sections to compile
9540         gc_comdat_test files.  Add -Wl,--gc-sections to build
9541         gc_comdat_test.
9542         * testsuite/Makefile.in: Regenerate.
9543         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9544
9545 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9546
9547         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9548         kept comdat section was garbage collected.
9549         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9550         * testsuite/Makefile.in: Regenerate.
9551         * testsuite/gc_comdat_test.sh: New file.
9552         * testsuite/gc_comdat_test_1.cc: New file.
9553         * testsuite/gc_comdat_test_2.cc: New file.
9554
9555 2009-05-19  Doug Kwan  <dougkwan@google.com>
9556
9557         * archive.cc (Archive::Archive): Move constructor from archive.h
9558         to here.  Initialize no_export_.
9559         (Archive::get_elf_object_for_member): Set no_export flag of object.
9560         * archive.h (Archive::Archive): Move constructor body to
9561         archive.cc.
9562         (Archive::no_export): New method.
9563         (Archive::no_export_): New field.
9564         * object.h (Object::Object): Initialize no_export_ to false.
9565         (Object::no_export, Object::set_no_export): New methods.
9566         (Object::no_export_): New field.
9567         * options.cc (General_options::parse_exclude_libs): New method.
9568         (General_options::check_excluded_libs) Same.
9569         * options.h (exclude_libs): New option.
9570         (General_options::check_excluded_libs): New method declaration.
9571         (General_options::excluded_libs_): New field.
9572         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9573         default or protected visibility if an object has no-export flag set.
9574         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9575         (check_SCRIPTS): Add exclude_libs_test.sh.
9576         (check_DATA): Add exclude_libs_test.syms.
9577         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9578         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9579         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9580         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9581         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9582         libexclude_libs_test_2.a): New rules.
9583         * testsuite/Makefile.in: Regenerate.
9584         * testsuite/exclude_libs_test.c: New file.
9585         * testsuite/exclude_libs_test.sh: Ditto.
9586         * testsuite/exclude_libs_test_1.c: Ditto.
9587         * testsuite/exclude_libs_test_2.c: Ditto.
9588
9589 2009-05-15  Ian Lance Taylor  <iant@google.com>
9590
9591         * configure.ac: Check for declarations for cases where libiberty.h
9592         checks HAVE_DECL_xxx.
9593         * configure, config.in: Rebuild.
9594
9595 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9596
9597         * gold.h (Incremental_argument_list): Remove (invalid) forward
9598         declaration.
9599         * incremental.cc (Incremental_inputs::report_achive): New method.
9600         (Incremental_inputs::report_object): New method.
9601         (Incremental_inputs::report_script): New method.
9602         (Incremental_inputs::finalize_inputs): New method.
9603         (Incremental_inputs::finalize): Call finalize_inputs().
9604         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9605         Create inputs entries.
9606         * incremental.h (Incremental_input_type): New enum.
9607         (Incremental_inputs::Incremental_input): Initialize new fields.
9608         (Incremental_inputs::report_inputs): New method.
9609         (Incremental_inputs::report_achive): New method.
9610         (Incremental_inputs::report_object): New method.
9611         (Incremental_inputs::report_script): New method.
9612         (Incremental_inputs::finalize_inputs): New method.
9613         (Incremental_inputs::Input_info): New struct.
9614         (Incremental_inputs::Input_info_map): New typedef.
9615         (Incremental_inputs::lock_): New field.
9616         (Incremental_inputs::Inputs_): New field.
9617         (Incremental_inputs::Inputs_map): New field.
9618         * main.cc (main): Call Incremental_input::report_inputs.
9619         * options.h (Input_argument_list): Typedef moved from
9620         Input_arguments.
9621         (Input_file_group::Files): Remove, use ::Input_argument_list.
9622         (Input_file_group::Input_argument_list): Remove, use
9623         ::Input_argument_list.
9624         * plugin.cc (Plugin_manager::add_input_file): Add error in
9625         incremental build.
9626         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9627         functions.
9628         * script.cc (read_input_script): Call
9629         Incremental_input::report_script.
9630         * script.h (Script_info): New class.
9631
9632 2009-04-27  Ian Lance Taylor  <iant@google.com>
9633
9634         * x86_64.cc (do_adjust_output_section): Set entsize to
9635         plt_entry_size.
9636
9637 2009-04-23  Elliott Hughes  <enh@google.com>
9638
9639         * output.cc (Output_file::close): After short writes, continue
9640         writing from the correct offset in the buffer being written.
9641
9642 2009-04-23  Chris Demetriou  <cgd@google.com>
9643
9644         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9645         * configure: Regenerate.
9646         * config.in: Regenerate.
9647         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9648         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9649
9650 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9651
9652         * incremental.cc (Incremental_inputs_header_data): Renamed from
9653         Incremental_input_header_data.
9654         (Incremental_inputs_header_data::data_size): New field.
9655         (Incremental_inputs_header_data::put_input_file_count): Renamed
9656         from input_file_count.
9657         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9658         from command_line_offset.
9659         (Incremental_inputs_header_data::put_reserved): Renamed from
9660         put_reserved.
9661         (Incremental_inputs_entry_data): Renamed from
9662         Incremental_input_entry_data.
9663         (Incremental_inputs_entry_data::data_size): New field.
9664         (Incremental_inputs::report_command_line): New method.
9665         (Incremental_inputs::finalize): New method.
9666         (Incremental_inputs::create_incremental_inputs_data): New method.
9667         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9668         * incremental.h: New file.
9669         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9670        (Layout::finalize): Create incremental inputs section in
9671         incremental builds.
9672        (Layout::create_incremental_info_sections): New method.
9673         * layout.h (Layout::incremental_inputs): New method.
9674        (Layout::create_incremental_info_sections): New method.
9675        (Layout::incremental_inputs_): New field.
9676         * main.cc (main): Notify Incremental_input of the command line.
9677
9678 2009-04-01  Ian Lance Taylor  <iant@google.com>
9679             Mikolaj Zalewski  <mikolajz@google.com>
9680
9681         * gold.h (reserve_unordered_map): Define, three versions, one for
9682         each version of Unordered_map.
9683         * layout.cc (Layout::Layout): Remove options parameter.  Add
9684         number_of_input_files parameter.  Don't initialize options_.
9685         Initialize number_of_input_files_ and resized_signatures_.  Move
9686         sections_are_attached_.
9687         (Layout::layout_group): Reserve space for group_signatures_.
9688         (Layout::find_or_add_kept_section): Change name parameter to be a
9689         reference.  Resize signatures_ map when it gets large enough.
9690         (Layout::layout_eh_frame): Use parameters->options() instead of
9691         this->options_.
9692         (Layout::make_output_section): Likewise.
9693         (Layout::attach_allocated_section_to_segment): Likewise.
9694         (Layout::finalize, Layout::create_executable_stack): Likewise.
9695         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9696         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9697         * layout.h (class Layout): Update declarations.  Remove options_
9698         field.  Add number_of_input_files_ and resized_signatures_
9699         fields.  Move sections_are_attached_ field.
9700         * main.cc (main): Pass number of input files to Layout
9701         constructor.  Don't pass options.
9702
9703 2009-03-30  Ian Lance Taylor  <iant@google.com>
9704
9705         * ffsll.c (ffsll): Correct implementation.
9706
9707 2009-03-27  Ian Lance Taylor  <iant@google.com>
9708
9709         * ffsll.c: New file.
9710         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9711         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9712         * ftruncate.c (ftruncate): Declare before definition.
9713         * mremap.c (mremap): Likewise.
9714         * pread.c (pread): Likewise.
9715         * configure, Makefile.in, config.in: Rebuild.
9716
9717         * mremap.c: New file.
9718         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9719         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9720         (mremap): Declare if HAVE_MREMAP is not defined.
9721         * configure, Makefile.in, config.in: Rebuild.
9722
9723 2009-03-27  Cary Coutant  <ccoutant@google.com>
9724
9725         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9726         position independent.
9727         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9728         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9729
9730 2009-03-24  Cary Coutant  <ccoutant@google.com>
9731
9732         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9733         an executable.
9734         (needs_dynamic_reloc): Likewise.
9735
9736 2009-03-24  Ian Lance Taylor  <iant@google.com>
9737
9738         * yyscript.y (file_cmd): Recognize EXTERN.
9739         (extern_name_list, extern_name_list_body): New nonterminals.
9740         * script.cc (script_add_extern): Define.
9741         * script-c.h (script_add_extern): Declare.
9742
9743 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9744
9745         * object.cc (is_elf_object): Define.
9746         * object.h (is_elf_object): Declare.
9747         * archive.cc (Archive::get_elf_object_for_member): Call
9748         is_elf_object.
9749         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9750
9751 2009-03-24  Elliott Hughes  <enh@google.com>
9752
9753         * output.cc (Output_file::map_anonymous): Define.
9754         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9755         try an anonymous one.  Report the size if the mmap fails.
9756         * output.h (class Output_file): Declare map_anonymous.
9757
9758 2009-03-24  Ian Lance Taylor  <iant@google.com>
9759
9760         * target-select.cc (instantiate_target): Don't acquire the lock if
9761         the instantiated_target_ field has already been set.
9762
9763 2009-03-23  Ian Lance Taylor  <iant@google.com>
9764
9765         * gold-threads.h (class Initialize_lock): Define.
9766         * gold-threads.cc (class Initialize_lock_once): Define.
9767         (initialize_lock_control): New static variable.
9768         (initialize_lock_pointer): New static variable.
9769         (initialize_lock_once): New static function.
9770         (Initialize_lock::Initialize_lock): Define.
9771         (Initialize_lock::initialize): Define.
9772         * target-select.h: Include "gold-threads.h".
9773         (class Target_selector): Add lock_ and initialize_lock_ fields.
9774         Don't define instantiate_target, just declare it.
9775         * target-select.cc (Target_selector::Target_selector): Initialize
9776         new fields.
9777         (Target_selector::instantiate_target): Define.
9778         * descriptors.h: Include "gold-threads.h".
9779         (class Descriptors): Add initialize_lock_ field.
9780         * descriptors.cc (Descriptors::Descriptors): Initialize new
9781         field.
9782         (Descriptors::open): Use initialize_lock_ field
9783         * errors.h (class Errors): Add initialize_lock_ field.
9784         * errors.cc (Errors::Errors): Initialize new field.
9785         (Errors::initialize_lock): Use initialize_lock_ field.
9786         * powerpc.cc (class Target_selector_powerpc): Remove
9787         instantiated_target_ field.  In do_recognize call
9788         instantiate_target rather than do_instantiate_target.  In
9789         do_instantiate_target just allocate a new target.
9790         * sparc.cc (class Target_selector_sparc): Likewise.
9791
9792         * freebsd.h: New file.
9793         * i386.cc: Include "freebsd.h".
9794         (Target_i386): Derive from Target_freebsd rather than
9795         Sized_target.
9796         (Target_selector_i386): Derive from Target_selector_freebsd rather
9797         than Target_selector.
9798         * x86_64.cc: Include "freebsd.h".
9799         (Target_x86_64): Derive from Target_freebsd rather than
9800         Sized_target.
9801         (Target_selector_x86_64): Derive from Target_selector_freebsd
9802         rather than Target_selector.
9803         * target.h (class Target): Add adjust_elf_header and
9804         do_adjust_elf_header.
9805         * output.cc (Output_file_header:: do_sized_write): Call target
9806         adjust_elf_header routine.
9807         * configure.tgt: Set targ_osabi.
9808         * configure.ac: Define GOLD_DEFAULT_OSABI.
9809         * parameters.cc (Parameters::default_target): Pass
9810         GOLD_DEFAULT_OSABI to select_target.
9811         * target-select.h (class Target_selector): Make instantiate_target
9812         protected rather than private.
9813         * Makefile.am (HFILES): Add freebsd.h.
9814         * configure, Makefile.in, config.in: Rebuild.
9815
9816         * merge.cc (do_add_input_section): Correct pend value.  Change
9817         message about last entry not being null terminated from error to
9818         warning.
9819
9820 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9821
9822         * incremental.cc: New file.
9823         * Makefile.am (CCFILES): Add incremental.cc.
9824         * Makefile.in: Rebuild.
9825
9826 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9827
9828         * layout.cc (Layout::output_section_name): Preserve names
9829         of '.note.' sections.
9830
9831 2009-03-19  Ian Lance Taylor  <iant@google.com>
9832
9833         * descriptors.cc (Descriptors::open): Check that the options are
9834         valid before using them.
9835
9836 2009-03-18  Ian Lance Taylor  <iant@google.com>
9837
9838         * script-sections.h: Include <list>.
9839         (class Script_sections): Change Sections_elements from std::vector
9840         to std::list.  Typedef public Elements_iterator.  Add
9841         orphan_section_placement_, data_segment_align_start_, and
9842         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9843         field.
9844         * script-sections.cc (class Orphan_section_placement): New class.
9845         (class Sections_element): Add virtual functions is_relro and
9846         orphan_section_init.  Remove virtual function place_orphan_here.
9847         (class Output_section_definition): Add is_relro and
9848         orphan_section_init.  Remove place_orphan_here.
9849         (class Orphan_output_section): Likewise.
9850         (Script_sections::Script_sections): Update for field changes.
9851         (Script_sections::data_segment_align): Set saw_data_segment_align_
9852         and data_segment_align_start_, not data_segment_align_index.
9853         (Script_sections::data_segment_relro_end): Check
9854         saw_data_segment_align_.  Use data_segment_align_start_ rather
9855         than data_segment_align_index_.
9856         (Script_sections::place_orphan): Rewrite to use
9857         Orphan_section_placement.
9858
9859 2009-03-17  Ian Lance Taylor  <iant@google.com>
9860
9861         * archive.cc (Archive::add_symbols): Check for a version attached
9862         to the symbol name in the archive map.
9863         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9864         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9865         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9866         (ver_test_11.a): New target.
9867         * testsuite/Makefile.in: Rebuild.
9868
9869         * configure.ac: Check for chsize and posix_fallocate.  Replace
9870         ftruncate.
9871         * ftruncate.c: New file, from gnulib.
9872         * output.cc (posix_fallocate): Define dummy version if not
9873         HAVE_POSIX_FALLOCATE.
9874         (Output_file::map): Call posix_fallocate rather than lseek and
9875         write.
9876         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9877         * configure, Makefile.in, config.in: Rebuild.
9878
9879 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9880
9881         * layout.h (Layout::create_note): Add section_name parameter.
9882         * layout.cc (Layout::create_note): Likewise.
9883         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9884
9885 2009-03-17  Ian Lance Taylor  <iant@google.com>
9886
9887         * descriptors.cc: Include "options.h".
9888         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9889         (Descriptors::open): Always use O_CLOEXEC when opening a new
9890         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9891         then set FD_CLOEXEC.
9892
9893         * sparc.cc (class Target_sparc): Add has_got_section.
9894         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9895         make sure we have a GOT section.
9896
9897         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9898         (Target_sparc::Scan::local): Likewise.
9899         (Target_sparc::Scan::global): Likewise.
9900         (Target_sparc::Relocate::relocate): Likewise.
9901         (Target_sparc::Relocate::relocate_tls): Likewise.
9902
9903         * symtab.cc (Symbol_table::define_default_version): New function,
9904         broken out of add_from_object.
9905         (Symbol_table::add_from_object): Call define_default_version.
9906         (Symbol_table::define_special_symbol): Add resolve_oldsym
9907         parameter.  Change all callers.  If the version for a symbol comes
9908         from a version script, resolve it with the symbol with the same
9909         name with no version.  Also add the symbol without a version if
9910         appropriate.
9911         (do_define_in_output_data): If resolving with oldsym, don't delete
9912         sym.
9913         (do_define_in_output_segment): Likewise.
9914         (do_define_as_constant): Likewise.
9915         * symtab.h (class Symbol_table): Update declarations.
9916
9917 2009-03-13  Ian Lance Taylor  <iant@google.com>
9918
9919         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9920         (Read_symbols::requeue): New function.
9921         (Read_symbols::do_read_symbols): If make_elf_object fails because
9922         the target type is not configured, and the file was searched for,
9923         issue a warning and retry with the next directory.
9924         (Add_symbols::run): If the file has an incompatible format, and
9925         it was searched for, requeue the Read_symbols task.  On error,
9926         release the object.
9927         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9928         dirindex parameter to constructor.  Change all callers.  Declare
9929         incompatible_warning and requeue.
9930         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9931         input_argument_ and input_group_ fields.  Add them to
9932         constructor.  Change all callers.
9933         (class Read_script): Add dirindex_ field.  Add it to constructor.
9934         Change all callers.
9935         * archive.cc (Archive::setup): Remove input_objects parameter.
9936         Change all callers.
9937         (Archive::get_file_and_offset): Likewise.
9938         (Archive::read_all_symbols): Likewise.
9939         (Archive::read_symbols): Likewise.
9940         (Archive::get_elf_object_for_member): Remove input_objects
9941         parameter.  Add punconfigured parameter.  Change all callers.
9942         (Archive::add_symbols): Change return type to bool.  Check return
9943         value of include_member.
9944         (Archive::include_all_members): Likewise.
9945         (Archive::include_member): Change return type to bool.  Return
9946         false if first included object has incompatible target.  Set
9947         included_member_ field.
9948         (Add_archive_symbols::run): If add_symbols returns false, requeue
9949         Read_symbols task.
9950         * archive.h (class Archive): Add included_member_ field.
9951         Initialize it in constructor.  Add input_file and searched_for
9952         methods.  Update declarations.
9953         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9954         input_argument_ fields.  Add them to constructor.  Change all
9955         callers.
9956         * script.cc: Include "target-select.h".
9957         (class Parser_closure): Add skip_on_incompatible_target_ and
9958         found_incompatible_target_ fields.  Add
9959         skip_on_incompatible_target parameter to constructor.  Change all
9960         callers.  Add methods skip_on_incompatible_target,
9961         clear_skip_on_incompatible_target, found_incompatible_target, and
9962         set_found_incompatible_target.
9963         (read_input_script): Add dirindex parameter.  Change all callers.
9964         If parser finds an incompatible target, requeue Read_symbols
9965         task.
9966         (script_set_symbol): Clear skip_on_incompatible_target in
9967         closure.
9968         (script_add_assertion, script_parse_option): Likewise.
9969         (script_start_sections, script_add_phdr): Likewise.
9970         (script_check_output_format): New function.
9971         * script.h (read_input_script): Update declaration.
9972         * script-c.h (script_check_output_format): Declare.
9973         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9974         (ignore_cmd): Remove OUTPUT_FORMAT.
9975         * fileread.cc (Input_file::Input_file): Add explicit this.
9976         (Input_file::will_search_for): New function.
9977         (Input_file::open): Add pindex parameter.  Change all callers.
9978         * fileread.h (class Input_file): Add input_file_argument method.
9979         Declare will_search_for.  Update declarations.
9980         * object.cc (make_elf_object): Add punconfigured parameter.
9981         Change all callers.
9982         * object.h (class Object): Make input_file public.  Add
9983         searched_for method.
9984         (make_elf_object): Update declaration.
9985         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9986         restart search.
9987         * dirsearch.h (class Dirsearch): Update declaration.
9988         * options.h (class General_options): Add --warn-search-mismatch.
9989         * parameters.cc (Parameters::is_compatible_target): New function.
9990         * parameters.h (class Parameters): Declare is_compatible_target.
9991         * workqueue.cc (Workqueue::add_blocker): New function.
9992         * workqueue.h (class Workqueue): Declare add_blocker.
9993
9994         * fileread.cc (Input_file::open): Remove options parameter.
9995         Change all callers.
9996         (Input_file::open_binary): Likewise.
9997         * script.cc (read_input_script): Likewise.
9998         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9999         options parameter from constructor.  Change all callers.
10000         (class Read_script): Likewise.
10001         * fileread.h (class Input_file): Update declarations.
10002         * script.h (read_input_script): Update declaration.
10003
10004 2009-03-10  Nick Clifton  <nickc@redhat.com>
10005
10006         * po/es.po: New Spanish translation.
10007
10008 2009-03-06  Cary Coutant  <ccoutant@google.com>
10009
10010         * options.cc (parse_short_option): Keep dash_z from registering itself.
10011
10012 2009-03-03  Ian Lance Taylor  <iant@google.com>
10013
10014         PR 9918
10015         * target-reloc.h (relocate_section): Pass output_section to
10016         relocate.
10017         * i386.cc (Target_i386::should_apply_static_reloc): Add
10018         output_section parameter.  Change all callers.
10019         (Target_i386::Relocate::relocate): Add output_section parameter.
10020         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10021         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10022         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10023         * testsuite/two_file_shared.sh: New script.
10024         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10025         (check_DATA): Add two_file_shared.dbg.
10026         (two_file_shared.dbg): New target.
10027         * testsuite/Makefile.in: Rebuild.
10028
10029 2009-03-01  Ian Lance Taylor  <iant@google.com>
10030
10031         * configure.ac: Check for byteswap.h.
10032         * configure: Rebuild.
10033         * config.in: Rebuild.
10034
10035 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10036
10037         * layout.cc (Layout::find_or_add_kept_section): New function.
10038         (Layout::add_comdat): Removed.
10039         * layout.h (struct Kept_section): Move out of class Layout.
10040         Remove trailing underscores from field names.  Add group_sections
10041         field.  Rename group_ field to is_group.  Change all uses.
10042         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10043         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10044         comdat_groups_ field.
10045         (Sized_relobj::include_section_group): Use
10046         find_or_add_kept_section and Kept_section::group_sections.
10047         (Sized_relobj::include_linkonce_section): Likewise.
10048         * object.cc (class Sized_relobj): Don't define Comdat_group or
10049         Comdat_group_table.  Remove find_comdat_group and
10050         add_comdat_group.  Remove comdat_groups_ field.
10051         * plugin.cc (include_comdat_group): Use
10052         Layout::find_or_add_kept_section.
10053
10054 2009-02-28  Ian Lance Taylor  <iant@google.com>
10055
10056         * README: --gc-sections and map files are now supported.  Document
10057         some build requirements.
10058
10059         PR 6992
10060         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10061         relocatable link set the value of the section symbol to zero.
10062         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10063         relocatable link don't include the section address in the local
10064         symbol value.
10065
10066 2009-02-27  Ian Lance Taylor  <iant@google.com>
10067
10068         PR 6811
10069         * options.h (class Search_directory): Add is_system_directory.
10070         (class General_options): Declare is_in_system_directory.
10071         * options.cc (get_relative_sysroot): Make static.
10072         (get_default_sysroot): Make static.
10073         (General_optoins::is_in_system_directory): New function.
10074         * fileread.cc (Input_file::is_in_system_directory): New function.
10075         * fileread.h (class Input_file): Declare is_in_system_directory.
10076         * object.h (class Object): Add is_in_system_directory.
10077         (class Input_objects): Remove system_library_directory_ field.
10078         * object.cc (Input_objects::add_object): Don't set
10079         system_library_directory_.
10080         (input_objects::found_in_system_library_directory): Remove.
10081         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10082         parameter.  Change all callers.
10083         (Symbol_table::sized_write_globals): Likewise.
10084         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10085         Call Object::is_in_system_directory.
10086         * symtab.h (class Symbol_table): Update declarations.
10087
10088         PR 5990
10089         * descriptors.h (Open_descriptor): Add is_on_stack field.
10090         * descriptors.cc (Descriptors::open): If the descriptor is on the
10091         top of the stack, remove it.  Initialize is_on_stack field.
10092         (Descriptors::release): Only add pod to stack if it is not on the
10093         stack already.
10094         (Descriptors::close_some_descriptor): Clear stack_next and
10095         is_on_stack fields.
10096
10097         PR 7091
10098         * output.cc (Output_section::find_starting_output_address): Rename
10099         from starting_output_address; add PADDR parameter; change return
10100         type.
10101         * output.h (class Output_section): Declare
10102         find_starting_output_address instead of starting_output_address.
10103         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10104         section symbol for which we can't find a merge section.
10105
10106         PR 9836
10107         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10108         hidden or internal, force the symbol to be local.
10109         * resolve.cc (Symbol::override_visibility): Define.
10110         (Symbol::override_base): Use override_visibility.
10111         (Symbol_table::resolve): Likewise.
10112         (Symbol::override_base_with_special): Likewise.
10113         (Symbol_table::override_with_special): If the visibility is hidden
10114         or internal, force the symbol to be local.
10115         * symtab.h (class Symbol): Add set_visibility and
10116         override_visibility.
10117         * testsuite/ver_test_1.sh: New file.
10118         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10119         (check_DATA): Add ver_test_1.syms.
10120         (ver_test_1.syms): New target.
10121         * testsuite/Makefile.in: Rebuild.
10122
10123 2009-02-25  Cary Coutant  <ccoutant@google.com>
10124
10125         * layout.cc (Layout::choose_output_section): Don't rename sections
10126         when using a linker script that has a SECTIONS clause.
10127         * Makefile.in: Regenerate.
10128
10129         * testsuite/Makefile.am (script_test_5.sh): New test case.
10130         * testsuite/Makefile.in: Regenerate.
10131         * testsuite/script_test_5.cc: New file.
10132         * testsuite/script_test_5.sh: New file.
10133         * testsuite/script_test_5.t: New file.
10134
10135 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10136
10137         * archive.cc (Archive::include_member): Update calls to add_symbols.
10138         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10139         the Layout argument.
10140         * dynobj.h (do_add_symbols): Add the Layout argument.
10141         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10142         Layout argument.
10143         * object.h (Object::add_symbols): Add the Layout argument.
10144         (Object::do_add_symbols): Add the Layout argument.
10145         (Sized_relobj::do_add_symbols): Add the Layout argument.
10146         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10147         Unify the two versions.
10148         (Add_plugin_symbols): Remove.
10149         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10150         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10151         (Add_plugin_symbols): Remove.
10152         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10153         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10154         (Add_symbols::run): Make it work with Pulginobj.
10155
10156 2009-02-06  Ian Lance Taylor  <iant@google.com>
10157
10158         * object.cc (Sized_relobj::do_layout): Make info message start
10159         with lower case letter.
10160
10161 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10162
10163         * binary.cc: Fix file comment.
10164
10165         * options.h (enum Incremental_disposition): Define.
10166         (class General_options): Add new options: --incremental,
10167         --incremental_changed, --incremental_unchanged,
10168         --incremental_unknown.  Add incremental_disposition_ and
10169         implicit_incremental_ fields.
10170         (General_options::incremental_disposition): New function.
10171         (class Position_dependent_options): Add incremental_disposition
10172         option.
10173         (Position_dependent_options::copy_from_options): Set incremental
10174         dispositions.
10175         * options.cc (General_options::parse_incremental_changed): New
10176         function.
10177         (General_options::parse_incremental_unchanged): New function.
10178         (General_options::parse_incremental_unknown): New function.
10179         (General_options::General_options): Initialize new fields
10180         incremental_disposition_ and implicit_incremental_.
10181         (General_options::finalize): Check for uasge of --incremental-*
10182         without --incremental.
10183
10184 2009-02-06  Chris Demetriou  <cgd@google.com>
10185
10186         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10187         pointer and to report location as the file name associated with
10188         the symbol.
10189         (gold_undefined_symbol_at_location): New function to replace the
10190         old gold_undefined_symbol functionality.
10191         * target-reloc.h (relocate_section): Update to use
10192         gold_undefined_symbol_at_location.
10193         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10194         Call gold_undefined_symbol function rather than gold_error.
10195         * errors.h (Errors::undefined_symbol): Take location as a
10196         string, rather than calculating it from a relocation.
10197         * errors.cc (Errors::fatal): Print "fatal error:" before the
10198         formatted message.
10199         (Errors::error, Errors::error_at_location): Print "error: "
10200         before the formatted message.
10201         (Errors::undefined_symbol): Take location as a string, rather
10202         than calculating it from a relocation.
10203         (gold_undefined_symbol_at_location): New function akin to
10204         old gold_undefined_symbol, calculates location from relocation.
10205         (gold_undefined_symbol): Change to take only a Symbol pointer
10206         and to report location as the file name associated with the symbol.
10207         * testsuite/debug_msg.sh: Update for changed error messages.
10208         * testsuite/undef_symbol.sh: Likewise.
10209
10210 2009-02-04  Duncan Sands  <baldrick@free.fr>
10211
10212         PR 9812
10213         * reduced_debug_output.h
10214         (Output_reduced_debug_abbrev_section::failed): Use format for
10215         gold_warning.
10216         (Output_reduced_debug_info_section::faild): Likewise.
10217
10218 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10219
10220         * script.cc (Lazy_demangler): New class.
10221         (Version_script_info::get_symbol_version_helper): Demangle a
10222         symbol only once.
10223
10224 2009-01-29  Cary Coutant  <ccoutant@google.com>
10225
10226         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10227         to __tls_get_addr.
10228         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10229
10230 2009-01-28  Ian Lance Taylor  <iant@google.com>
10231
10232         * version.cc (version_string): Bump to 1.9.
10233
10234         * gold.h: Include <cstring> and <stdint.h>.
10235         * version.cc: Include <cstdio>.
10236         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10237         warning.
10238         * reduced_debug_output.cc (insert_into_vector): Rename from
10239         Insert_into_vector; change all callers.  Use Swap_unaligned to
10240         avoid aliasing issue; remove union since it is unnecessary.
10241
10242 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10243
10244         * Makefile.am (CCFILES): Add gc.cc.
10245         (HFILES): Add gc.h.
10246         * Makefile.in: Regenerate.
10247         * gold.cc (Gc_runner): New class.
10248         (queue_initial_tasks): Call garbage collection related tasks
10249         when corresponding options are invoked.
10250         (queue_middle_gc_tasks): New function.
10251         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10252         processed early before laying out sections during garbage collection.
10253         * gold.h (queue_middle_gc_tasks): New function.
10254         (is_prefix_of): Move from "layout.cc".
10255         * i386.cc (Target_i386::gc_process_relocs): New function.
10256         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10257         * main.cc (main): Create object of class "Garbage_collection".
10258         * object.cc (Relobj::copy_symbols_data): New function.
10259         (Relobj::is_section_name_included): New function.
10260         (Sized_relobj::do_layout): Allow this function to be called twice
10261         during garbage collection and defer layout of section during the
10262         first call.
10263         * object.h (Relobj::get_symbols_data): New function.
10264         (Relobj::is_section_name_included): New function.
10265         (Relobj::copy_symbols_data): New function.
10266         (Relobj::set_symbols_data): New function.
10267         (Relobj::get_relocs_data): New function.
10268         (Relobj::set_relocs_data): New function.
10269         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10270         (Relobj::gc_process_relocs): New function.
10271         (Relobj::do_gc_process_relocs): New pure virtual function.
10272         (Relobj::sd_): New data member.
10273         (Sized_relobj::is_output_section_offset_invalid): New function.
10274         (Sized_relobj::do_gc_process_relocs): New function.
10275         * options.h (General_options::gc_sections): Modify to not be a no-op.
10276         (General_options::print_gc_sections): New option.
10277         * plugin.cc (Plugin_finish::run): Remove function call to
10278         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10279         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10280         * reloc.cc (Read_relocs::run): Add task to process relocs and
10281         determine unreferenced sections when doing garbage collection.
10282         (Gc_process_relocs): New class.
10283         (Sized_relobj::do_gc_process_relocs): New function.
10284         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10285         sections that are garbage collected.
10286         * reloc.h (Gc_process_relocs): New class.
10287         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10288         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10289         symbols whose corresponding sections are garbage collected.
10290         (Symbol_table::Symbol_table): Add new parameter for the garbage
10291         collection object.
10292         (Symbol_table::gc_mark_undef_symbols): New function.
10293         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10294         (Symbol_table::gc_mark_dyn_syms): New function.
10295         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10296         as garbage.
10297         (Symbol_table::add_from_object): Likewise.
10298         (Symbol_table::add_from_relobj): When building shared objects, do not
10299         treat externally visible symbols as garbage.
10300         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10301         table information for static and relocatable links.
10302         * symtab.h (Symbol_table::set_gc): New function.
10303         (Symbol_table::gc): New function.
10304         (Symbol_table::gc_mark_undef_symbols): New function.
10305         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10306         (Symbol_table::gc_mark_dyn_syms): New function.
10307         (Symbol_table::gc_): New data member.
10308         * target.h (Sized_target::gc_process_relocs): New pure virtual
10309         function.
10310         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10311         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10312
10313 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10314
10315         * options.h (General_options::gc_sections): Define as a no-op for now.
10316         (General_options::no_keep_memory): Ditto.
10317         (General_options::Bshareable): Define.
10318         * options.cc (General_options::finalize): Honor -Bshareable.
10319
10320 2009-01-20  Andreas Schwab  <schwab@suse.de>
10321
10322         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10323         read the value in the contents, since we don't use it.  Use the
10324         template endianness when writing.
10325         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10326
10327 2009-01-19  Andreas Schwab  <schwab@suse.de>
10328
10329         * configure.tgt (powerpc64-*): Fix targ_obj.
10330
10331 2009-01-15  Ian Lance Taylor  <iant@google.com>
10332
10333         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10334         local symbols when stripping all symbols.
10335
10336 2009-01-14  Cary Coutant  <ccoutant@google.com>
10337
10338         * output.cc (Output_reloc): Add explicit instantiations.
10339
10340 2009-01-14  Cary Coutant  <ccoutant@google.com>
10341
10342         * archive.cc (Archive::get_elf_object_for_member): Remove call
10343         to File_read::claim_for_plugin.
10344         * descriptors.cc (Descriptors::open): Remove reference to
10345         is_claimed.
10346         (Descriptors::claim_for_plugin): Remove.
10347         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10348         (Descriptors::is_claimed): Remove.
10349         (claim_descriptor_for_plugin): Remove.
10350         * fileread.cc (File_read::claim_for_plugin): Remove.
10351         * fileread.h (File_read::claim_for_plugin): Remove.
10352         (File_read::descriptor): Reopen descriptor if necessary.
10353         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10354         (Plugin_manager::all_symbols_read): Add task parameter. Change
10355         all callers.
10356         (Plugin_manager::get_input_file): New function.
10357         (Plugin_manager::release_input_file): New function.
10358         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10359         corresponding data member.
10360         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10361         and pass to base constructor. Change all callers.
10362         (get_input_file, release_input_file): New functions.
10363         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10364         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10365         (Plugin_manager::all_symbols_read): Add task parameter.
10366         (Plugin_manager::get_input_file): New function.
10367         (Plugin_manager::release_input_file): New function.
10368         (Plugin_manager::task_): New data member.
10369         (Pluginobj::Pluginobj): Add filesize parameter.
10370         (Pluginobj::filename): New function.
10371         (Pluginobj::descriptor): New function.
10372         (Pluginobj::filesize): New function.
10373         (Pluginobj::filesize_): New data member.
10374         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10375         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10376         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10377
10378         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10379         with archive libraries.
10380         * testsuite/Makefile.in: Regenerate.
10381         * testsuite/plugin_test.c (struct sym_info): New type.
10382         (get_input_file, release_input_file): New static variables.
10383         (onload): Capture new transfer vector entries.
10384         (claim_file_hook): Stop reading at end of file according to filesize.
10385         Factor out parsing of readelf output into separate function.
10386         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10387         APIs and get the source file name from the symbol table.  Convert
10388         source file name to corresponding object file name.  Print info
10389         message when adding new input files.
10390         (parse_readelf_line): New function.
10391         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10392         * testsuite/plugin_test_2.sh: Likewise.
10393         * testsuite/plugin_test_3.sh: Likewise.
10394         * testsuite/plugin_test_4.sh: New test case.
10395
10396 2009-01-07  Ian Lance Taylor  <iant@google.com>
10397
10398         * version.cc (version_string): Bump to 1.8.
10399
10400 2008-12-23  Cary Coutant  <ccoutant@google.com>
10401
10402         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10403         * plugin.cc (Plugin_manager::finish): Rename as
10404         layout_deferred_objects.  Move cleanup to separate function.
10405         (Plugin_manager::cleanup): New function.
10406         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10407         separately.
10408         * plugin.h (Plugin_manager::finish): Rename as
10409         layout_deferred_objects.
10410         (Plugin_manager::cleanup): New function.
10411         (Plugin_manager::cleanup_done): New field.
10412
10413 2008-12-23  Cary Coutant  <ccoutant@google.com>
10414
10415         * plugin.cc (is_visible_from_outside): New function.
10416         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10417         so we don't return "IR only" status for exported symbols or -r links.
10418
10419         * testsuite/Makefile.am (plugin_test_3): New test case.
10420         * testsuite/Makefile.in: Regenerate.
10421         * testsuite/plugin_test_3.sh: New file.
10422
10423 2008-12-22  Cary Coutant  <ccoutant@google.com>
10424
10425         * object.cc (Sized_relobj::layout_section): New function.
10426         (Sized_relobj::do_layout): Defer layout of input sections until after
10427         plugin has provided replacement files.
10428         (Sized_relobj::do_layout_deferred_sections): New function.
10429         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10430         (Relobj::layout_deferred_sections): New function.
10431         (Relobj::do_layout_deferred_sections): New function.
10432         (Sized_relobj::do_layout_deferred_sections): New function.
10433         (Sized_relobj::layout_section): New function.
10434         (Sized_relobj::Deferred_layout): New structure.
10435         (Sized_relobj::deferred_layout_): New field.
10436         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10437         Change all callers.  Layout deferred sections.
10438         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10439         references.
10440         (Plugin_hook::run): Move code from do_plugin_hook inline.
10441         (Plugin_hook::do_plugin_hook): Remove.
10442         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10443         (Plugin_manager::finish): Renamed, was cleanup.
10444         (Plugin_manager::should_defer_layout): New function.
10445         (Plugin_manager::add_deferred_layout_object): New function.
10446         (Plugin_manager::Deferred_layout_list): New type.
10447         (Plugin_manager::deferred_layout_objects_): New field.
10448         (Plugin_hook::do_plugin_hook): Remove.
10449
10450 2008-12-17  Ian Lance Taylor  <iant@google.com>
10451
10452         * options.h (class General_options): Add --no case for
10453         --export-dynamic.
10454
10455 2008-12-16  Cary Coutant  <ccoutant@google.com>
10456
10457         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10458         vector.
10459         (Plugin_manager::claim_file): Create plugin object even if
10460         plugin did not call the add_symbols callback.
10461         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10462         asking for more symbols than were added.
10463         * testsuite/Makefile.am (plugin_test_1): Add test case with
10464         no global symbols.
10465         (empty.syms): New target.
10466         * testsuite/Makefile.in: Regenerate.
10467         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10468         message. Don't call add_symbols if no globals.
10469         (all_symbols_read_hook): Don't provide replacement for empty
10470         claimed file.
10471
10472 2008-12-12  Ian Lance Taylor  <iant@google.com>
10473
10474         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10475         r_type == 0 for a local symbol with r_sym == 0.
10476         (scan_relocatable_relocs): Pass r_sym to
10477         local_non_section_strategy.
10478         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10479         r_sym parameter.
10480
10481         * configure.ac: Update test for TLS descriptors: they are
10482         supported as of glibc 2.9.
10483         * configure: Rebuild.
10484
10485 2008-12-11  Ian Lance Taylor  <iant@google.com>
10486
10487         PR 7091
10488         * target-reloc.h (Default_scan_relocatable_relocs): For each
10489         function, map r_type == 0 to RELOC_DISCARD.
10490
10491 2008-12-10  Cary Coutant  <ccoutant@google.com>
10492
10493         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10494         object to override a kept COMDAT group from a plugin object.
10495
10496 2008-12-09  Ian Lance Taylor  <iant@google.com>
10497
10498         PR 7088
10499         * yyscript.y (file_cmd): Handle INPUT.
10500
10501         * testsuite/initpri1.c: Change all declarations to be full
10502         prototypes by adding void, to avoid compiler warnings.
10503
10504 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10505
10506         * options.cc (General_options::parse_plugin_opt): New.
10507         (General_options::add_plugin): The argument now is just the filename.
10508         (General_options::add_plugin_option): New.
10509         * options.h (plugin_opt): New.
10510         (add_plugin): Change argument name.
10511         (add_plugin_option): New.
10512         * plugin.cc (Plugin::load): Don't parse the plugin option.
10513         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10514         (Plugin::add_option): New.
10515         (Plugin::args_): Change type.
10516         (Plugin::filename_): New.
10517         (Plugin_manager::add_plugin_option): New.
10518         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10519         * testsuite/Makefile.in: Regenerate.
10520
10521 2008-12-05  Cary Coutant  <ccoutant@google.com>
10522
10523         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10524         Handle --strip-lto-sections option.
10525         * options.h (strip_lto_sections): New option.
10526
10527 2008-12-01  Cary Coutant  <ccoutant@google.com>
10528
10529         * plugin.cc (ld_plugin_message): Change format parameter to const.
10530         Fix mismatch between new[] and delete.
10531
10532 2008-11-14  Cary Coutant  <ccoutant@google.com>
10533
10534         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10535         instead of -1U.
10536
10537 2008-11-05  Craig Silverstein  <csilvers@google.com>
10538
10539         * options.cc (General_options::parse_dynamic_list): New function.
10540         * options.h (General_options): New flags dynamic_list,
10541         dynamic_list_data, dynamic_list_cpp_new, and
10542         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10543         (General_options::in_dynamic_list): New function.
10544         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10545         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10546         (Lex::can_continue_name): Likewise.
10547         (yylex): Likewise.
10548         (read_script_file): New parameter script_options.
10549         (read_dynamic_list): New function.
10550         (Script_options::define_dynamic_list): New function.
10551         (dynamic_list_keyword_parsecodes): New variable.
10552         (dynamic_list_keywords): New variable.
10553         * script.h (Script_options::define_dynamic_list): New function
10554         prototype.
10555         (read_dynamic_list): New function prototype.
10556         * symtab.cc (strprefix): New macro.
10557         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10558         dynamic_list_data, dynamic_list_cpp_new, and
10559         dynamic_list_cpp_typeinfo.
10560         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10561         (dynamic_list_expr): New rule.
10562         (dynamic_list_nodes): Likewise.
10563         (dynamic_list_node): Likewise.
10564         * testsuite/Makefile.am (dynamic_list): New test.
10565         * testsuite/Makefile.in: Regenerated.
10566         * testsuite/dynamic_list.t: New file.
10567         * testsuite/dynamic_list.sh: New file.
10568
10569 2008-11-05  Craig Silverstein  <csilvers@google.com>
10570
10571         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10572         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10573         (t11_last): Likewise.
10574         * testsuite/ver_test_6.c (main): Likewise.
10575
10576 2008-10-07  Cary Coutant  <ccoutant@google.com>
10577
10578         * options.c (General_options::finalize): Add check for -static and
10579         -shared.
10580         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10581         is not empty.
10582
10583 2008-10-02  Cary Coutant  <ccoutant@google.com>
10584
10585         * plugin.cc (make_sized_plugin_object): Fix conditional
10586         compilation to work when not all targets are enabled.
10587
10588 2008-09-29  Cary Coutant  <ccoutant@google.com>
10589
10590         * archive.cc (Archive::get_file_and_offset): Use filename instead
10591         of name to get library path.
10592         (Archive::include_member): Unlock external member of a thin archive.
10593
10594         * testsuite/Makefile.am (TEST_AR): New variable.
10595         (thin_archive_test_1): New test.
10596         (thin_archive_test_2): New test.
10597         * testsuite/Makefile.in: Regenerate.
10598         * testsuite/thin_archive_main.cc: New file.
10599         * testsuite/thin_archive_test_1.cc: New file.
10600         * testsuite/thin_archive_test_2.cc: New file.
10601         * testsuite/thin_archive_test_3.cc: New file.
10602         * testsuite/thin_archive_test_4.cc: New file.
10603
10604 2008-09-29  Cary Coutant  <ccoutant@google.com>
10605
10606         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10607         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10608         instead of -1U.
10609         (Sized_relobj::do_finalize_local_symbols): Likewise.
10610         (Sized_relobj::map_to_kept_section): Likewise.
10611         * object.h (Sized_relobj::invalid_address): New constant.
10612         (Sized_relobj::do_output_section_offset): Check for invalid_address
10613         and return -1ULL.
10614         * output.cc (Output_reloc::local_section_offset): Use constant
10615         invalid_address instead of -1U.
10616         (Output_reloc::get_address): Likewise.
10617         (Output_section::output_address): Change -1U to -1ULL.
10618         * output.h (Output_reloc::invalid_address): New constant.
10619         * reloc.cc (Sized_relobj::write_sections): Use constant
10620         invalid_address instead of -1U.
10621         (Sized_relobj::relocate_sections): Likewise.
10622         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10623         values for merge sections.
10624         * target-reloc.h (relocate_for_relocatable): Use constant
10625         invalid_address instead of -1U.
10626
10627 2008-09-19  Cary Coutant  <ccoutant@google.com>
10628
10629         Add plugin functionality for link-time optimization (LTO).
10630         * configure.ac (plugins): Add --enable-plugins option.
10631         * configure: Regenerate.
10632         * config.in: Regenerate.
10633         * Makefile.am (LIBDL): New variable.
10634         (CCFILES): Add plugin.cc.
10635         (HFILES): Add plugin.h.
10636         (ldadd_var): Add LIBDL.
10637         * Makefile.in: Regenerate.
10638
10639         * archive.cc: Include "plugin.h".
10640         (Archive::setup): Don't preread archive symbols when using a plugin.
10641         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10642         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10643         files.
10644         (Archive::include_member): Add symbols from plugin objects.
10645         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10646         * descriptors.cc (Descriptors::open): Check for file descriptors
10647         abandoned by plugins.
10648         (Descriptors::claim_for_plugin): New function.
10649         * descriptors.h (Descriptors::claim_for_plugin): New function.
10650         (Open_descriptor::is_claimed): New field.
10651         (claim_descriptor_for_plugin): New function.
10652         * fileread.cc (File_read::claim_for_plugin): New function.
10653         * fileread.h (File_read::claim_for_plugin): New function.
10654         (File_read::descriptor): New function.
10655         * gold.cc: Include "plugin.h".
10656         (queue_initial_tasks): Add task to call plugin hooks for generating
10657         new object files.
10658         * main.cc: Include "plugin.h".
10659         (main): Load plugin libraries.
10660         * object.h (Pluginobj): Declare.
10661         (Object::pluginobj): New function.
10662         (Object::do_pluginobj): New function.
10663         (Object::set_target): New function.
10664         * options.cc: Include "plugin.h".
10665         (General_options::parse_plugin): New function.
10666         (General_options::General_options): Initialize plugins_ field.
10667         (General_options::add_plugin): New function.
10668         * options.h (Plugin_manager): Declare.
10669         (General_options): Add --plugin option.
10670         (General_options::has_plugins): New function.
10671         (General_options::plugins): New function.
10672         (General_options::add_plugin): New function.
10673         (General_options::plugins_): New field.
10674         * plugin.cc: New file.
10675         * plugin.h: New file.
10676         * readsyms.cc: Include "plugin.h".
10677         (Read_symbols::do_read_symbols): Check for archive before checking
10678         for ELF file.  Call plugin hooks to claim files.
10679         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10680         from a real object file; force override when processing replacement
10681         files.
10682         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10683         (Symbol::init_base_object): Likewise.
10684         (Symbol::init_base_output_data): Likewise.
10685         (Symbol::init_base_output_segment): Likewise.
10686         (Symbol::init_base_constant): Likewise.
10687         (Symbol::init_base_undefined): Likewise.
10688         (Symbol::output_section): Assert that object is not a plugin.
10689         (Symbol_table::add_from_pluginobj): New function.
10690         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10691         undefined.
10692         (Symbol_table::sized_write_globals): Likewise.
10693         (Symbol_table::add_from_pluginobj): Instantiate template.
10694         * symtab.h (Sized_pluginobj): Declare.
10695         (Symbol::in_real_elf): New function.
10696         (Symbol::set_in_real_elf): New function.
10697         (Symbol::in_real_elf_): New field.
10698         (Symbol_table::add_from_pluginobj): New function.
10699
10700         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10701         (LIBDL): New variable.
10702         (LDADD): Add LIBDL.
10703         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10704         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10705         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10706         (MOSTLYCLEANFILES): Likewise.
10707         * testsuite/Makefile.in: Regenerate.
10708         * testsuite/plugin_test.c: New file.
10709         * testsuite/plugin_test_1.sh: New file.
10710         * testsuite/plugin_test_2.sh: New file.
10711
10712 2008-09-16  Ian Lance Taylor  <iant@google.com>
10713
10714         * target-reloc.h (relocate_section): Check whether a symbol is
10715         defined by the ABI before reporting an undefined symbol error.
10716         * target.h (Target::is_defined_by_abi): Make parameter const.
10717         (Target::do_is_defined_by_abi): Likewise.
10718         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10719         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10720         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10721         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10722         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10723         * testsuite/Makefile.in: Rebuild.
10724
10725         * fileread.cc (make_view): Add casts to avoid warning.
10726
10727 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10728
10729         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10730         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10731
10732 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10733
10734         * options.h (General_options::output_is_executable): New.
10735         (General_options::output_is_pie): New.
10736         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10737         for shared libraries.
10738         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10739
10740 2008-09-11  Chris Demetriou  <cgd@google.com>
10741
10742         * options.h (origin): New -z option.
10743         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10744         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10745         in DT_FLAGS_1.
10746
10747 2008-09-05  Cary Coutant  <ccoutant@google.com>
10748
10749         * fileread.cc (File_read::make_view): Add check for attempt to map
10750         beyond end of file.
10751
10752 2008-09-05  Cary Coutant  <ccoutant@google.com>
10753
10754         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10755         explicit instantiations.
10756
10757 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10758
10759         PR gold/6858
10760         * options.cc (General_options::finalize): Allow undefined symbols
10761         in shlibs if linking -shared.
10762
10763         PR gold/6859
10764         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10765         symbols as not needing a dynsym entry.
10766
10767 2008-08-20  Craig Silverstein  <csilvers@google.com>
10768
10769         * fileread.cc (File_read::open): Do not lock the file unless it
10770         was successfully opened.
10771
10772 2008-08-14  Cary Coutant  <ccoutant@google.com>
10773
10774         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10775         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10776         * testsuite/tls_test.cc (struct int128): 128-bit struct
10777         for testing TLS relocs with non-zero addend.
10778         (v12): New TLS variable.
10779         (t12): New test.
10780         (t_last): Add check for v12.
10781         * testsuite/tls_test.h (t12): New function.
10782         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10783
10784 2008-08-13  Ian Lance Taylor  <iant@google.com>
10785
10786         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10787         set tls_segment_ or relro_segment_.
10788         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10789         when appropriate.
10790         * output.h (Output_section::clear_is_relro): New function.
10791         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10792         sections specially even when output_data_ is empty.
10793         (Output_segment::maximum_alignment): When first section is relro,
10794         only force alignment for PT_LOAD segments.
10795         * script.cc (script_data_segment_align): New function.
10796         (script_data_segment_relro_end): New function.
10797         * script-c.h (script_data_segment_align): Declare.
10798         (script_data_segment_relro_end): Declare.
10799         * script-sections.h (class Script_sections): Declare
10800         data_segment_align and data_segment_relro_end.  Add fields
10801         segment_align_index_ and saw_relro_end_.
10802         * script-sections.cc (class Sections_element): Add set_is_relro
10803         virtual function.  Add new bool* parameter to place_orphan_here.
10804         Add get_output_section virtual function.
10805         (class Output_section_definition): Add set_is_relro.  Add new
10806         bool* parameter to place_orphan_here.  Add get_output_section.
10807         Add is_relro_ field.
10808         (Output_section_definition::Output_section_definition): Initialize
10809         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10810         and is_relro_ fields.
10811         (Output_section_definition::place_orphan_here): Add is_relro
10812         parameter.
10813         (Output_section_definition::set_section_addresses): Set relro for
10814         output section.
10815         (Output_section_definition::alternate_constraint): Likewise.
10816         (class Orphan_output_section): Add new bool* parameter to
10817         place_orphan_here.  Add get_output_section.
10818         (Orphan_output_section::place_orphan_here): Add is_relro
10819         parameter.
10820         (Script_sections::Script_sections): Initialize
10821         data_segment_align_index_ and saw_relro_end_.
10822         (Script_sections::data_segment_align): New function.
10823         (Script_sections::data_segment_relro_end): New function.
10824         (Script_sections::place_orphan): Set or clear is_relro.
10825         (Script_sections::set_section_addresses): Force alignment of first
10826         TLS section.
10827         * yyscript.y (exp): Call script_data_segment_align and
10828         script_data_segment_relro_end.
10829         * testsuite/relro_script_test.t: New file.
10830         * testsuite/relro_test.cc (using_script): Declare.
10831         (t1, t2): Test using_script.
10832         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10833         (relro_script_test_SOURCES): Define.
10834         (relro_script_test_DEPENDENCIES): Define.
10835         (relro_script_test_LDFLAGS): Define.
10836         (relro_script_test_LDADD): Define.
10837         (relro_script_test.so): New target.
10838         * testsuite/Makefile.in: Rebuild.
10839
10840 2008-08-06  Cary Coutant <ccoutant@google.com>
10841
10842         * archive.cc (Archive::total_archives, Archive::total_members)
10843         (Archive::total_members_loaded): New variables.
10844         (Archive::setup): Add parameter.  Add option to preread
10845         archive symbols.
10846         (Archive::read_armap): Add counter.
10847         (Archive::get_file_and_offset): New function.
10848         (Archive::get_elf_object_for_member): New function.
10849         (Archive::read_all_symbols): New function.
10850         (Archive::read_symbols): New function.
10851         (Archive::add_symbols): Add counters.
10852         (Archive::include_all_members): Use armap to find members if it's
10853         already built.
10854         (Archive::include_member): Skip reading symbols if already read.
10855         Factored code into Archive::get_file_and_offset and
10856         Archive::get_elf_object_for_member.  Changed call to
10857         Mapfile::report_include_archive_member.
10858         (Archive::print_stats): New function.
10859         * archive.h: Declare Object and Read_symbols_data classes.
10860         (Archive::Archive): Add initializers for new members.
10861         (Archive::setup): Add parameter.
10862         (Archive::print_stats): New function.
10863         (Archive::total_archives, Archive::total_members)
10864         (Archive::total_members_loaded): New variables.
10865         (Archive::get_file_and_offset): New function.
10866         (Archive::get_elf_object_for_member): New function.
10867         (Archive::read_all_symbols): New function.
10868         (Archive::read_symbols): New function.
10869         (Archive::Archive_member): New class.
10870         (Archive::members_): New member.
10871         (Archive::num_members_): New member.
10872         * main.cc: Include archive.h.
10873         (main): Call Archive::print_stats.
10874         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10875         archive parameter; member_name is now the fully-decorated name.
10876         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10877         * options.h: (General_options): Add --preread-archive-symbols option.
10878         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10879         Archive::setup.
10880
10881 2008-08-04  Ian Lance Taylor  <iant@google.com>
10882
10883         * symtab.h (Symbol::use_plt_offset): New function.
10884         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10885         * powerpc.cc (Relocate::relocate): Likewise.
10886         * sparc.cc (Relocate::relocate): Likewise.
10887         * x86_64.cc (Relocate::relocate): Likewise.
10888         * testsuite/weak_plt.sh: New test.
10889         * testsuite/weak_plt_main.cc: New test.
10890         * testsuite/weak_plt_shared.cc: New test.
10891         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10892         (check_PROGRAMS): Add weak_plt.
10893         (check_DATA): Add weak_plt_shared.so.
10894         (weak_plt_main_pic.o, weak_plt): New targets.
10895         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10896         * testsuite/Makefile.in: Rebuild.
10897
10898         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10899         gcctestdir/ld.
10900         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10901         * testsuite/Makefile.in: Rebuild.
10902
10903 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10904
10905         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10906         * Makefile.in: Regenerate.
10907         * po/POTFILES.in: Regenerate.
10908
10909 2008-07-29  Ian Lance Taylor  <iant@google.com>
10910
10911         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10912         symbols before other symbols.
10913         * testsuite/script_test_2.cc (test_addr): Declare.
10914         (test_addr_alias): Declare.
10915         (main): Check that test_addr and test_addr_alias have the right
10916         values.
10917         * testsuite/script_test_2.t: Define test_addr_alias and
10918         test_addr.
10919
10920 2008-07-24  Ian Lance Taylor  <iant@google.com>
10921
10922         PR 5990
10923         * descriptors.cc: New file.
10924         * descriptors.h: New file.
10925         * gold-threads.h (class Hold_optional_lock): New class.
10926         * fileread.cc: Include "descriptors.h".
10927         (File_read::~File_read): Release descriptor rather than closing
10928         it.
10929         (File_read::open) [file]: Call open_descriptor rather than open.
10930         Set is_descriptor_opened_.
10931         (File_read::open) [memory]: Assert that descriptor is not open.
10932         (File_read::reopen_descriptor): New function.
10933         (File_read::release): Release descriptor.
10934         (File_read::do_read): Make non-const.  Reopen descriptor.
10935         (File_read::read): Make non-const.
10936         (File_read::make_view): Reopen descriptor.
10937         (File_read::do_readv): Likewise.
10938         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10939         Update declarations.
10940         * layout.cc: Include "descriptors.h".
10941         (Layout::create_build_id): Use open_descriptor rather than open.
10942         * output.cc: Include "descriptors.h".
10943         (Output_file::open): Use open_descriptor rather than open.
10944         * archive.cc (Archive::const_iterator): Change Archive to be
10945         non-const.
10946         (Archive::begin, Archive::end): Make non-const.
10947         (Archive::count_members): Likewise.
10948         * archive.h (class Archive): Update declarations.
10949         * object.h (Object::read): Make non-const.
10950         * Makefile.am (CCFILES): Add descriptors.cc.
10951         (HFILES): Add descriptors.h.
10952         * Makefile.in: Rebuild.
10953
10954         PR 6716
10955         * gold.h: Always include <clocale>.  Add Solaris workarounds
10956         following code in binutils/sysdep.h.
10957
10958         PR 6048
10959         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10960         this->eh_frame_hdr_ is NULL before using it.
10961
10962         * dynobj.cc (Versions::Versions): Update comment.
10963
10964         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10965         the base version name.
10966
10967         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10968         array size plus one.
10969         (Stringpool_template::set_string_offsets): Subtract one from key
10970         before using it as an array index.
10971         (Stringpool_template::get_offset_with_length): Likewise.
10972         (Stringpool_template::write_to_buffer): Likewise.
10973         * stringpool.h (Stringpool_template::get_offset_from_key):
10974         Likewise.
10975
10976 2008-07-23  Ian Lance Taylor  <iant@google.com>
10977
10978         PR 6658
10979         * object.h (Merged_symbol_value::value): Do our best to handle a
10980         negative addend.
10981
10982         PR 6647
10983         * script.cc (Version_script_info::get_versions): Don't add empty
10984         version tag to return value.
10985         (Version_script_info::get_symbol_version_helper): Change return
10986         type to bool.  Add pversion parameter.  Change all callers.
10987         (script_register_vers_node): Don't require a non-NULL tag.
10988         * script.h (class Version_script_info): Update declarations.
10989         (Version_script_info::get_symbol_version): Change return type to
10990         bool.  Add version parameter.  Change all callers.
10991         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10992         handling.  Handle an empty version from a version script.
10993         (Symbol_table::define_special_symbol): Likewise.
10994         * testsuite/ver_test_10.script: New file.
10995         * testsuite/ver_test_10.sh: New file.
10996         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10997         (check_DATA): Add ver_test_10.syms.
10998         (ver_test_10.syms, ver_test_10.so): New target.
10999         * testsuite/Makefile.in: Rebuild.
11000
11001 2008-07-23  Simon Baldwin  <simonb@google.com>
11002
11003         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11004         to zero for undefined symbols from dynamic libraries.
11005
11006 2008-07-23  Ian Lance Taylor  <iant@google.com>
11007
11008         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11009         Change all callers.
11010         * symtab.h (class Symbol_table): Update declaration.
11011         * testsuite/ver_test_9.cc: New file.
11012         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11013         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11014         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11015         (ver_test_9.so, ver_test_9.o): New targets.
11016         * testsuite/Makefile.in: Rebuild.
11017
11018 2008-07-22  Ian Lance Taylor  <iant@google.com>
11019
11020         * options.h (class General_options): Define --check-sections.
11021         * layout.cc (Layout::set_segment_offsets): Handle
11022         --check-sections.
11023
11024         * options.h (class General_options): Define -n/--nmagic and
11025         -N/--omagic.
11026         * options.cc (General_options::finalize): For -n/--nmagic or
11027         -N/--omagic, set -static.
11028         * layout.cc (Layout::attach_allocated_section_to_segment): If
11029         -N/--omagic, don't put read-only and read-write sections in
11030         different segments.
11031         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11032         finding a read-only segment.
11033         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11034         don't set the minimum segment alignment to the common page size,
11035         and don't set the file offset to the address modulo the page size.
11036         * script-sections.cc (Script_sections::create_segments): If
11037         -n/--omagic, don't put read-only and read-write sections in
11038         different segments.
11039
11040         * cref.cc: New file.
11041         * cref.h: New file.
11042         * options.h (class General_options): Add --print-symbol-counts.
11043         * main.cc (main): Issue defined symbol report if requested.
11044         * archive.cc (Archive::interpret_header): Make into a const member
11045         function.
11046         (Archive::add_symbols): Call Input_objects::archive_start and
11047         archive_stop.
11048         (Archive::const_iterator): Define new class.
11049         (Archive::begin, Archive::end): New functions.
11050         (Archive::include_all_members): Rewrite to use iterator.
11051         (Archive::count_members): New function.
11052         * archive.h (class Archive): Update declarations.
11053         (Archive::filename): New function.
11054         * object.cc: Include "cref.h".
11055         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11056         (Sized_relobj::do_get_global_symbol_counts): New function.
11057         (Input_objects::add_object): Add object to cross-referencer.
11058         (Input_objects::archive_start): New function.
11059         (Input_objects::archive_stop): New function.
11060         (Input_objects::print_symbol_counts): New function.
11061         * object.h: Declare Cref and Archive.
11062         (Object::get_global_symbol_counts): New function.
11063         (Object::do_get_global_symbol_counts): New pure virtual function.
11064         (class Sized_relobj): Add defined_count_ field.  Update
11065         declarations.
11066         (class Input_objects): Add cref_ field.  Update constructor.
11067         Update declarations.
11068         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11069         defined_count_.
11070         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11071         symbol counts.
11072         (Sized_dynobj::do_get_global_symbol_counts): New function.
11073         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11074         defined_count_.  Update declarations.  Define Symbols typedef.
11075         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11076         parameter.  Change all callers.
11077         (Symbol_table::add_from_dynobj): Add sympointers and defined
11078         parameters.  Change all callers.
11079         * symtab.h (class Symbol_table): Update declarations.
11080         * Makefile.am (CCFILES): Add cref.cc.
11081         (HFILES): Add cref.h.
11082         * Makefile.in: Rebuild.
11083
11084 2008-07-22  Simon Baldwin  <simonb@google.com>
11085
11086         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11087         to zero when writing undefined symbols.
11088
11089 2008-07-22  Ian Lance Taylor  <iant@google.com>
11090
11091         * output.cc (Output_section::add_input_section): Don't try to
11092         merge empty merge sections.
11093
11094 2008-07-21  Craig Silverstein  <csilvers@google.com>
11095
11096         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11097         Include symbol version in error message.
11098
11099 2008-07-20  Chris Demetriou  <cgd@google.com>
11100
11101         * configure.ac (gold_cv_c_random_seed): New configured variable.
11102         (RANDOM_SEED_CFLAGS): New substituted variable.
11103         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11104         * configure: Rebuild.
11105         * Makefile.in: Likewise.
11106         * testsuite/Makefile.in: Likewise.
11107
11108 2008-07-18  Ian Lance Taylor  <iant@google.com>
11109
11110         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11111         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11112         * testsuite/ver_test_main.cc (main): Call t4.
11113         (t4, t4_2a): Define.
11114         * testsuite/ver_test_2.cc (t4_2): Define.
11115         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11116         * testsuite/ver_test_4.cc (t4_2a): Define.
11117         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11118         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11119
11120 2008-07-17  Ian Lance Taylor  <iant@google.com>
11121
11122         * dynobj.cc (Versions::add_def): If we give an error about a
11123         missing version, go ahead and create the version anyhow.
11124
11125 2008-07-10  Ian Lance Taylor  <iant@google.com>
11126
11127         Handle output sections with more than 0x7fffffff bytes.
11128         * object.h (class Relobj): Change map_to_output_ to
11129         output_sections_, and just keep a section pointer.  Change all
11130         uses.  Move comdat group support to Sized_relobj.
11131         (Relobj::is_section_specially_mapped): Remove.
11132         (Relobj::output_section): Remove poff parameter.  Change all
11133         callers.
11134         (Relobj::output_section_offset): New function.
11135         (Relobj::set_section_offset): Rewrite.
11136         (Relobj::map_to_output): Remove.
11137         (Relobj::output_sections): New function.
11138         (Relobj::do_output_section_offset): New pure virtual function.
11139         (Relobj::do_set_section_offset): Likewise.
11140         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11141         group support from Relobj.  Update declarations.
11142         (Sized_relobj::get_output_section_offset): New function.
11143         (Sized_relobj::do_output_section_offset): New function.
11144         (Sized_relobj::do_set_section_offset): New function.
11145         * object.cc (Relobj::output_section_address): Remove.
11146         (Sized_relobj::Sized_relobj): Initialize new fields.
11147         (Sized_relobj::include_section_group): Cast find_kept_object to
11148         Sized_relobj.
11149         (Sized_relobj::include_linkonce_section): Likewise.
11150         (Sized_relobj::do_layout): Use separate arrays for output section
11151         and output offset.
11152         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11153         output_sections.
11154         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11155         output_sections and section_offsets.
11156         (Sized_relobj::write_local_symbols): Likewise.
11157         (map_to_kept_section): Compute output address directly.
11158         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11159         output_sections and section_offsets.
11160         (Sized_relobj::write_sections): Likewise.
11161         (Sized_relobj::relocate_sections): Likewise.
11162         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11163         * output.h (class Output_reloc): Update declarations.  Change
11164         u2_.relobj to Sized_relobj*.
11165         (class Output_data_reloc): Change add functions to use
11166         Sized_relobj*.
11167         * output.cc (Output_reloc::Output_reloc): Change relobj to
11168         Sized_relobj*.
11169         (Output_reloc::local_section_offset): Change return type to
11170         Elf_Addr.  Use get_output_section_offset.
11171         (Output_reloc::get_address): Likewise.
11172         (Output_section::is_input_address_mapped): Don't call
11173         is_section_specially_mapped.
11174         (Output_section::output_offset): Likewise.
11175         (Output_section::output_address): Likewise.
11176         (Output_section::starting_output_address): Likewise.
11177         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11178         parameter to Sized_relobj*.
11179         (Copy_relocs::need_copy_reloc): Likewise.
11180         (Copy_relocs::save): Likewise.
11181         * copy-relocs.h (class Copy_relocs): Update declarations.
11182         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11183         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11184         * target-reloc.h (relocate_for_relocatable): Change
11185         offset_in_output_section type to Elf_Addr.  Change code that uses
11186         it as well.
11187         * layout.cc (Layout::layout): Always set *off.
11188         * mapfile.cc (Mapfile::print_input_section): Use
11189         output_section_offset.
11190         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11191         Sized_relobj*.
11192         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11193         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11194         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11195
11196 2008-07-03  Ian Lance Taylor  <iant@google.com>
11197
11198         * layout.cc (Layout::include_section): Do not discard unrecognized
11199         SHT_STRTAB sections.
11200
11201 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11202
11203         * script.cc (Lex::can_continue_name): Make '?' allowable in
11204         version-script names.
11205         * testsuite/version_script.map: Change glob pattern to use '?'
11206
11207 2008-06-30  Manish Singh  <yosh@gimp.org>
11208
11209         PR 6585
11210         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11211         Correct typo.
11212
11213 2008-06-30  Ian Lance Taylor  <iant@google.com>
11214
11215         PR 6660
11216         PR 6682
11217         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11218         versions]: Don't try to read the value in the contents, since we
11219         don't use it.  Use the template endianness when writing.
11220
11221 2008-06-25  Cary Coutant  <ccoutant@google.com>
11222
11223         * fileread.cc (File_read::make_view): Assert on zero-length view.
11224         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11225         symbol table when there are no symbols to read.
11226
11227 2008-06-23  Craig Silverstein  <csilvers@google.com>
11228
11229         * version.cc (version_string): Bump to 1.7
11230
11231 2008-06-18  Craig Silverstein  <csilvers@google.com>
11232
11233         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11234         constant 0xFFFF to type Valtype.
11235         (Powerpc_relocate_functions::rel16_ha): Likewise.
11236
11237 2008-06-17  Ian Lance Taylor  <iant@google.com>
11238
11239         * output.h (Output_section::Input_section): Initialize p2align_ to
11240         zero for Output_section_data constructors.
11241         (Output_section::Input_section::addralign): If not an input
11242         section, return the alignment of the Output_section_data.
11243         * testsuite/copy_test.cc: New file.
11244         * testsuite/copy_test_1.cc: New file.
11245         * testsuite/copy_test_2.cc: New file.
11246         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11247         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11248         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11249         (copy_test_1_pic.o, copy_test_1.so): New targets.
11250         (copy_test_2_pic.o, copy_test_2.so): New targets.
11251         * testsuite/Makefile.in: Rebuild.
11252
11253         * script-sections.cc (Script_sections::place_orphan): Initialize
11254         local variable exact.
11255
11256 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11257
11258         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11259
11260 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11261             David S. Miller  <davem@davemloft.net>
11262
11263         * powerpc.cc: New file.
11264         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11265         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11266         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11267         * Makefile.in: Rebuild.
11268
11269 2008-06-09  Ian Lance Taylor  <iant@google.com>
11270
11271         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11272         <exception>.
11273         (throwing, orig_terminate): New static variables.
11274         (terminate_handler): New static function.
11275         (t2): Set terminate handler.
11276
11277 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11278
11279         PR 6584
11280         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11281         alignment.
11282
11283 2008-05-30  Cary Coutant  <ccoutant@google.com>
11284
11285         * archive.cc (Archive::include_all_members) Correct to step
11286         over symbol table and extended name table in thin archives.
11287
11288 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11289
11290         PR 6407
11291         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11292         calculation.
11293
11294 2008-05-28  Caleb Howe  <cshowe@google.com>
11295
11296         * reduced_debug_output.cc: New file.
11297         * reduced_debug_output.h: New file.
11298         * options.h (class General_options): Add --strip-debug-non-line.
11299         * options.cc (General_options::finalize): Add strip_debug_non_line
11300         to the strip heirarchy.
11301         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11302         fields.
11303         * layout.cc: Include "reduced_debug_output.h".
11304         (Layout::Layout): Initialize new fields.
11305         (line_only_debug_sections): New static array.
11306         (is_lines_only_debug_sections): New static inline function.
11307         (Layout::include_section): Handle --strip-debug-non-line.
11308         (Layout::make_output_section): If --strip-debug-non-line, build
11309         new output sections for .debug_abbrev and .debug_info.
11310         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11311         gold.  Warn about possible overflow.
11312         (read_signed_LEB_128): Likewise.
11313         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11314         (read_signed_LEB_128): Declare.
11315         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11316         (HFILES): Add reduced_debug_output.h.
11317         * Makefile.in: Rebuild.
11318
11319 2008-05-21  Ian Lance Taylor  <iant@google.com>
11320
11321         * mapfile.cc: New file.
11322         * mapfile.h: New file.
11323         * options.h (class General_options): Add -M/--print-map and -Map.
11324         * options.cc (General_options::finalize): Make -M equivalent to
11325         -Map -.
11326         * main.cc: Include <cstdio> and "mapfile.h".
11327         (main): Open mapfile if requested.
11328         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11329         constructor.  Change caller.
11330         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11331         (queue_middle_tasks): Likewise.
11332         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11333         declarations.
11334         * archive.cc: Include "mapfile.h".
11335         (Archive::add_symbols): Add mapfile parameter.  Change all
11336         callers.  Pass mapfile, symbol, and reason to include_member.
11337         (Archive::include_all_members): Add mapfile parameter.  Change all
11338         callers.
11339         (Archive::include_member): Add mapfile, sym, and why parameters.
11340         Change all callers.  Report inclusion to map file.
11341         * archive.h: Include "fileread.h".
11342         (class Archive): Update declarations.
11343         (Archive::file): New const method.
11344         (class Add_archive_symbols): Add mapfile_ field.  Update
11345         constructor.  Change all callers.
11346         * readsyms.h (class Read_symbols): Likewise.
11347         (class Finish_group): Likewise.
11348         (class Read_script): Likewise.
11349         * common.cc: Include "mapfile.h".
11350         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11351         all callers.
11352         (Symbol_table::do_allocate_commons): Likewise.
11353         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11354         symbol allocation to mapfile.
11355         * common.h (class Allocate_commons_task): Add mapfile_ field.
11356         Update constructor.  Change all callers.
11357         * symtab.h (class Symbol_table): Update declarations.
11358         * layout.cc: Include "mapfile.h".
11359         (Layout_task_runner::run): Print information to mapfile.
11360         (Layout::create_gold_note): Change Output_data_fixed_space to
11361         Output_data_zero_fill.
11362         (Layout::create_build_id): Likewise.
11363         (Layout::print_to_mapfile): New function.
11364         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11365         constructor.  Change caller.
11366         (class Layout): Declare print_to_mapfile.
11367         * output.cc (Output_section::Input_section::print_to_mapfile): New
11368         function.
11369         (Output_section::add_input_section): If producing a map, always
11370         add to input_sections_ list.
11371         (Output_section::do_print_to_mapfile): New function.
11372         (Output_segment::print_sections_to_mapfile): New function.
11373         (Output_segment::print_section_list_to_mapfile): New function.
11374         * output.h: Include "mapfile.h".
11375         (Output_data::print_to_mapfile): New function.
11376         (Output_data::do_print_to_mapfile): New virtual function.
11377         (Output_segment_headers::do_print_to_mapfile): New function.
11378         (Output_file_header::do_print_to_mapfile): New function.
11379         (Output_data_const::do_print_to_mapfile): New function.
11380         (class Output_data_const_buffer): Add map_name_ field.  Update
11381         constructor.  Change all callers.  Add do_print_to_mapfile
11382         function.
11383         (class Output_data_fixed_space): Likewise.
11384         (class Output_data_space): Likewise.
11385         (class Output_data_zero_fill): New class.
11386         (Output_data_strtab::do_print_to_mapfile): New function.
11387         (Output_data_reloc_base::do_print_to_mapfile): New function.
11388         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11389         (Output_data_group::do_print_to_mapfile): New function.
11390         (Output_data_got::do_print_to_mapfile): New function.
11391         (Output_data_dynamic::do_print_to_mapfile): New function.
11392         (Output_symtab_xindex::do_print_to_mapfile): New function.
11393         (class Output_section): Declare do_print_to_mapflie.  Declare
11394         print_to_mapfile in Input_section.
11395         (class Output_segment): Declare new functions.
11396         * object.h (Sized_relobj::symbol_count): New function.
11397         * script-sections.cc
11398         (Output_section_element_dot_assignment::set_section_addresses):
11399         Change Output_data_fixed_space to Output_data_zero_fill.
11400         (Output_data_expression::do_print_to_mapfile): New function.
11401         * script.cc (read_input_script): Add mapfile parameter.  Change
11402         all callers.
11403         * script.h (read_input_script): Update declaration.
11404         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11405         (Eh_frame::do_print_to_mapfile): New function.
11406         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11407         (Output_merge_string::do_print_to_mapfile): New function.
11408         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11409         function.
11410         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11411         function.
11412         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11413         function.
11414         * Makefile.am (CCFILES): Add mapfile.cc.
11415         (HFILES): Add mapfile.h.
11416         * Makefile.in: Rebuild.
11417
11418 2008-05-19  Ian Lance Taylor  <iant@google.com>
11419
11420         * options.h (class General_options): Add -z relro.
11421         * layout.cc (Layout::Layout): Initialize relro_segment_.
11422         (Layout::add_output_section_data): Return the output section.
11423         (Layout::make_output_section): Rcognize relro sections and mark
11424         them appropriately.
11425         (Layout::attach_allocated_section_to_segment): Put relro sections
11426         in a PT_GNU_RELRO segment.
11427         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11428         section as relro.
11429         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11430         PT_TLS segments.
11431         (Layout::linkonce_mapping): Map d.rel.ro.local to
11432         .data.rel.ro.local.
11433         (Layout::output_section_name): Us .data.rel.ro.local for any
11434         section which begins with that.
11435         * layout.h (class Layout): Update add_output_section_data
11436         declaration.  Add relro_segment_ field.
11437         * output.cc (Output_section::Output_section): Initialize is_relro_
11438         and is_relro_local_ fields.
11439         (Output_segment::add_output_section): Group relro sections.
11440         (Output_segment::is_first_section_relro): New function.
11441         (Output_segment::maximum_alignment): If there is a relro section,
11442         align the segment to the common page size.
11443         (Output_segment::set_section_addresses): Track whether we are
11444         looking at relro sections.  If the last section is a relro
11445         section, align to the common page size.
11446         (Output_segment::set_section_list_addresses): Add in_relro
11447         parameter.  Change all callers.  Align to the page size when
11448         moving from relro to non-relro section.
11449         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11450         segment.
11451         * output.h (class Output_section): Add is_relro_ and
11452         is_relro_local_ fields.
11453         (Output_section::is_relro): New function.
11454         (Output_section::set_is_relro): New function.
11455         (Output_section::is_relro_local): New function.
11456         (Output_section::set_is_relro_local): New function.
11457         (class Output_segment): Update declarations.
11458         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11459         * sparc.cc (Target_sparc::got_section): Likewise.
11460         * x86_64.cc (Target_x86_64::got_section): Likewise.
11461         * testsuite/relro_test_main.cc: New file.
11462         * testsuite/relro_test.cc: New file.
11463         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11464         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11465         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11466         (relro_test.so, relro_test_pic.o): New targets.
11467         * testsuite/Makefile.in: Rebuild.
11468
11469 2008-05-16  Ian Lance Taylor  <iant@google.com>
11470
11471         * output.cc (Output_segment::add_output_section): Remove front
11472         parameter.
11473         * output.h (class Output_segment): Remove
11474         add_initial_output_section and overloaded add_output_section.
11475         Update declaration of remaining add_output_section.
11476         * layout.cc (Layout::create_interp): Call add_output_section
11477         rather than add_initial_output_section.
11478         (Layout::finish_dynamic_section): Likewise.
11479
11480         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11481         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11482         know the dynamic type.
11483         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11484         field.  Initialize it in constructor.
11485         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11486         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11487         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11488         reloc.
11489
11490         * output.cc (Output_reloc::get_address): Change return type to
11491         Elf_Addr.
11492         * output.h (class Output_reloc): Update get_address declaration.
11493         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11494         for section addresses.
11495
11496 2008-05-09  Ian Lance Taylor  <iant@google.com>
11497
11498         PR 6493
11499         * gold.cc (gold_nomem): Use return value of write.
11500
11501 2008-05-08  Ian Lance Taylor  <iant@google.com>
11502
11503         * symtab.c (Symbol::init_base_output_data): Add version
11504         parameter.  Change all callers.
11505         (Symbol::init_base_output_segment): Likewise.
11506         (Symbol::init_base_constant): Likewise.
11507         (Symbol::init_base_undefined): Likewise.
11508         (Sized_symbol::init_output_data): Likewise.
11509         (Sized_symbol::init_output_segment): Likewise.
11510         (Sized_symbol::init_constant): Likewise.
11511         (Sized_symbol::init_undefined): Likewise.
11512         (Symbol_table::do_define_in_output_data): If the new symbol has a
11513         version, mark it as the default.
11514         (Symbol_table::do_define_in_output_segment): Likewise.
11515         (Symbol_table::do_define_as_constant): Likewise.
11516         * symtab.h (class Symbol): Update declarations.
11517         (class Sized_symbol): Likewise.
11518         * resolve.cc (Symbol::override_version): New function.
11519         (Symbol::override_base): Call override_version.
11520         (Symbol::override_base_with_special): Likewise.
11521         * testsuite/ver_script_8.script: New file.
11522         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11523         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11524         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11525         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11526
11527 2008-05-06  Ian Lance Taylor  <iant@google.com>
11528
11529         PR 6049
11530         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11531         functions.
11532         (class General_options): Remove existing --undefined, and add
11533         --no-undefined instead.  Add new --undefined as synonym for -u.
11534         * archive.cc (Archive::add_symbols): Check whether symbol was
11535         named with -u.
11536         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11537         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11538         all uses.  Add IS_UNDEFINED.  Update declarations to split
11539         different versions of init_base.  Declare init_base_undefined.
11540         (Symbol::is_defined): Handle IS_UNDEFINED.
11541         (Symbol::is_undefined): Likewise.
11542         (Symbol::is_weak_undefined): Call is_undefined.
11543         (Symbol::is_absolute): Handle IS_CONSTANT.
11544         (class Sized_symbol): Update declarations to split different
11545         versions of init.  Declare init_undefined.
11546         (class Symbol_table): Declare new functions.
11547         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11548         Change all callers.
11549         (Symbol::init_base_output_data): Likewise.
11550         (Symbol::init_base_output_segment): Likewise.
11551         (Symbol::init_base_constant): Likewise.
11552         (Symbol::init_base_undefined): New function.
11553         (Sized_symbol::init_object): Rename from init.  Change all
11554         callers.
11555         (Sized_symbol::init_output_data): Likewise.
11556         (Sized_symbol::init_output_segment): Likewise.
11557         (Sized_symbol::init_constant): Likewise.
11558         (Sized_symbol::init_undefined): New function.
11559         (Symbol_table::add_undefined_symbols_from_command_line): New
11560         function.
11561         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11562         function.
11563         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11564         (Symbol::output_section): Likewise.
11565         (Symbol::set_output_section): Likewise.
11566         (Symbol_table::sized_finalize_symbol): Likewise.
11567         (Symbol_table::sized_write_globals): Likewise.
11568         * resolve.cc (Symbol_table::should_override): Likewise.
11569         (Symbol::override_base_with_special): Likewise.
11570
11571         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11572         symbol, change it to have default visibility.
11573         * testsuite/protected_1.cc: New file.
11574         * testsuite/protected_2.cc: New file.
11575         * testsuite/protected_3.cc: New file.
11576         * testsuite/protected_main_1.cc: New file.
11577         * testsuite/protected_main_2.cc: New file.
11578         * testsuite/protected_main_3.cc: New file.
11579         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11580         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11581         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11582         (protected_1.so): New target.
11583         (protected_1_pic.o, protected_2_pic.o): New targets.
11584         (protected_3_pic.o): New target.
11585         (check_PROGRAMS): Add protected_2.
11586         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11587         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11588         * testsuite/Makefile.in: Rebuild.
11589
11590         * options.h (DEFINE_var): Add set_user_set_##varname__.
11591         (DEFINE_bool_alias): New macro.
11592         (class General_options): Define -Bstatic using DEFINE_bool_alias
11593         rather than DEFINE_special.  Add --undefined as an alias for -z
11594         defs.
11595         * options.cc (General_options::parse_Bstatic): Remove.
11596
11597         * options.h (class General_options): Add --fatal-warnings.
11598         * main.cc (main): Implement --fatal-warnings.
11599         * errors.h (Errors::warning_count): New function.
11600
11601         * options.h (class General_options): Add -Bsymbolic-functions.
11602         * symtab.h (Symbol::is_preemptible): Check for
11603         -Bsymbolic-functions.
11604
11605 2008-05-05  Ian Lance Taylor  <iant@google.com>
11606
11607         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11608         as noVARNAME rather than no-VARNAME.
11609         (class General_options): Add option -z combreloc.
11610         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11611         get_address.
11612         (Output_reloc::sort_before) [SHT_REL]: New function.
11613         (Output_reloc::sort_before) [SHT_RELA]: New function.
11614         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11615         Sort_relocs_comparison.
11616         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11617         parameter.  Change all callers.
11618         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11619         sort_relocs parameter.  Change all callers.
11620         * output.cc (Output_reloc::get_address): New function, broken out
11621         of write_rel.
11622         (Output_reloc::write_rel): Call it.
11623         (Output_reloc::compare): New function.
11624         (Output_data_reloc_base::do_write): Optionally sort relocs.
11625
11626         * configure.ac: If targ_extra_obj is set, link it in.
11627         * configure.tgt: Initialize all variables.
11628         (x86_64*): Set targ_extra_obj and targ_extra_size.
11629         * configure: Rebuild.
11630
11631         * object.cc (Sized_relobj::include_section_group): Adjust section
11632         indexes read from group data.  Build vector to pass to
11633         layout_group.
11634         * layout.cc (Layout::layout_group): Add flags and shndxes
11635         parameters.  Remove contents parameter.  Change caller.  Update
11636         explicit instantiations.
11637         * layout.h (class Layout): Update layout_group declaration.
11638         * output.cc (Output_data_group::Output_data_group): Add flags and
11639         input_shndxes parameters.  Remove contents parameter.  Change
11640         caller.
11641         (Output_data_group::do_write): Change input_sections_ to
11642         input_shndxes_.
11643         * output.h (class Output_data_group): Update constructor
11644         declaration.  Rename input_sections_ to input_shndxes_.
11645         * testsuite/many_sections_test.cc: Add template.
11646
11647 2008-04-30  Cary Coutant  <ccoutant@google.com>
11648
11649         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11650
11651         * layout.cc (Layout::include_section): Refactored check for debug
11652         info section.
11653         (Layout::add_comdat): Add new parameters.  Change type
11654         of signature parameter.  Add object and shndx to signatures table.
11655         (Layout::find_kept_object): New function.
11656         * layout.h: Include <cstring>.
11657         (Layout::is_debug_info_section): New function.
11658         (Layout::add_comdat): Add new parameters.
11659         (Layout::find_kept_object): New function.
11660         (Layout::Kept_section): New struct.
11661         (Layout::Signatures): Change type of map range.
11662         * object.cc (Relobj::output_section_address): New function.
11663         (Sized_relobj::include_section_group): Add new parameters.  Change
11664         calls to Layout::add_comdat.  Change to build table of kept comdat
11665         groups and table mapping discarded sections to kept sections.
11666         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11667         (Sized_relobj::do_layout): Change calls to include_section_group and
11668         include_linkonce_section.
11669         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11670         value to zero when section is discarded.
11671         (Sized_relobj::map_to_kept_section): New function.
11672         * object.h (Relobj::output_section_address): New function.
11673         (Relobj::Comdat_group): New type.
11674         (Relobj::find_comdat_group): New function.
11675         (Relobj::Comdat_group_table): New type.
11676         (Relobj::Kept_comdat_section): New type.
11677         (Relobj::Kept_comdat_section_table): New type.
11678         (Relobj::add_comdat_group): New function.
11679         (Relobj::set_kept_comdat_section): New function.
11680         (Relobj::get_kept_comdat_section): New function.
11681         (Relobj::comdat_groups_): New field.
11682         (Relobj::kept_comdat_sections_): New field.
11683         (Symbol_value::input_value): Update comment.
11684         (Sized_relobj::map_to_kept_section) New function.
11685         (Sized_relobj::include_linkonce_section): Add new parameter.
11686         * target-reloc.h (Comdat_behavior): New type.
11687         (get_comdat_behavior): New function.
11688         (relocate_section): Add code to map a discarded section to the
11689         corresponding kept section when applying a relocation.
11690
11691 2008-04-30  Craig Silverstein  <csilvers@google.com>
11692
11693         * dwarf_reader.cc (next_generation_count): New static var.
11694         (Addr2line_cache_entry): New struct.
11695         (addr2line_cache): New static var.
11696         (Dwarf_line_info::one_addr2line): Added caching.
11697         (Dwarf_line_info::clear_addr2line_cache): New function.
11698         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11699         cache-size parameter.
11700         (Dwarf_line_info::one_addr2line_cache): New function.
11701         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11702         new cache-size argument to one_addr2line(), and clear cache.
11703
11704 2008-04-28  Cary Coutant  <ccoutant@google.com>
11705
11706         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11707         R_386_PC8 relocations.
11708
11709 2008-04-23  Ian Lance Taylor  <iant@google.com>
11710
11711         * object.cc (Sized_relobj::include_section_group): Check for
11712         invalid section group.
11713
11714         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11715         header size.
11716
11717         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11718         than read for file header.
11719         * archive.cc (Archive::include_member): Likewise.
11720
11721 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11722
11723         * aclocal.m4: Regenerate.
11724         * configure: Regenerate.
11725
11726 2008-04-19  Ian Lance Taylor  <iant@google.com>
11727
11728         * version.cc (version_string): Bump to 1.6.
11729
11730         * testsuite/Makefile.am (many_sections_r_test): New target.
11731         (many_sections_r_test_SOURCES): Remove.
11732         (many_sections_r_test_DEPENDENCIES): Remove.
11733         (many_sections_r_test_LDFLAGS): Remove.
11734         (many_sections_r_test_LDADD): Remove.
11735
11736         * object.cc (Sized_relobj::do_add_symbols): Always pass
11737         local_symbol_count_ to add_from_relobj.
11738
11739         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11740         every thousand variables.
11741         * testsuite/Makefile.in: Rebuild.
11742
11743         * object.cc (Xindex::initialize_symtab_xindex): New function.
11744         (Xindex::read_symtab_xindex): New function.
11745         (Xindex::sym_xindex_to_shndx): New function.
11746         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11747         available.
11748         (Sized_relobj::do_initialize_xindex): New function.
11749         (Sized_relobj::do_read_symbols): Adjust section links.
11750         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11751         parameter.  Change all callers.
11752         (Sized_relobj::include_section_group): Adjust section links and
11753         symbol section indexes.
11754         (Sized_relobj::do_layout): Adjust section links.
11755         (Sized_relobj::do_count_local_symbols): Adjust section links and
11756         symbol section indexes.
11757         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11758         ordinary and special symbols.
11759         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11760         dynsym_xindex parameters.  Change all callers.  Adjust section
11761         links.  Use SHN_XINDEX when needed.
11762         (Sized_relobj::get_symbol_location_info): Adjust section links.
11763         Don't get fooled by special symbols.
11764         * object.h (class Xindex): Define.
11765         (class Object): Add xindex_ parameter.  Declare virtual functoin
11766         do_initialize_xindex.
11767         (Object::adjust_sym_shndx): New function.
11768         (Object::set_xindex): New protected function.
11769         (class Symbol_value): Add is_ordinary_shndx_ field.
11770         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11771         (Symbol_value::value): Assert ordinary section.
11772         (Symbol_value::initialize_input_to_output_map): Likewise.
11773         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11774         Change all callers.
11775         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11776         all callers.
11777         (class Sized_relobj): Update declarations.
11778         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11779         parameter.  Change all callers.
11780         (Sized_relobj::adjust_shndx): New function.
11781         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11782         field.
11783         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11784         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11785         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11786         (Sized_dynobj::read_dynsym_section): Adjust section links.
11787         (Sized_dynobj::read_dynamic): Likewise.
11788         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11789         section links.
11790         (Sized_dynobj::do_initialize_xindex): New function.
11791         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11792         do_initialize_xindex.
11793         (Sized_dynobj::adjust_shndx): New function.
11794         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11795         dynsym_xindex_ fields.
11796         (Layout::finalize): Add a call to set_section_indexes before
11797         creating the symtab sections.
11798         (Layout::set_section_indexes): Don't do anything if the section
11799         already has a section index.
11800         (Layout::create_symtab_sections): Add shnum parameter.  Change
11801         caller.  Create .symtab_shndx section if needed.
11802         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11803         caller.
11804         (Layout::allocated_output_section_count): New function.
11805         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11806         needed.
11807         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11808         fields.  Update declarations.
11809         (Layout::symtab_xindex): New function.
11810         (Layout::dynsym_xindex): New function.
11811         (class Write_symbols_task): Add layout_ field.
11812         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11813         Change caller.
11814         * output.cc (Output_section_headers::Output_section_headers): Add
11815         shstrtab_section parameter.  Change all callers.
11816         (Output_section_headers::do_sized_write): Store overflow values
11817         for section count and section string table section index in
11818         section header zero.
11819         (Output_file_header::do_sized_write): Check for overflow of
11820         section count and section string table section index.
11821         (Output_symtab_xindex::do_write): New function.
11822         (Output_symtab_xindex::endian_do_write): New function.
11823         * output.h (class Output_section_headers): Add shstrtab_section_.
11824         Update declarations.
11825         (class Output_symtab_xindex): Define.
11826         (Output_section::has_out_shndx): New function.
11827         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11828         field.
11829         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11830         Change all callers.
11831         (Sized_symbol::init): Likewise.
11832         (Symbol::output_section): Check for ordinary symbol.
11833         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11834         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11835         callers.
11836         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11837         Change all callers.  Simplify handling of symbols from sections
11838         not included in the link.
11839         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11840         distinction.
11841         (Weak_alias_sorter::operator()): Assert that symbols are
11842         ordinary.
11843         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11844         distinction.
11845         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11846         parameters.  Change all callers.
11847         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11848         symbol distinction.  Use SHN_XINDEX when needed.
11849         (Symbol_table::write_section_symbol): Add symtab_xindex
11850         parameter.  Change all callers.
11851         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11852         SHN_XINDEX when needed.
11853         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11854         declarations.
11855         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11856         (Symbol::is_defined): Check is_ordinary.
11857         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11858         (Symbol::is_absolute, Symbol::is_common): Likewise.
11859         (class Sized_symbol): Update declarations.
11860         (class Symbol_table): Update declarations.
11861         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11862         parameters.  Change all callers.
11863         (Sized_symbol::override): Likewise.
11864         (Symbol_table::override): Likewise.
11865         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11866         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11867         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11868         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11869         to be in an ordinary section.
11870         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11871         object and is_ordinary parameters.  Change all callers.
11872         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11873         Change all callers.  Don't add undefined or non-ordinary symbols
11874         to reloc_map_.
11875         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11876         Change all callers.
11877         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11878         declarations.
11879         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11880         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11881         (Sized_relobj::relocate_sections): Likewise.
11882         * target-reloc.h (scan_relocs): Adjust section symbol index.
11883         (scan_relocatable_relocs): Likewise.
11884         * i386.cc (Scan::local): Check for ordinary symbols.
11885         * sparc.cc (Scan::local): Likewise.
11886         * x86_64.cc (Scan::local): Likewise.
11887         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11888         to symbol_section_and_value.
11889         * testsuite/many_sections_test.cc: New file.
11890         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11891         (check_PROGRAMS): Add many_sections_test.
11892         (many_sections_test_SOURCES): Define.
11893         (many_sections_test_DEPENDENCIES): Define.
11894         (many_sections_test_LDFLAGS): Define.
11895         (BUILT_SOURCES): Add many_sections_define.h.
11896         (many_sections_define.h): New target.
11897         (BUILT_SOURCES): Add many_sections_check.h.
11898         (many_sections_check.h): New target.
11899         (check_PROGRAMS): Add many_sections_r_test.
11900         (many_sections_r_test_SOURCES): Define.
11901         (many_sections_r_test_DEPENDENCIES): Define.
11902         (many_sections_r_test_LDFLAGS): Define.
11903         (many_sections_r_test_LDADD): Define.
11904         (many_sections_r_test.o): New target.
11905         * testsuite/Makefile.in: Rebuild.
11906
11907 2008-04-17  Cary Coutant  <ccoutant@google.com>
11908
11909         * errors.cc (Errors::info): New function.
11910         (gold_info): New function.
11911         * errors.h (Errors::info): New function.
11912         * gold.h (gold_info): New function.
11913         * object.cc (Input_objects::add_object): Print trace output.
11914         * options.cc (options::parse_set): New function.
11915         (General_options::parse_wrap): Deleted.
11916         (General_options::General_options): Deleted initializer.
11917         * options.h (options::String_set): New typedef.
11918         (options::parse_set): New function.
11919         (DEFINE_set): New macro.
11920         (General_options::wrap): Changed to use DEFINE_set. Changed
11921         callers of any_wrap_symbols and is_wrap_symbol.
11922         (General_options::trace, General_options::trace_symbol):
11923         New options.
11924         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11925         (General_options::wrap_symbols_): Deleted.
11926         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11927
11928 2008-04-17  David S. Miller  <davem@davemloft.net>
11929
11930         * options.cc (General_options::parse_V): New function.
11931         * options.h: Add entries for -V and -Qy.
11932
11933 2008-04-17  Ian Lance Taylor  <iant@google.com>
11934
11935         * common.cc (Symbol_table::allocate_commons): Remove options
11936         parameter.  Change caller.
11937         (Symbol_table::do_allocate_commons): Remove options parameter.
11938         Change caller.  Just call do_allocate_commons_list twice.
11939         (Symbol_table::do_allocate_commons_list): New function, broken out
11940         of do_allocate_commons.
11941         * common.h (class Allocate_commons_task): Remove options_ field.
11942         Update constructor.
11943         * symtab.cc (Symbol_table::Symbol_table): Initialize
11944         tls_commons_.
11945         (Symbol_table::add_from_object): Put TLS common symbols on
11946         tls_commons_ list.
11947         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11948         which are IN_OUTPUT_DATA.
11949         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11950         allocate_commons and do_allocate_commons declarations.  Declare
11951         do_allocate_commons_list.
11952         * gold.cc (queue_middle_tasks): Update creation of
11953         Allocate_commons_task to not pass options.
11954         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11955         (TLS_TEST_C_FLAGS): New variable.
11956         (tls_test_c_pic.o): New target.
11957         (tls_test_shared.so): Link in tls_test_c_pic.o.
11958         (tls_test_c_pic_ie.o): New target.
11959         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11960         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11961         (tls_test_c.o): New target.
11962         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11963         (tls_pic_test_LDADD): Likewise.
11964         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11965         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11966         (tls_test_c_gnu2.o): New target.
11967         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11968         tls_test_c_gnu2.o.
11969         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11970         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11971         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11972         * testsuite/tls_test.cc: Include "config.h".
11973         (t_last): Call t11_last.
11974         * testsuite/tls_test.h (t11, t11_last): Declare.
11975         * testsuite/tls_test_c.c: New file.
11976         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11977         * configure.ac: Check for OpenMP support.
11978         * configure, config.in, Makefile.in: Rebuild.
11979         * testsuite/Makefile.in: Rebuild.
11980
11981 2008-04-16  Cary Coutant  <ccoutant@google.com>
11982
11983         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11984         (Target_i386::tls_base_symbol_defined_): New field.
11985         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11986         (Target_i386::Scan::global): Likewise.
11987         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11988         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11989         (Target_x86_64::tls_base_symbol_defined_): New field.
11990         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11991         (Target_x86_64::Scan::global): Likewise.
11992
11993 2008-04-16  Cary Coutant  <ccoutant@google.com>
11994
11995         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11996         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11997         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11998         building shared libraries.
11999         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12000         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12001         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12002         * testsuite/Makefile.in: Rebuild.
12003         * testsuite/weak_undef.h: New file.
12004         * testsuite/weak_undef_file1.cc: Add extra test cases.
12005         * testsuite/weak_undef_file2.cc: Likewise.
12006         * testsuite/weak_undef_test.cc: Likewise.
12007
12008 2008-04-16  David S. Miller  <davem@davemloft.net>
12009
12010         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12011         Add issued_non_pic_error_ field.  Declare check_non_pic.
12012         (Target_sparc::Scan::check_non_pic): New function.
12013         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12014         (Target_sparc::Scan::global): Likewise.
12015
12016         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12017         * configure: Rebuild.
12018
12019         * options.h (DEFINE_enable): New macro.
12020         (new_dtags): New enable option.
12021         (initfirst, interpose, loadfltr, nodefaultlib,
12022         nodelete, nodlopen, nodump): New -z options.
12023         * layout.cc (Layout:finish_dynamic_section): If new
12024         dtags enabled, emit DT_RUNPATH.  Also, emit a
12025         DT_FLAGS_1 containing any specified -z flags.
12026
12027 2008-04-16  Ian Lance Taylor  <iant@google.com>
12028
12029         * copy-relocs.cc: New file.
12030         * copy-relocs.h: New file.
12031         * reloc.cc: Remove Copy_relocs code.
12032         * reloc.h: Likewise.
12033         * reloc-types.h (struct Reloc_types) [both versions]: Add
12034         get_reloc_addend_noerror.
12035         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12036         variants of add_global which take an addend which must be zero.
12037         * i386.cc: Include "copy-relocs.h".
12038         (class Target_i386): Change type of copy_relocs_ to variable,
12039         update initializer.
12040         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12041         Change all callers.
12042         (Target_i386::do_finalize_sections): Change handling of
12043         copy_relocs_.
12044         * sparc.cc: Include "copy-relocs.h".
12045         (class Target_sparc): Change type of copy_relocs_ to variable,
12046         update initializer.
12047         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12048         Change all callers.
12049         (Target_sparc::do_finalize_sections): Change handling of
12050         copy_relocs_.
12051         * x86_64.cc: Include "copy-relocs.h".
12052         (class Target_x86_64): Change type of copy_relocs_ to variable,
12053         update initializer.
12054         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12055         class.  Change all callers.
12056         (Target_x86_64::do_finalize_sections): Change handling of
12057         copy_relocs_.
12058         * Makefile.am (CCFILES): Add copy-relocs.cc.
12059         (HFILES): Add copy-relocs.h.
12060
12061         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12062
12063         * testsuite/script_test_4.sh: Permit leading zeroes.
12064
12065 2008-04-15  Ian Lance Taylor  <iant@google.com>
12066
12067         * script-sections.cc (Script_sections::create_segments): Use
12068         header_size_adjustment even when there is enough room for the
12069         headers.
12070         * testsuite/script_test_4.sh: New file.
12071         * testsuite/script_test_4.t: New file.
12072         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12073         (check_DATA): Add script_test_4.stdout.
12074         (MOSTLYCLEANFILES): Likewise.
12075         (script_test_4): New target.
12076         (script_test_4.stdout): New target.
12077         * testsuite/Makefile.in: Rebuild.
12078
12079         * sparc.cc: Add definitions for Output_data_plt_sparc class
12080         constants.
12081
12082 2008-04-14  David S. Miller  <davem@davemloft.net>
12083
12084         * sparc.cc: New file.
12085         * Makefile.am (TARGETSOURCES): Add sparc.cc
12086         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12087         * configure.tgt: Document targ_extra_size and
12088         targ_extra_big_endian.  Add entries for sparc-* and
12089         sparc64-*.
12090         * configure.ac: Handle targ_extra_size and
12091         targ_extra_big_endian.
12092         * Makefile.in: Rebuild.
12093         * configure: Likewise.
12094         * po/POTFILES.in: Likewise.
12095         * po/gold.pot: Likewise.
12096
12097 2008-04-14  Ian Lance Taylor  <iant@google.com>
12098
12099         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12100         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12101         in the name/type/flags to section mapping.  Don't call
12102         allocate_output_section.
12103         (Layout::choose_output_section): Change parameter from adjust_name
12104         to is_input_section.  Don't permit input sections after sections
12105         are attached to segments.  Don't call allocate_output_section.
12106         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12107         not write_enable_output_section.
12108         (Layout::make_output_section): Don't push to
12109         unattached_section_list_ nor call attach_to_segment.  Call
12110         attach_section_to_segment if sections are attached.
12111         (Layout::attach_sections_to_segments): New function.
12112         (Layout::attach_section_to_segment): New function.
12113         (Layout::attach_allocated_section_to_segment): Rename from
12114         attach_to_segment.  Remove flags parameter.
12115         (Layout::allocate_output_section): Remove function.
12116         (Layout::write_enable_output_section): Remove function.
12117         * layout.h (class Layout): Update for above changes.  Add new
12118         field sections_are_attached_.
12119         * output.h (Output_section::update_flags_for_input_section): New
12120         function.
12121         * output.cc (Output_section::add_input_section): Call
12122         update_flags_for_input_section.
12123         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12124
12125 2008-04-11  Cary Coutant  <ccoutant@google.com>
12126
12127         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12128         thought unnecessary.
12129         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12130
12131 2008-04-11  Ian Lance Taylor  <iant@google.com>
12132
12133         * output.h (class Output_section_data): Remove inline definition
12134         of set_addralign.
12135         * output.cc (Output_section_data::set_addralign): New function.
12136
12137 2008-04-11  Cary Coutant  <ccoutant@google.com>
12138
12139         Add support for TLS descriptors for i386 and x86_64.
12140         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12141         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12142         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12143         GOT_TYPE_TLS_DESC.
12144         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12145         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12146         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12147         relocations.
12148         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12149         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12150         Fix problem with initial-exec relocations.
12151         (Target_i386::Relocate::relocate_tls): Likewise.
12152         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12153         relaxation.
12154         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12155         support for section-plus-offset dynamic table entries.
12156         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12157         (Output_data_dynamic::Dynamic_entry): Add support for
12158         section-plus-offset dynamic table entries.
12159         (Output_data_dynamic::Classification): Likewise.
12160         (Output_data_dynamic::classification_): Renamed offset_.
12161         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12162         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12163         (Target_x86_64::make_plt_section): New function.
12164         (Target_x86_64::reserve_tlsdesc_entries): New function.
12165         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12166         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12167         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12168         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12169         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12170         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12171         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12172         add extra PLT entry for TLS descriptors.
12173         (Output_data_plt_x86_64::got_): New field.
12174         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12175         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12176         fields.
12177         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12178         descriptors.
12179         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12180         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12181         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12182         R_386_TLS_DESC_CALL relocations.
12183         (Target_x86_64::Scan::global): Likewise.
12184         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12185         for TLS descriptors.
12186         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12187         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12188         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12189         GD-to-IE relaxation.
12190         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12191         and TLS_DESCRIPTORS.
12192         * Makefile.in: Rebuild.
12193         * configure: Rebuild.
12194         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12195         (tls_test_shared2.so): New target.
12196         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12197         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12198         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12199         (tls_shared_gd_to_ie_test_LDADD): New variable.
12200         (tls_shared_gnu2_gd_to_ie_test): New target.
12201         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12202         New targets.
12203         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12204         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12205         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12206         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12207         (tls_shared_gnu2_test): New target.
12208         (tls_test_gnu2_shared.so): New target.
12209         (tls_shared_gnu2_test_SOURCES): New variable.
12210         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12211         (tls_shared_gnu2_test_LDFLAGS): New variable.
12212         (tls_shared_gnu2_test_LDADD): New variable.
12213         * testsuite/Makefile.in: Rebuild.
12214         * testsuite/Makefile.
12215
12216 2008-04-11  Ian Lance Taylor  <iant@google.com>
12217
12218         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12219         justsyms.t.
12220         * testsuite/Makefile.in: Rebuild.
12221
12222         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12223         long.
12224         * testsuite/script_test_2.cc (main): Adjust test.
12225
12226 2008-04-11  David S. Miller  <davem@davemloft.net>
12227             Ian Lance Taylor  <iant@google.com>
12228
12229         * options.h (General_options): Add entries for '-Y' and
12230         '-relax'.
12231         * options.cc (General_options:finalize): If -Y was used, add those
12232         entries to the library path instead of the default "/lib" and
12233         "/usr/lib".
12234
12235 2008-04-11  David S. Miller  <davem@davemloft.net>
12236
12237         * testsuite/justsyms.t: Start at 0x100.
12238         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12239         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12240         long.
12241         * testsuite/script_test_2.cc: Adjust string and section length
12242         checks.
12243
12244 2008-04-09  Ian Lance Taylor  <iant@google.com>
12245
12246         PR gold/5996
12247         * script-sections.cc (Sections_element::allocate_to_segment): Add
12248         orphan parameter.
12249         (Output_section_definition::allocate_to_segment): Likewise.
12250         (Orphan_output_section::allocate_to_segment): Likewise.
12251         (Script_sections::attach_sections_using_phdrs_clause): Don't
12252         propagate non-PT_LOAD segments to orphan sections.
12253         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12254         readelf rather than objdump.
12255         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12256         .interp section and PT_INTERP segment are the same size.
12257         * testsuite/Makefile.in: Rebuild.
12258
12259         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12260         aliases for symbols defined in the same object.
12261         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12262         (weak_alias_test_SOURCES): New variable.
12263         (weak_alias_test_DEPENDENCIES): New variable.
12264         (weak_alias_test_LDFLAGS): New variable.
12265         (weak_alias_test_LDADD): New variable.
12266         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12267         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12268         (weak_alias_test_3.o): New target.
12269         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12270         * testsuite/weak_alias_test_main.cc: New file.
12271         * testsuite/weak_alias_test_1.cc: New file.
12272         * testsuite/weak_alias_test_2.cc: New file.
12273         * testsuite/weak_alias_test_3.cc: New file.
12274
12275 2008-04-08  Ian Lance Taylor  <iant@google.com>
12276
12277         * options.h (class General_options): Add --noinhibit-exec option.
12278         * main.cc (main): Check --noinhibit-exec.
12279
12280         * options.h (class General_options): Define --wrap as a special
12281         option.  Add wrap_symbols_ field.
12282         (General_options::any_wrap_symbols): New function.
12283         (General_options::is_wrap_symbol): New function.
12284         * options.cc (General_options::parse_wrap): New function.
12285         (General_options::General_options): Initialize wrap_symbols_.
12286         * symtab.cc (Symbol_table::wrap_symbol): New function.
12287         (Symbol_table::add_from_object): Handle --wrap.
12288         * symtab.h (class Symbol_table): Declare wrap_symbol.
12289         * target.h (Target::wrap_char): New function.
12290         (Target::Target_info): Add wrap_char field.
12291         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12292         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12293         * testsuite/testfile.cc (Target_test::test_target_info):
12294         Likewise.
12295
12296         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12297         there is one.
12298
12299         * layout.h (class Layout): Add added_eh_frame_data_ field.
12300         * layout.cc (Layout::Layout): Initialize new field.
12301         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12302         output section until we find a section we merged successfully.
12303         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12304         that the size be non-zero.
12305
12306         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12307         qualifier.
12308
12309 2008-04-08  Craig Silverstein  <csilvers@google.com>
12310
12311         * configure.ac: Export new conditional variable HAVE_ZLIB.
12312         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12313         on HAVE_ZLIB.
12314         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12315         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12316
12317 2008-04-07  Ian Lance Taylor  <iant@google.com>
12318
12319         * version.cc (version_string): Set to "1.5".
12320
12321         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12322         Add issued_non_pic_error_ field.  Declare check_non_pic.
12323         (Target_x86_64::Scan::check_non_pic): New function.
12324         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12325         (Target_x86_64::Scan::global): Likewise.
12326
12327         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12328         addend parameter.  Change caller.  Handle merge sections.
12329         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12330         Address to Addend.  Don't add in the result of
12331         local_section_offset, pass down the addend and use the returned
12332         value.
12333         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12334         Update declarations of local_section_offset and symbol_value.
12335         * testsuite/two_file_test_1.cc (t18): New function.
12336         * testsuite/two_file_test_2.cc (f18): New function.
12337         * testsuite/two_file_test_main.cc (main): Call t18.
12338         * testsuite/two_file_test.h (t18, f18): Declare.
12339
12340         * configure.ac: Don't test for objdump, c++filt, or readelf.
12341         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12342         conditionals.
12343         (TEST_READELF): New variable.
12344         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12345         (check_PROGRAMS): Add two_file_strip_test.
12346         (two_file_strip_test): New target.
12347         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12348         (two_file_same_shared_strip_test_SOURCES): New variable.
12349         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12350         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12351         (two_file_same_shared_strip_test_LDADD): New variable.
12352         (two_file_shared_strip.so): New target.
12353         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12354         (ver_test_5.syms, ver_test_7.syms): Likewise.
12355         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12356         (strip_test_3.stdout): Use TEST_OBJDUMP.
12357         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12358
12359 2008-04-04  Cary Coutant  <ccoutant@google.com>
12360
12361         * symtab.h (Symbol::is_weak_undefined): New function.
12362         (Symbol::is_strong_undefined): New function.
12363         (Symbol::is_absolute): New function.
12364         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12365         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12366         absolute symbols.
12367         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12368         (weak_undef_test): New target.
12369         * testsuite/Makefile.in: Rebuild.
12370         * testsuite/weak_undef_file1.cc: New file.
12371         * testsuite/weak_undef_file2.cc: New file.
12372         * testsuite/weak_undef_test.cc: New file.
12373
12374 2008-04-03  Craig Silverstein  <csilvers@google.com>
12375
12376         * compressed_output.h (class Output_compressed_section): Use
12377         unsigned buffer.
12378         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12379         add zlib header.
12380         (zlib_compressed_suffix): Removed.
12381         (Output_compressed_section::set_final_data_size): Use unsigned
12382         buffers.
12383         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12384         Fix linker invocation.
12385         (flagstest_o_specialfile_and_compress_debug_sections):
12386         Likewise.
12387         * testsuite/Makefile.in: Regenerated.
12388
12389 2008-04-02  David S. Miller  <davem@davemloft.net>
12390
12391         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12392         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12393
12394 2008-04-02  Craig Silverstein  <csilvers@google.com>
12395
12396         * TODO: New file.
12397
12398 2008-04-02  Ian Lance Taylor  <iant@google.com>
12399
12400         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12401         parameters.  Update for new key type to views_.  Change all
12402         callers.
12403         (File_read::read): Adjust for byteshift in returned view.
12404         (File_read::add_view): New function, broken out of
12405         find_and_make_view.
12406         (File_read::make_view): New function, broken out of
12407         find_and_make_view.
12408         (File_read::find_or_make_view): Add offset and aligned
12409         parameters.  Rewrite accordingly.  Change all callers.
12410         (File_read::get_view): Add offset and aligned parameters.  Adjust
12411         for byteshift in return value.
12412         (File_read::get_lasting_view): Likewise.
12413         * fileread.h (class File_read): Update declarations.
12414         (class File_read::View): Add byteshift_ field.  Add byteshift to
12415         constructor.  Add byteshift method.
12416         * archive.h (Archive::clear_uncached_views): New function.
12417         (Archive::get_view): Add aligned parameter.  Change all callers.
12418         * object.h (Object::get_view): Add aligned parameter.  Change all
12419         callers.
12420         (Object::get_lasting_view): Likewise.
12421
12422         * fileread.cc (File_read::release): Don't call clear_views if
12423         there are multiple objects.
12424         * fileread.h (File_read::clear_uncached_views): New function.
12425         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12426         on the archive.
12427
12428 2008-03-31  Cary Coutant  <ccoutant@google.com>
12429
12430         Add thin archive support.
12431         * archive.cc (Archive::armagt): New const.
12432         (Archive::setup): Remove task parameter and calls to unlock.
12433         (Archive::unlock_nested_archives): New function.
12434         (Archive::read_header): Add nested_off parameter. Change
12435         all callers.
12436         (Archive::interpret_header): Likewise.
12437         (Archive::include_all_members): Change to handle thin
12438         archives.
12439         (Archive::include_member): Likewise.
12440         * archive.h (Archive::Archive): Add new parameters and
12441         initializers.
12442         (Archive::armagt): New const.
12443         (Archive::setup): Remove task parameter.
12444         (Archive::unlock_nested_archives): New function.
12445         (Archive::read_header): Add nested_off parameter.
12446         (Archive::interpret_header): Likewise.
12447         (Archive::Nested_archive_table): New typedef.
12448         (Archive::is_thin_archive_): New field.
12449         (Archive::nested_archives_): New field.
12450         (Archive::options_): New field.
12451         (Archive::dirpath_): New field.
12452         (Archive::task_): New field.
12453         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12454         for thin archives.  Pass additional parameters to
12455         Archive::Archive.  Unlock the archive file after calling
12456         Archive::setup.
12457
12458 2008-03-29  Ian Lance Taylor  <iant@google.com>
12459
12460         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12461         version symbol to be local.
12462         * testsuite/ver_test_4.sh: New file.
12463         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12464         (check_DATA): Add ver_test_4.syms.
12465         (ver_test_4.syms): New target.
12466         * testsuite/Makefile.in: Rebuild.
12467
12468         * output.cc
12469         (Output_section::Input_section_sort_entry::has_priority): New
12470         function.
12471         (Output_section::Input_section_sort_entry::match_file_name): New
12472         function.
12473         (Output_section::Input_section_sort_entry::match_section_name):
12474         Remove.
12475         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12476         Remove.
12477         (Output_section::Input_section_sort_entry::match_section_file):
12478         Remove.
12479         (Output_section::Input_section_sort_compare::operator()): Rewrite
12480         using new Input_section_sort_entry functions.  Sort crtbegin and
12481         crtend first.  Sort sections with no priority before sections with
12482         a priority.
12483         * testsuite/initpri1.c (d3): Check j != 4.
12484         (cd5): New constructor/destructor function.
12485         (main): Check j != 2.
12486
12487         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12488         new symbol when resolving, don't call set_is_default.
12489         * testsuite/ver_test_7.cc: New file.
12490         * testsuite/ver_test_7.sh: New file.
12491         * testsuite/Makefile.am (ver_test_7.so): New target.
12492         (ver_test_7.o): New target.
12493         (check_SCRIPTS): Add ver_test_7.sh.
12494         (check_DATA): Add ver_test_7.syms.
12495         (ver_test_7.syms): New target.
12496
12497 2008-03-28  Ian Lance Taylor  <iant@google.com>
12498
12499         * layout.cc (Layout::layout): If we see an input section with a
12500         name that needs sorting, set the must_sort flag for the output
12501         section.
12502         (Layout::make_output_section): If the name of the output section
12503         indicates that it might require sorting, set the may_sort flag.
12504         * output.h (Output_section::may_sort_attached_input_sections): New
12505         function.
12506         (Output_section::set_may_sort_attached_input_sections): New
12507         function.
12508         (Output_section::must_sort_attached_input_sections): New
12509         function.
12510         (Output_section::set_must_sort_attached_input_sections): New
12511         function.
12512         (class Output_section): Declare Input_section_sort_entry.  Define
12513         Input_section_sort_compare.  Declare
12514         sort_attached_input_sections.  Add new fields:
12515         may_sort_attached_input_sections_,
12516         must_sort_attached_input_sections_,
12517         attached_input_sections_are_sorted_.
12518         * output.cc (Output_section::Output_section): Initialize new
12519         fields.
12520         (Output_section::add_input_section): Add an entry to
12521         input_sections_ if may_sort or must_sort are true.
12522         (Output_section::set_final_data_size): Call
12523         sort_attached_input_sections if necessary.
12524         (Output_section::Input_section_sort_entry): Define new class.
12525         (Output_section::Input_section_sort_compare::operator()): New
12526         function.
12527         (Output_section::sort_attached_input_sections): New function.
12528         * configure.ac: Check whether the compiler supports constructor
12529         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12530         * testsuite/initpri1.c: New file.
12531         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12532         CONSTRUCTOR_PRIORITY.
12533         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12534         (initpri1_LDFLAGS): New variable.
12535         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12536
12537 2008-03-27  Ian Lance Taylor  <iant@google.com>
12538
12539         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12540         * testsuite/common_test_1.c: New file.
12541         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12542         (common_test_1_SOURCES): New variable.
12543         (common_test_1_DEPENDENCIES): New variable.
12544         (common_test_1_LDFLAGS): New variable.
12545
12546         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12547         and commons_ correctly when NAME/VERSION does not override
12548         NAME/NULL.
12549         * testsuite/ver_test_6.c: New file.
12550         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12551         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12552         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12553
12554 2008-03-26  Ian Lance Taylor  <iant@google.com>
12555
12556         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12557         of an undefined symbol from a version script.
12558         * testsuite/Makefile.am (ver_test_5.so): New target.
12559         (ver_test_5.o): New target.
12560         (check_SCRIPTS): Add ver_test_5.sh.
12561         (check_DATA): Add ver_test_5.syms.
12562         (ver_test_5.syms): New target.
12563         * testsuite/ver_test_5.cc: New file.
12564         * testsuite/ver_test_5.script: New file.
12565         * testsuite/ver_test_5.sh: New file.
12566         * Makefile.in, testsuite/Makefile.in: Rebuild.
12567
12568         PR gold/5986
12569         Fix problems building gold with gcc 4.3.0.
12570         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12571         (gold_error_at_location, gold_warning_at_location): Use it.
12572         * configure.ac: Check whether we can compile and use a template
12573         function with a printf attribute.
12574         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12575         when jumping over bytes.
12576         * object.cc: Instantiate Object::read_section_data.
12577         * debug.h: Include <cstring>
12578         * dwarf_reader.cc: Include <algorithm>
12579         * main.cc: Include <cstring>.
12580         * options.cc: Include <cstring>.
12581         * output.cc: Include <cstring>.
12582         * script.cc: Include <cstring>.
12583         * script.h: Include <string>.
12584         * symtab.cc: Include <cstring> and <algorithm>.
12585         * target-select.cc: Include <cstring>.
12586         * version.cc: Include <string>.
12587         * testsuite/testmain.cc: Include <cstdlib>.
12588         * configure, config.in: Rebuild.
12589
12590 2008-03-25  Ian Lance Taylor  <iant@google.com>
12591
12592         * options.cc: Include "../bfd/bfdver.h".
12593         (options::help): Print bug reporting address.
12594
12595         * version.cc (print_version): Adjust output for current value of
12596         BFD_VERSION_STRING.
12597
12598         * NEWS: New file.
12599
12600         * options.cc (options::help): Print list of supported targets.
12601         * target-select.h: Include <vector>.
12602         (class Target_selector): Make machine_, size_, and is_big_endian_
12603         fields const.  Add bfd_name_ and instantiated_target_ fields.
12604         (Target_selector::Target_selector): Add bfd_name parameter.
12605         (Target_selector::recognize): Make non-virtual, call
12606         do_recognize.
12607         (Target_selector::recognize_by_name): Make non-virtual, call
12608         do_recognize_by_name.
12609         (Target_selector::supported_names): New function.
12610         (Target_selector::bfd_name): New function.
12611         (Target_selector::do_instantiate_target): New pure virtual
12612         function.
12613         (Target_selector::do_recognize): New virtual function.
12614         (Target_selector::do_recognize_by_name): New virtual function.
12615         (Target_selector::instantiate_target): New private function.
12616         (supported_target_names): Declare.
12617         * target-select.cc (Target_selector::Target_selector): Update for
12618         new parameter and fields.
12619         (select_target_by_name): Check that the name matches before
12620         calling recognize_by_name.
12621         (supported_target_names): New function.
12622         * i386.cc (class Target_selector_i386): Update Target_selector
12623         constructor call.  Remove recognize and recognize_by_name.  Add
12624         do_instantiate_target.
12625         * x86_64.cc (class Target_selector_x86_64): Likewise.
12626         * testsuite/testfile.cc (class Target_selector_test): Update for
12627         changes to Target_selector.
12628
12629         * README: Rewrite, with some notes on unsupported features.
12630
12631 2008-03-24  Cary Coutant  <ccoutant@google.com>
12632
12633         * i386.cc (Target_i386::Got_type): New enum declaration.
12634         (Target_i386::Scan::local): Updated callers of Output_data_got
12635         member functions.
12636         (Target_i386::Scan::global): Likewise.
12637         (Target_i386::Relocate::relocate): Likewise.
12638         (Target_i386::Relocate::relocate_tls): Likewise.
12639         * object.h (Got_offset_list): New class.
12640         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12641         (Sized_relobj::local_got_offset): Likewise.
12642         (Sized_relobj::set_local_got_offset): Likewise.
12643         (Sized_relobj::local_has_tls_got_offset): Removed.
12644         (Sized_relobj::local_tls_got_offset): Removed.
12645         (Sized_relobj::set_local_tls_got_offset): Removed.
12646         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12647         * output.cc (Output_data_got::add_global): Added got_type parameter.
12648         (Output_data_got::add_global_with_rel): Likewise.
12649         (Output_data_got::add_global_with_rela): Likewise.
12650         (Output_data_got::add_global_pair_with_rel): New function.
12651         (Output_data_got::add_global_pair_with_rela): New function.
12652         (Output_data_got::add_local): Added got_type parameter.
12653         (Output_data_got::add_local_with_rel): Likewise.
12654         (Output_data_got::add_local_with_rela): Likewise.
12655         (Output_data_got::add_local_pair_with_rel): New function.
12656         (Output_data_got::add_local_pair_with_rela): New function.
12657         (Output_data_got::add_global_tls): Removed.
12658         (Output_data_got::add_global_tls_with_rel): Removed.
12659         (Output_data_got::add_global_tls_with_rela): Removed.
12660         (Output_data_got::add_local_tls): Removed.
12661         (Output_data_got::add_local_tls_with_rel): Removed.
12662         (Output_data_got::add_local_tls_with_rela): Removed.
12663         * output.h (Output_data_got::add_global): Added got_type parameter.
12664         (Output_data_got::add_global_with_rel): Likewise.
12665         (Output_data_got::add_global_with_rela): Likewise.
12666         (Output_data_got::add_global_pair_with_rel): New function.
12667         (Output_data_got::add_global_pair_with_rela): New function.
12668         (Output_data_got::add_local): Added got_type parameter.
12669         (Output_data_got::add_local_with_rel): Likewise.
12670         (Output_data_got::add_local_with_rela): Likewise.
12671         (Output_data_got::add_local_pair_with_rel): New function.
12672         (Output_data_got::add_local_pair_with_rela): New function.
12673         (Output_data_got::add_global_tls): Removed.
12674         (Output_data_got::add_global_tls_with_rel): Removed.
12675         (Output_data_got::add_global_tls_with_rela): Removed.
12676         (Output_data_got::add_local_tls): Removed.
12677         (Output_data_got::add_local_tls_with_rel): Removed.
12678         (Output_data_got::add_local_tls_with_rela): Removed.
12679         * resolve.cc (Symbol::override_base_with_special): Removed
12680         reference to has_got_offset_ field.
12681         * symtab.cc (Symbol::init_fields): Replaced initialization
12682         of got_offset_ with got_offsets_.  Removed initialization
12683         of has_got_offset_
12684         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12685         (Symbol::got_offset): Likewise.
12686         (Symbol::set_got_offset): Likewise.
12687         (Symbol::has_tls_got_offset): Removed.
12688         (Symbol::tls_got_offset): Removed.
12689         (Symbol::set_tls_got_offset): Removed.
12690         (Symbol::got_offset_): Removed.
12691         (Symbol::tls_mod_got_offset_): Removed.
12692         (Symbol::tls_pair_got_offset_): Removed.
12693         (Symbol::got_offsets_): New field.
12694         (Symbol::has_got_offset): Removed.
12695         (Symbol::has_tls_mod_got_offset): Removed.
12696         (Symbol::has_tls_pair_got_offset): Removed.
12697         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12698         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12699         member functions.
12700         (Target_x86_64::Scan::global): Likewise.
12701         (Target_x86_64::Relocate::relocate): Likewise.
12702         (Target_x86_64::Relocate::relocate_tls): Likewise.
12703
12704 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12705
12706         * yyscript.y: Fix spelling error in comment.
12707
12708 2008-03-24  Ian Lance Taylor  <iant@google.com>
12709
12710         * options.h (class General_options): Define build_id option.
12711         * layout.h (class Layout): Declare write_build_id, create_note,
12712         create_build_id.  Add build_id_note_ member.
12713         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12714         "libiberty.h", "md5.h", "sha1.h".
12715         (Layout::Layout): Initialize eh_frame_data_,
12716         eh_frame_hdr_section_, and build_id_note_.
12717         (Layout::finalize): Call create_build_id.
12718         (Layout::create_note): New function, broken out of
12719         Layout::create_gold_note.
12720         (Layout::create_gold_note): Call create_note.
12721         (Layout::create_build_id): New function.
12722         (Layout::write_build_id): New function.
12723         (Close_task_runner::run): Call write_build_id.
12724
12725         * x86_64.cc: Correct license to GPLv3.
12726
12727 2008-03-23  Ian Lance Taylor  <iant@google.com>
12728
12729         * options.cc: Include "demangle.h".
12730         (parse_optional_string): New function.
12731         (parse_long_option): Handle takes_optional_argument.
12732         (parse_short_option): Update dash_z initializer.  Handle
12733         takes_optional_argument.
12734         (General_options::General_options): Initialize do_demangle_.
12735         (General_options::finalize): Set do_demangle_.  Handle demangling
12736         style.
12737         * options.h (parse_optional_string): Declare.
12738         (struct One_option): Add optional_arg field.  Update constructor.
12739         Update call constructor calls.  Add takes_optional_argument
12740         function.
12741         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12742         (DEFINE_optional_string): Define.
12743         (General_options::demangle): Change from DEFINE_bool to
12744         DEFINE_optional_string.
12745         (General_options::no_demangle): New function.
12746         (General_options::do_demangle): New function.
12747         (General_options::set_do_demangle): New function.
12748         (General_options::execstack_status_): Move definition to end of
12749         class definition.
12750         (General_options::static_): Likewise.
12751         (General_options::do_demangle_): New field.
12752         * object.cc (big_endian>::get_symbol_location_info): Call
12753         Options::do_demangle, not Options::demangle.
12754         * symtab.cc (demangle): Likewise.
12755
12756 2008-03-22  Ian Lance Taylor  <iant@google.com>
12757
12758         * gold.h: Include <cstddef> and <sys/types.h>
12759         * options.h: Include <cstring>.
12760
12761 2008-03-21  Ian Lance Taylor  <iant@google.com>
12762
12763         * Added source code to GNU binutils.