2012-03-19 Doug Kwan <dougkwan@google.com>
[external/binutils.git] / gold / ChangeLog
1 2012-03-19  Doug Kwan  <dougkwan@google.com>
2
3         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4         (Target_arm::do_finalize_sections): Remove code which defines
5         __exidx_start and __exidx_end.  Make symbol table parameter
6         anonymous as it is not used.
7         * gold.cc (queue_middle_tasks): Call target hook to define any
8         target-specific symbols.
9         * target.h (Target::define_standard_symbols): New method.
10         (Target::do_define_standard_symbols): Same.
11         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
12         * testsuite/Makefile.in: Regenerate.
13         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
14         and __exidx_end.
15         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
16         relocations are generated for __exidx_start and __exidx_end.
17
18 2012-03-16  Doug Kwan  <dougkwan@google.com>
19
20         * testsuite/Makefile.am: Disable test initpri3b.
21         * testsuite/Makefile.in: Regenerate.
22
23 2012-03-15  Doug Kwan  <dougkwan@google.com>
24
25         * arm.cc (Target_arm::got_section): Make .got section read-only
26         if -z now is given.
27
28 2012-03-15  Ian Lance Taylor  <iant@google.com>
29
30         PR gold/13850
31         * layout.cc (Layout::make_output_section): Correctly mark
32         SHT_INIT_ARRAY, et. al., as relro.
33
34 2012-03-14  Doug Kwan  <dougkwan@google.com>
35
36         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
37         dynamic relocations for protected symbols in shared objects.
38
39 2012-03-13  Ian Lance Taylor  <iant@google.com>
40
41         * resolve.cc (Symbol_table::resolve): When merging common symbols,
42         keep the larger alignment.
43
44 2012-03-12  Cary Coutant  <ccoutant@google.com>
45
46         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
47         handling of DW_LNE_define_file.
48
49 2012-03-12  Cary Coutant  <ccoutant@google.com>
50
51         * reduced_debug_output.cc
52         (Output_reduced_debug_info_section::get_die_end): Add new FORM
53         codes to switch.
54
55 2012-02-29  Cary Coutant  <ccoutant@google.com>
56
57         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
58
59 2012-02-29  Cary Coutant  <ccoutant@google.com>
60
61         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
62         Call Object::decompressed_section_contents.
63         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
64         New dtor.
65         (Sized_dwarf_line_info::buffer_start_): New data member.
66         * merge.cc (Output_merge_data::do_add_input_section): Call
67         Object::decompressed_section_contents.
68         (Output_merge_string::do_add_input_section): Likewise.
69         * object.cc (need_decompressed_section): New function.
70         (build_compressed_section_map): Decompress sections needed later.
71         (Sized_relobj_file::do_decompressed_section_contents): New function.
72         (Sized_relobj_file::do_discard_decompressed_sections): New function.
73         * object.h (Object::decompressed_section_contents): New function.
74         (Object::discard_decompressed_sections): New function.
75         (Object::do_decompressed_section_contents): New function.
76         (Object::do_discard_decompressed_sections): New function.
77         (Compressed_section_info): New type.
78         (Compressed_section_map): Include decompressed section contents.
79         (Sized_relobj_file::do_decompressed_section_contents): New function.
80         (Sized_relobj_file::do_discard_decompressed_sections): New function.
81
82 2012-02-16  Cary Coutant  <ccoutant@google.com>
83
84         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
85         * testsuite/Makefile.in: Regenerate.
86
87 2012-02-14  Cary Coutant  <ccoutant@google.com>
88
89         * options.cc (General_options::finalize): Disallow -pie and -static.
90
91 2012-02-03  Doug Kwan  <dougkwan@google.com>
92
93         * arm.cc (Arm_relocate_functions::abs8,
94         Arm_relocate_functions::abs16): Use
95         Bits::has_signed_unsigned_overflow32.
96         (Arm_relocate_functions::thm_abs8): Correct range of
97         overflow check.
98         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
99         in assertions.
100
101 2012-02-02  Doug Kwan  <dougkwan@google.com>
102
103         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
104         position independent outputs, not just shared objects.
105
106 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
107
108         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
109         * configure: Regenerated.
110
111 2012-01-27  Ian Lance Taylor  <iant@google.com>
112
113         * reloc.h (Bits): New class with static functions, copied from
114         namespace utils in arm.cc.
115         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
116         instead.
117
118 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
119
120         * incremental.cc (write_info_blocks): Correct relocation offset.
121
122 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
123
124         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
125         (Relocate::tls_gd_to_le): Likewise.
126
127 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
128
129         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
130
131 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
132
133         * configure.ac: Check if -mcmodel=medium works.
134         * configure: Regenerated.
135
136 2012-01-24  Cary Coutant  <ccoutant@google.com>
137
138         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
139         definition and ...
140         (read_unsigned_LEB_128_x): ... this new function.
141         (read_signed_LEB_128): Replaced with inline definition and ...
142         (read_signed_LEB_128_x): ... this new function.
143         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
144         (read_unsigned_LEB_128): Add inline definition.
145         (read_signed_LEB_128_x): New function.
146         (read_signed_LEB_128): Add inline definition.
147         * testsuite/Makefile.am (leb128_unittest): New unit test.
148         * testsuite/Makefile.in: Regenerate.
149         * testsuite/leb128_unittest.cc: New unit test.
150
151 2012-01-23  Ian Lance Taylor  <iant@google.com>
152
153         PR gold/13617
154         * i386.cc (Target_i386::do_code_fill): When using a jmp
155         instruction, pad with nop instructions.
156         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
157
158 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
159
160         * x86_64.cc (gc_process_relocs): Add typename on types used in
161         template.
162         (scan_relocs): Likewise.
163         (relocate_section): Likewise.
164         (apply_relocation): Likewise.
165
166 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
167
168         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
169         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
170         under x32.
171
172 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
173
174         * x86_64.cc: Initial support for x32.
175
176 2012-01-03  Cary Coutant  <ccoutant@google.com>
177
178         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
179         Use abstract base class for GOT.
180         * gold/output.h (class Output_data_got_base): New abstract base class.
181         (class Output_data_got): Derive from new base class, adjust ctors.
182         (Output_data_got::reserve_slot): Make virtual; rename to
183         do_reserve_slot; Adjust callers.
184         * gold/target.h (Sized_target::init_got_plt_for_update): Return
185         pointer to abstract base class.
186         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
187
188 2011-12-18  Ian Lance Taylor  <iant@google.com>
189
190         * object.h (Relobj::local_symbol_value): New function.
191         (Relobj::local_plt_offset): New function.
192         (Relobj::local_has_got_offset): New function.
193         (Relobj::local_got_offset): New function.
194         (Relobj::set_local_got_offset): New function.
195         (Relobj::do_local_symbol_value): New pure virtual function.
196         (Relobj::do_local_plt_offset): Likewise.
197         (Relobj::do_local_has_got_offset): Likewise.
198         (Relobj::do_local_got_offset): Likewise.
199         (Relobj::do_set_local_got_offset): Likewise.
200         (Sized_relobj::do_local_has_got_offset): Rename from
201         local_has_got_offset.
202         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
203         (Sized_relobj::do_set_local_got_offset): Rename from
204         set_local_got_offset.
205         (Sized_relobj_file::do_local_plt_offset): Rename from
206         local_plt_offset.
207         (Sized_relobj_file::do_local_symbol_value): New function.
208         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
209         local_plt_offset.
210         * output.cc (Output_data_got::Got_entry::write): Change object to
211         Relobj.  Use local_symbol_value.
212         (Output_data_got::add_global_with_rel): Change rel_dyn to
213         Output_data_reloc_generic*.  Use add_global_generic.
214         (Output_data_got::add_global_with_rela): Remove.  Change all
215         callers to use add_global_with_rel.
216         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
217         Output_data_reloc_generic*.  Use add_global_generic.
218         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
219         callers to use add_global_pair_with_rel.
220         (Output_data_got::add_local): Change object to Relobj*.
221         (Output_data_got::add_local_plt): Likewise.
222         (Output_data_got::add_local_with_rel): Change object to Relobj*,
223         change rel_dyn to Output_data_reloc_generic*.  Use
224         add_local_generic.
225         (Output_data_got::add_local_with_rela): Remove.  Change all
226         callers to use all_local_with_rel.
227         (Output_data_got::add_local_pair_with_rel): Change object to
228         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
229         add_output_section_generic.
230         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
231         callers to use add_local_pair_with_rel.
232         (Output_data_got::reserve_local): Change object to Relobj*.
233         * output.h: (class Output_data_reloc_generic): Add pure virtual
234         declarations for add_global_generic, add_local_generic,
235         add_output_section_generic.
236         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
237         functions for Output_data_reloc_generic.  Update declarations for
238         changes listed in output.cc.
239         (class Output_data_got): Change template parameter to got_size.
240         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
241         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
242         function.
243         (Sized_relobj_incr::do_local_plt_offset): New function.
244         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
245         add_global_generic.
246
247 2011-12-17  Cary Coutant  <ccoutant@google.com>
248
249         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
250         * resolve.cc (Symbol_table::resolve): Likewise.
251         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
252         arrays.
253         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
254
255 2011-12-16  Ian Lance Taylor  <iant@google.com>
256
257         * output.h (Output_data_reloc_generic::add): Only call
258         add_dynamic_reloc if this is a dynamic reloc section.
259
260 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
261
262         PR gold/13505
263         * target-reloc.h (apply_relocation): Replace <64, false> with
264         <size, big_endian>.
265
266 2011-11-25  Nick Clifton  <nickc@redhat.com>
267
268         * po/it.po: New Italian translation.
269
270 2011-11-17  Sterling Augustine  <saugustine@google.com>
271
272         * script.cc (script_include_directive): Implement.
273         (read_script_file): New local variables name and search_path. Update
274         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
275         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
276         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
277
278 2011-11-11  Sterling Augustine  <saugustine@google.com>
279
280         * yyscript.y (section_cmd): Add support for INCLUDE directive.
281         (file_or_sections_cmd): Likewise.
282
283 2011-11-11  Doug Kwan  <dougkwan@google.com>
284
285         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
286         if --just-symbols is given.
287
288 2011-11-10  Doug Kwan  <dougkwan@google.com>
289
290         PR gold/13362
291         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
292         when processing data relocs.
293         * reloc.h (Relocate_functions::rel_unaligned): New method.
294         (Relocate_functions::pcrel_unaligned): Ditto.
295         (Relocate_functions::rel32_unaligned): Ditto.
296         (Relocate_functions::pcrel32_unaligned): Ditto.
297
298 2011-11-09  Doug Kwan  <dougkwan@google.com>
299
300         PR gold/13362
301         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
302         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
303         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
304         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
305         (Relocate_functions::rel_unaligned): New.
306         (Relocate_functions::rel32_unaligned): New.
307         * target-reloc.h (relocate_for_relocatable): Add code to handle
308         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
309         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
310         arm_unaligned_reloc_r): New targets.
311         * testsuite/Makefile.in: Regenerate.
312         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
313         linking.
314
315 2011-11-02  Ian Lance Taylor  <iant@google.com>
316
317         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
318         NATIVE_LINKER.
319         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
320         * options.cc (General_options::finalize): Use library search path
321         from configure script if specified.  If not native and no sysroot,
322         only search TOOLLIBDIR.
323         * options.h (Search_directory::Search_directory): Change name to
324         const std::string&.
325         (General_options::add_to_library_path_with_sysroot): Change arg to
326         const std::string&.
327         * configure, Makefile.in, config.in: Rebuild.
328
329 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
330
331         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
332         we are working around the ARM1176 Erratum.
333         * options.h (General_options::fix_arm1176): Add option.
334         * testsuite/Makefile.am: Add testcases, and keep current ones
335         working.
336         * testsuite/Makefile.in: Regenerate.
337         * testsuite/arm_fix_1176.s: New file.
338         * testsuite/arm_fix_1176.sh: Likewise.
339
340 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
341
342         * arm.cc (Target_arm::Target_arm): Remove initialisation of
343         may_use_blx_.
344         (Target_arm::may_use_blx): Remove method.
345         (Target_arm::set_may_use_blx): Likewise.
346         (Target_arm::may_use_v4t_interworking): New method.
347         (Target_arm::may_use_v5t_interworking): Likewise.
348         (Target_arm::may_use_blx_): Remove member variable.
349         (Arm_relocate_functions::arm_branch_common): Check for v5T
350         interworking.
351         (Arm_relocate_functions::thumb_branch_common): Likewise.
352         (Reloc_stub::stub_type_for_reloc): Likewise.
353         (Target_arm::do_finalize_sections): Correct interworking checks.
354         * testsuite/Makefile.am: Add new tests.
355         * testsuite/Makefile.in: Regenerate.
356         * testsuite/arm_farcall_arm_arm.s: New test.
357         * testsuite/arm_farcall_arm_arm.sh: Likewise.
358         * testsuite/arm_farcall_arm_thumb.s: Likewise.
359         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
360         * testsuite/arm_farcall_thumb_arm.s: Likewise.
361         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
362         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
363         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
364
365 2011-10-31  Cary Coutant  <ccoutant@google.com>
366
367         PR gold/13023
368         * expression.cc (Expression::eval_with_dot): Add
369         is_section_dot_assignment parameter.
370         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
371         absolute and assigning to dot within a section.
372         * script-sections.cc
373         (Output_section_element_assignment::set_section_addresses): Pass
374         dot_section to set_if_absolute.
375         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
376         as is_section_dot_assignment flag to eval_with_dot.
377         (Output_section_element_dot_assignment::set_section_addresses):
378         Likewise.
379         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
380         parameter.  Also set value if relative to dot_section; set the
381         symbol's output_section.
382         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
383         parameter.  Adjust all callers.
384         (Expression::eval_maybe_dot): Likewise.
385         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
386         Adjust all callers.
387         * testsuite/script_test_2.t: Test assignment of an absolute value
388         to dot within an output section element.
389
390 2011-10-31  Cary Coutant  <ccoutant@google.com>
391
392         * options.h (class General_options): Add --[no-]gnu-unique options.
393         * symtab.cc (Symbol_table::sized_write_globals): Convert
394         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
395
396 2011-10-31  Cary Coutant  <ccoutant@google.com>
397
398         PR gold/13359
399         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
400         unnecessary assertion.
401         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
402
403 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
404
405         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
406         gc_mark_symbol.
407         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
408         gc_mark_symbol.
409         Change to just keep the section associated with symbol.
410         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
411         they are externally visible and --export-dynamic is turned on.
412         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
413
414 2011-10-19  Ian Lance Taylor  <iant@google.com>
415
416         PR gold/13163
417         * script-sections.cc
418         (Output_section_element_dot_assignment::needs_output_section): New
419         function.
420
421 2011-10-19  Ian Lance Taylor  <iant@google.com>
422
423         PR gold/13204
424         * layout.cc (Layout::segment_precedes): Don't assert failure if a
425         --section-start option was seen.
426         * options.h (General_options::any_section_start): New function.
427
428 2011-10-18  David S. Miller  <davem@davemloft.net>
429
430         PR binutils/13301
431         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
432         member to track relocation locations that have moved during TLS
433         reloc optimizations.
434         (Target_sparc::Relocate::Relocate): Initialize to NULL.
435         (Target_sparc::Relocate::relocate): Adjust view down by 4
436         bytes if it matches reloc_adjust_addr_.
437         (Target_sparc::Relocate::relocate_tls): Always move the
438         __tls_get_addr call delay slot instruction forward 4 bytes when
439         performing relaxation.
440
441 2011-10-18  Cary Coutant  <ccoutant@google.com>
442
443         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
444         (Output_file::map_no_anonymous): Check for non-zero
445         return code from posix_fallocate.
446
447 2011-10-17  Cary Coutant  <ccoutant@google.com>
448
449         PR gold/13245
450         * plugin.cc (is_visible_from_outside): Check for symbols
451         referenced from dynamic objects.
452         * resolve.cc (Symbol_table::resolve): Don't count references
453         from dynamic objects as references from real ELF files.
454         * testsuite/plugin_test_2.sh: Adjust expected result.
455
456 2011-10-17  Cary Coutant  <ccoutant@google.com>
457
458         * gold.cc: Include timer.h.
459         (queue_middle_tasks): Stamp time.
460         (queue_final_tasks): Likewise.
461         * main.cc (main): Store timer in parameters.  Print timers
462         for each pass.
463         * parameters.cc (Parameters::Parameters): Initialize timer_.
464         (Parameters::set_timer): New function.
465         (set_parameters_timer): New function.
466         * parameters.h (Parameters::set_timer): New function.
467         (Parameters::timer): New function.
468         (Parameters::timer_): New data member.
469         (set_parameters_timer): New function.
470         * timer.cc (Timer::stamp): New function.
471         (Timer::get_pass_time): New function.
472         * timer.h (Timer::stamp): New function.
473         (Timer::get_pass_time): New function.
474         (Timer::pass_times_): New data member.
475
476 2011-10-17  Cary Coutant  <ccoutant@google.com>
477
478         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
479         task for members of lib groups.
480
481 2011-10-17  Cary Coutant  <ccoutant@google.com>
482
483         PR gold/13288
484         * fileread.cc (File_read::find_view): Add assert.
485         (File_read::make_view): Move bounds check (replace with assert)...
486         (File_read::find_or_make_view): ... to here.
487
488 2011-10-12  Cary Coutant  <ccoutant@google.com>
489
490         * output.cc (Output_file::open_base_file): Handle case where
491         ::read returns less than requested size.
492
493 2011-10-10  Cary Coutant  <ccoutant@google.com>
494
495         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
496         Initialize defined_count_.
497         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
498         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
499         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
500         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
501         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
502         * incremental.h (Sized_relobj_incr::defined_count_): New data
503         member.
504         (Sized_incr_dynobj::defined_count_): New data member.
505         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
506         Return zeroes instead of internal error.
507
508 2011-10-10  Cary Coutant  <ccoutant@google.com>
509
510         PR gold/13249
511         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
512         (Output_reloc::symbol_value): Return PLT offset if flag is set.
513         * output.h (class Output_reloc): Add use_plt_offset flag.
514         (Output_reloc::type_): Adjust size of bit field.
515         (Output_reloc::use_plt_offset_): New bit field.
516         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
517         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
518         flag.  Adjust all callers.
519         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
520         creating RELATIVE relocations.
521
522 2011-10-10  Nick Clifton  <nickc@redhat.com>
523
524         * po/es.po: Updated Spanish translation.
525         * po/fi.po: Updated Finnish translation.
526
527 2011-10-03   Diego Novillo  <dnovillo@google.com>
528
529         * options.cc (parse_uint): Fix dereference of RETVAL.
530
531 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
532
533         * layout.h (section_order_map_): New member.
534         (get_section_order_map): New member function.
535         * output.cc (Output_section::add_input_section): Check for patterns
536         only when --section-ordering-file is specified.
537         * gold.cc (queue_middle_tasks): Delay updating order of sections till
538         output_sections have been formed.
539         * layout.cc (Layout_Layout): Initialize section_order_map_.
540         * plugin.cc (update_section_order): Store order in order_map. Do not
541         update the order.
542         * testsuite/Makefile.am: Add test case for plugin_final_layout.
543         * testsuite/Makefile.in: Regenerate.
544         * testsuite/plugin_section_order.c: New file.
545         * testsuite/plugin_final_layout.cc: New file.
546         * testsuite/plugin_final_layout.sh: New file.
547
548 2011-09-29  Cary Coutant  <ccoutant@google.com>
549
550         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
551         Check for NULL.
552         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
553         symbols during incremental update.
554         (Symbol_table::add_from_dynobj): Likewise.
555
556 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
557             Ian Lance Taylor  <iant@google.com>
558
559         * symtab.cc (Symbol_table::define_special_symbol): Always
560         canonicalize version string.
561
562 2011-09-26  Cary Coutant  <ccoutant@google.com>
563
564         * gold.cc (queue_initial_tasks): Move option checks ...
565         * options.cc (General_options::finalize): ... to here. Disable
566         some options; make others fatal.
567
568 2011-09-26  Cary Coutant  <ccoutant@google.com>
569
570         gcc PR lto/47247
571         * plugin.cc (get_symbols_v2): New function.
572         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
573         (is_referenced_from_outside): New function.
574         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
575         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
576         (get_symbols): Pass version parameter.
577         (get_symbols_v2): New function.
578         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
579         parameter.
580         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
581         (onload): Add LDPT_GET_SYMBOLS_V2.
582         (all_symbols_read_hook): Use get_symbols_v2; check for
583         LDPR_PREVAILING_DEF_IRONLY_EXP.
584         * testsuite/plugin_test_3.sh: Update expected results.
585
586 2011-09-23  Simon Baldwin  <simonb@google.com>
587
588         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
589         configuration options.
590         * configure: Regenerate.
591         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
592         * Makefile.in: Regenerate.
593         * testsuite/Makefile.in: Regenerate.
594
595 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
596
597         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
598
599 2011-09-19  Cary Coutant  <ccoutant@google.com>
600
601         * incremental.cc (can_incremental_update): Fix typo in comment.
602         * incremental.h (can_incremental_update): Likewise.
603
604 2011-09-18  Cary Coutant  <ccoutant@google.com>
605
606         * incremental.cc (can_incremental_update): New function.
607         * incremental.h (can_incremental_update): New function.
608         * layout.cc (Layout::init_fixed_output_section): Call it.
609         (Layout::make_output_section): Don't allow patch space in .eh_frame.
610         * object.cc (Sized_relobj_file::do_layout): Call
611         can_incremental_update.
612
613 2011-09-13  Cary Coutant  <ccoutant@google.com>
614
615         * configure.ac: Check for glibc support for gnu_indirect_function
616         support with static linking, setting automake conditional
617         IFUNC_STATIC.
618         * Makefile.in: Regenerate.
619         * configure: Regenerate.
620
621         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
622         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
623         for IFUNC_STATIC.
624         * testsuite/Makefile.in: Regenerate.
625
626 2011-09-13  Cary Coutant  <ccoutant@google.com>
627
628         * incremental.cc (Sized_relobj_incr::do_layout): Call
629         report_comdat_group for kept comdat sections.
630         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
631         * testsuite/Makefile.in: Regenerate.
632         * testsuite/incr_comdat_test_1.cc: New source file.
633         * testsuite/incr_comdat_test_2_v1.cc: New source file.
634         * testsuite/incr_comdat_test_2_v2.cc: New source file.
635         * testsuite/incr_comdat_test_2_v3.cc: New source file.
636
637 2011-09-13  Ian Lance Taylor  <iant@google.com>
638
639         * object.cc (Sized_relobj_file::do_layout): Remove unused local
640         variable external_symbols_offset.
641
642 2011-09-12  Ian Lance Taylor  <iant@google.com>
643
644         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
645         triggered if object has no symbols.
646
647 2011-09-09  David S. Miller  <davem@davemloft.net>
648
649         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
650         (Output_fill_debug_line::do_write): Likewise.
651
652 2011-08-29  Cary Coutant  <ccoutant@google.com>
653
654         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
655         casts to match formatting specs.
656         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
657
658 2011-08-26  Cary Coutant  <ccoutant@google.com>
659
660         * layout.cc (Free_list::allocate): Provide guarantee of minimum
661         remaining hole size when allocating.
662         (Layout::make_output_section): Set fill methods for debug sections.
663         * layout.h (Free_list::Free_list_node): Move from private to
664         public.
665         (Free_list::set_min_hole_size): New function.
666         (Free_list::begin, Free_list::end): New functions.
667         (Free_list::min_hole_): New data member.
668         * output.cc: Include dwarf.h.
669         (Output_fill_debug_info::do_minimum_hole_size): New function.
670         (Output_fill_debug_info::do_write): New function.
671         (Output_fill_debug_line::do_minimum_hole_size): New function.
672         (Output_fill_debug_line::do_write): New function.
673         (Output_section::Output_section): Initialize new data member.
674         (Output_section::set_final_data_size): Ensure patch space is larger
675         than minimum hole size.
676         (Output_section::do_write): Fill holes in debug sections.
677         * output.h (Output_fill): New class.
678         (Output_fill_debug_info): New class.
679         (Output_fill_debug_line): New class.
680         (Output_section::set_free_space_fill): New function.
681         (Output_section::free_space_fill_): New data member.
682         * testsuite/Makefile.am (incremental_test_3): Add
683         --incremental-patch option.
684         (incremental_test_4): Likewise.
685         (incremental_test_5): Likewise.
686         (incremental_test_6): Likewise.
687         (incremental_copy_test): Likewise.
688         (incremental_common_test_1): Likewise.
689         * testsuite/Makefile.in: Regenerate.
690
691 2011-08-26  Nick Clifton  <nickc@redhat.com>
692
693         * po/es.po: Updated Spanish translation.
694
695 2011-08-01  Cary Coutant  <ccoutant@google.com>
696
697         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
698         * gold/testsuite/Makefile.in: Regenerate.
699         * gold/testsuite/justsyms_exec.c: New source file.
700         * gold/testsuite/justsyms_lib.c: New source file.
701
702 2011-08-01  Cary Coutant  <ccoutant@google.com>
703
704         * layout.cc (Layout::set_segment_offsets): Don't realign text
705         segment if -Ttext was specified.
706         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
707         file type.
708         * object.h (Sized_relobj_file::e_type): New function.
709         (Sized_relobj_file::e_type_): New data member.
710         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
711         base address for ET_EXEC files.
712         * target.cc (Target::do_make_elf_object_implementation): Allow
713         ET_EXEC files with --just-symbols option.
714
715 2011-07-28  Cary Coutant  <ccoutant@google.com>
716
717         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
718         Add thread_number parameter.
719         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
720         * workqueue-threads.cc
721         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
722         current thread if its thread number is greater than desired thread
723         count.
724         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
725         Add thread_number parameter.
726         (Workqueue::should_cancel_thread): Likewise.
727         (Workqueue::find_runnable_or_wait): Pass thread_number to
728         should_cancel_thread.
729         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
730         parameter.
731
732 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
733
734         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
735         only after checking if it cannot be forced local.
736         * symtab.h (is_externally_visible): Check if the symbol is not forced
737         local.
738
739 2011-07-15  Ian Lance Taylor  <iant@google.com>
740
741         * options.h (class General_options): Add --print-output-format.
742         Move -EL next to -EB, for  better --help output.
743         * target-select.cc: Include <cstdio>, "options.h", and
744         "parameters.h".
745         (Target_selector::do_target_bfd_name): New function.
746         (print_output_format): New function.
747         * target-select.h (class Target_selector): Update declarations.
748         (Target_selector::target_bfd_name): New function.
749         (print_output_format): Declare.
750         * main.cc: Include "target-select.h".
751         (main): Handle --print-output-format.
752         * gold.cc: Include "target-select.h".
753         (queue_initial_tasks): Handle --print-output-format when there are
754         no input files.
755         * parameters.cc (parameters_force_valid_target): Give a better
756         error message if -EB/-EL does not match target.
757         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
758         function.
759
760 2011-07-15  Ian Lance Taylor  <iant@google.com>
761
762         * i386.cc (class Output_data_plt_i386): Add layout_ field.
763         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
764         (Output_data_plt_i386::do_write): Write address of .dynamic
765         section to first entry in .got.plt section.
766         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
767         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
768         Initialize layout_.
769         (Output_data_plt_x86_64::do_write): Write address of .dynamic
770         section to first entry in .got.plt section.
771         * layout.h (Layout::dynamic_section): New function.
772
773 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
774
775         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
776         to claim_file call.
777         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
778         input_section_position_, and input_section_glob_.
779         (read_layout_from_file): Call function section_ordering_specified.
780         * layout.h (is_section_ordering_specified): New function.
781         (section_ordering_specified): New function.
782         (section_ordering_specified_): New boolean member.
783         * main.cc(main): Call load_plugins after layout object is defined.
784         * output.cc (Output_section::add_input_section): Use
785         function section_ordering_specified to check if section ordering is
786         needed.
787         * output.cc (Output_section::add_relaxed_input_section): Use
788         function section_ordering_specified to check if section ordering is
789         needed.
790         (Output_section::update_section_layout): New function.
791         (Output_section::sort_attached_input_sections): Check if input section
792         must be reordered.
793         * output.h (Output_section::update_section_layout): New function.
794         * plugin.cc (get_section_count): New function.
795         (get_section_type): New function.
796         (get_section_name): New function.
797         (get_section_contents): New function.
798         (update_section_order): New function.
799         (allow_section_ordering): New function. 
800         (Plugin::load): Add the new interfaces to the transfer vector.
801         (Plugin_manager::load_plugins): New parameter.
802         (Plugin_manager::all_symbols_read): New parameter.
803         (Plugin_manager::claim_file): New parameter. Save the elf object for
804         unclaimed objects.
805         (Plugin_manager::get_elf_object): New function.
806         (Plugin_manager::get_view): Change to directly use the bool to check
807         if get_view is called from claim_file_hook.
808         * plugin.h (input_objects): New function
809         (Plugin__manager::load_plugins): New parameter.
810         (Plugin_manager::claim_file): New parameter.
811         (Plugin_manager::get_elf_object): New function.
812         (Plugin_manager::in_claim_file_handler): New function.
813         (Plugin_manager::in_claim_file_handler_): New member.
814         (layout): New function.
815         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
816         handler with an extra parameter. Make the elf object before calling
817         claim_file handler.
818         * testsuite/plugin_test.c (get_section_count): New function pointer.
819         (get_section_type): New function pointer.
820         (get_section_name): New function pointer.
821         (get_section_contents): New function pointer.
822         (update_section_order): New function pointer.
823         (allow_section_ordering): New function pointer.
824         (onload): Check if the new interfaces exist.
825
826 2011-07-13  Ian Lance Taylor  <iant@google.com>
827
828         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
829         relro section.
830         * x86_64.cc (Target_x86_64::got_section): Likewise.
831         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
832         (relro_now_test_SOURCES): New variable.
833         (relro_now_test_DEPENDENCIES): New variable.
834         (relro_now_test_LDFLAGS): New variable.
835         (relro_now_test_LDADD): New variable.
836         (relro_now_test.so): New target.
837         * testsuite/Makefile.in: Rebuild.
838
839 2011-07-12  Ian Lance Taylor  <iant@google.com>
840
841         PR gold/12980
842         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
843         GLOB_DAT relocation rather than a RELATIVE relocation for a
844         protected symbol when creating a shared library.
845         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
846         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
847         * testsuite/protected_main_1.cc (main): Test that protected
848         function has same address.
849
850 2011-07-11  Ian Lance Taylor  <iant@google.com>
851
852         PR gold/12979
853         * options.h (class General_options): Add -Bgroup.
854         * options.cc (General_options::finalize): If -Bgroup is set,
855         default to --unresolved-symbols=report-all.
856         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
857         * target-reloc.h (issue_undefined_symbol_error): Handle
858         --unresolved-symbols=report-all.
859
860 2011-07-08  Ian Lance Taylor  <iant@google.com>
861
862         PR gold/11985
863         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
864         if linker script discards key sections.
865         (Layout::create_dynamic_symtab): Likewise.
866         (Layout::assign_local_dynsym_offsets): Likewise.
867         (Layout::sized_create_version_sections): Likewise.
868         (Layout::create_interp): Likewise.
869         (Layout::finish_dynamic_section): Likewise.
870         (Layout::set_dynamic_symbol_size): Likewise.
871
872 2011-07-08  Ian Lance Taylor  <iant@google.com>
873
874         PR gold/12386
875         * options.h (class General_options): Add --unresolved-symbols.
876         * target-reloc.h (issue_undefined_symbol_error): Check
877         --unresolved-symbols.  Add comments.
878
879 2011-07-08  Ian Lance Taylor  <iant@google.com>
880
881         * testsuite/odr_violation2.cc (Ordering::operator()): Make
882         expression more complex.
883
884 2011-07-08  Ian Lance Taylor  <iant@google.com>
885
886         PR gold/11317
887         * target-reloc.h (issue_undefined_symbol_error): New inline
888         function, broken out of relocate_section.
889         (relocate_section): Call issue_undefined_symbol_error.
890         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
891         there is no TLS segment if we are about to issue an undefined
892         symbol error.
893         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
894
895 2011-07-08  Ian Lance Taylor  <iant@google.com>
896
897         PR gold/12279
898         * resolve.cc (Symbol_table::should_override): Add fromtype
899         parameter.  Change all callers.  Give error when linking together
900         TLS and non-TLS symbol.
901         (Symbol_table::should_override_with_special): Add fromtype
902         parameter.  Change all callers.
903         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
904         there is no TLS segment if we have reported some errors.
905         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
906
907 2011-07-08  Ian Lance Taylor  <iant@google.com>
908
909         PR gold/12372
910         * target.h (Target::plt_address_for_global): New function.
911         (Target::plt_address_for_local): New function.
912         (Target::plt_section_for_global): Remove.
913         (Target::plt_section_for_local): Remove.
914         (Target::do_plt_address_for_global): New virtual function.
915         (Target::do_plt_address_for_local): New virtual function.
916         (Target::do_plt_section_for_global): Remove.
917         (Target::do_plt_section_for_local): Remove.
918         (Target::register_global_plt_entry): Add Symbol_table and Layout
919         parameters.
920         * output.cc (Output_data_got::Got_entry::write): Use
921         plt_address_for_global and plt_address_for_local.
922         * layout.cc (Layout::add_target_dynamic_tags): Use size and
923         address of output section.
924         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
925         got_irelative_, and irelative_count_ fields.  Update
926         declarations.
927         (Output_data_plt_i386::has_irelative_section): New function.
928         (Output_data_plt_i386::entry_count): Add irelative_count_.
929         (Output_data_plt_i386::set_final_data_size): Likewise.
930         (class Target_i386): Add got_irelative_ and rel_irelative_
931         fields.  Update declarations.
932         (Target_i386::Target_i386): Initialize new fields.
933         (Target_i386::do_plt_address_for_global): New function replacing
934         do_plt_section_for_global.
935         (Target_i386::do_plt_address_for_local): New function replacing
936         do_plt_section_for_local.
937         (Target_i386::got_section): Create got_irelative_.
938         (Target_i386::rel_irelative_section): New function.
939         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
940         fields.  Don't define __rel_iplt_{start,end}.
941         (Output_data_plt_i386::add_entry): Add symtab and layout
942         parameters.  Change all callers.  Use different PLT and GOT for
943         IFUNC symbols.
944         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
945         layout parameters.  Change all callers.  Use different PLT and
946         GOT.
947         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
948         (Output_data_plt_i386::rel_irelative): New function.
949         (Output_data_plt_i386::address_for_global): New function.
950         (Output_data_plt_i386::address_for_local): New function.
951         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
952         IRELATIVE GOT when changing IFUNC GOT entries.
953         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
954         reloc.
955         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
956         if we didn't create an IRELATIVE GOT.
957         (Target_i386::Relocate::relocate): Use plt_address_for_global and
958         plt_address_for_local.
959         (Target_i386::do_dynsym_value): Use plt_address_for_global.
960         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
961         got_irelative_, and irelative_count_ fields.  Update
962         declarations.
963         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
964         Initialize new fields.  Remove symtab parameter.  Change all
965         callers.
966         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
967         irelative_count_.
968         (Output_data_plt_x86_64::has_irelative_section): New function.
969         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
970         (class Target_x86_64): Add got_irelative_ and rel_irelative_
971         fields.  Update declarations.
972         (Target_x86_64::Target_x86_64): Initialize new fields.
973         (Target_x86_64::do_plt_address_for_global): New function replacing
974         do_plt_section_for_global.
975         (Target_x86_64::do_plt_address_for_local): New function replacing
976         do_plt_section_for_local.
977         (Target_x86_64::got_section): Create got_irelative_.
978         (Target_x86_64::rela_irelative_section): New function.
979         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
980         all callers.  Don't create __rel_iplt_{start,end}.
981         (Output_data_plt_x86_64::add_entry): Add symtab and layout
982         parameters.  Change all callers.  Use different PLT and GOT for
983         IFUNC symbols.
984         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
985         layout parameters.  Change all callers.  Use different PLT and
986         GOT.
987         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
988         parameters.  Change all callers.  Use different PLT and GOT for
989         IFUNC symbols.
990         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
991         (Output_data_plt_x86_64::rela_irelative): New function.
992         (Output_data_plt_x86_64::address_for_global): New function.
993         (Output_data_plt_x86_64::address_for_local): New function.
994         (Output_data_plt_x86_64::set_final_data_size): Likewise.
995         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
996         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
997         (Target_x86_64::register_global_plt_entry): Add symtab and layout
998         parameters.
999         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1000         reloc.
1001         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1002         symbols if we didn't create an IRELATIVE GOT.
1003         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1004         plt_address_for_local.
1005         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1006         * testsuite/ifuncvar1.c: New test file.
1007         * testsuite/ifuncvar2.c: New test file.
1008         * testsuite/ifuncvar3.c: New test file.
1009         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1010         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1011         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1012         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1013         * testsuite/Makefile.in: Rebuild.
1014
1015 2011-07-07  Cary Coutant  <ccoutant@google.com>
1016
1017         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1018         (two_file_test_1_ndebug.o): Likewise.
1019         (two_file_test_1b_ndebug.o): Likewise.
1020         (two_file_test_2_ndebug.o): Likewise.
1021         (two_file_test_main_ndebug.o): Likewise.
1022         (incremental_test_2): Link with no-debug versions.
1023
1024 2011-07-06  Cary Coutant  <ccoutant@google.com>
1025
1026         * gold/incremental.cc
1027         (Output_section_incremental_inputs::write_info_blocks): Check for
1028         hidden and internal symbols.
1029
1030 2011-07-06  Cary Coutant  <ccoutant@google.com>
1031
1032         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1033         Check disposition for startup file.
1034         (Incremental_inputs::report_command_line): Ignore
1035         --incremental-startup-unchanged option.
1036         * options.cc (General_options::parse_incremental_startup_unchanged):
1037         New function.
1038         (General_options::General_options): Initialize new data member.
1039         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1040         (General_options): Add --incremental-startup-unchanged option.
1041         (General_options::incremental_startup_disposition): New function.
1042         (General_options::incremental_startup_disposition_): New data member.
1043
1044 2011-07-06  Cary Coutant  <ccoutant@google.com>
1045
1046         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1047         input file index to Script_info ctor.
1048         (Sized_incremental_binary::do_file_has_changed): Find the
1049         command-line argument for files named in scripts.
1050         * incremental.h (Script_info::Script_info): New ctor
1051         with input file index.
1052         (Script_info::input_file_index): New function.
1053         (Script_info::input_file_index_): New data member.
1054         (Incremental_binary::get_library): Add const.
1055         (Incremental_binary::get_script_info): Add const.
1056         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1057         * testsuite/Makefile.am (incremental_test_5): New test case.
1058         (incremental_test_6): New test case.
1059         * testsuite/Makefile.in: Regenerate.
1060
1061 2011-07-06  Cary Coutant  <ccoutant@google.com>
1062
1063         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1064         debug output when command lines differ.
1065
1066 2011-07-06  Cary Coutant  <ccoutant@google.com>
1067
1068         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1069         --incremental-patch option.
1070         * layout.cc (Free_list::allocate): Extend allocation beyond original
1071         end if enabled.
1072         (Layout::make_output_section): Mark sections that should get
1073         patch space.
1074         * options.cc (parse_percent): New function.
1075         * options.h (parse_percent): New function.
1076         (DEFINE_percent): New macro.
1077         (General_options): Add --incremental-patch option.
1078         * output.cc (Output_section::Output_section): Initialize new data
1079         members.
1080         (Output_section::add_input_section): Print section name when out
1081         of patch space.
1082         (Output_section::add_output_section_data): Likewise.
1083         (Output_section::set_final_data_size): Add patch space when
1084         doing --incremental-full.
1085         (Output_section::do_reset_address_and_file_offset): Remove patch
1086         space.
1087         (Output_segment::set_section_list_addresses): Print debug output
1088         only if --incremental-update.
1089         * output.h (Output_section::set_is_patch_space_allowed): New function.
1090         (Output_section::is_patch_space_allowed_): New data member.
1091         (Output_section::patch_space_): New data member.
1092         * parameters.cc (Parameters::incremental_full): New function.
1093         * parameters.h (Parameters::incremental_full): New function
1094         * testsuite/Makefile.am (incremental_test_2): Add test for
1095         --incremental-patch option.
1096         * testsuite/Makefile.in: Regenerate.
1097         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1098         (t18): Remove function body.
1099
1100 2011-07-05  Doug Kwan  <dougkwan@google.com>
1101
1102         PR gold/12771
1103         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1104         Arm_Address type for relocation result.
1105         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1106         overflow check.
1107         (Arm_relocate_functions::abs32): Use unaligned access.
1108         (Arm_relocate_functions::rel32): Ditto.
1109         (Arm_relocate_functions::prel31): Ditto.
1110         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1111         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1112         static data relocations.
1113         * testsuite/Makefile.in: Regnerate.
1114         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1115
1116 2011-07-05  Ian Lance Taylor  <iant@google.com>
1117
1118         PR gold/12392
1119         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1120         symbols if necessary.
1121         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1122
1123 2011-07-05  Ian Lance Taylor  <iant@google.com>
1124
1125         PR gold/12952
1126         * resolve.cc (Symbol::override_base_with_special): Simply override
1127         version with special symbol version, ignoring previous version.
1128
1129 2011-07-05  Ian Lance Taylor  <iant@google.com>
1130
1131         * object.cc (Sized_relobj_file::include_section_group): Add
1132         information to comment about signature location.
1133
1134 2011-07-02  Ian Lance Taylor  <iant@google.com>
1135
1136         PR gold/12957
1137         * options.h (class General_options): Add -f and -F.
1138         * options.cc (General_options::finalize): Fatal error if -f/-F
1139         are used without -shared.
1140         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1141
1142 2011-07-02  Ian Lance Taylor  <iant@google.com>
1143
1144         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1145
1146 2011-07-01  Ian Lance Taylor  <iant@google.com>
1147
1148         PR gold/12525
1149         PR gold/12952
1150         * resolve.cc (Symbol::override_base_with_special): Don't override
1151         the version if the overriding symbol has a different name.
1152         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1153         all callers.  If we give an error about an undefined version,
1154         define the base version if necessary.
1155         * dynobj.h (class Versions): Update declaration.
1156         * testsuite/weak_alias_test_5.cc: New file.
1157         * testsuite/weak_alias_test.script: New file.
1158         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1159         and versioned_alias have the right value, and call t2.
1160         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1161         weak_alias_test_5.so.
1162         (weak_alias_test_LDADD): Likewise.
1163         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1164         * testsuite/Makefile.in: Rebuild.
1165
1166 2011-07-01  Ian Lance Taylor  <iant@google.com>
1167
1168         PR gold/12525
1169         * options.h (class General_options): Support -z notext.
1170         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1171         -Wl,-z,notext.
1172         (two_file_shared_nonpic.so): Likewise.
1173         (two_file_shared_mixed.so): Likewise.
1174         (two_file_shared_mixed_1.so): Likewise.
1175         (weak_undef_lib_nonpic.so): Likewise.
1176         (alt/weak_undef_lib_nonpic.so): Likewise.
1177         (tls_test_shared_nonpic.so): Likewise.
1178         * testsuite/Makefile.in: Rebuild.
1179
1180 2011-07-01  Ian Lance Taylor  <iant@google.com>
1181
1182         PR gold/12525
1183         * configure.ac: Test whether static linking works, setting
1184         the automake conditional HAVE_STATIC.
1185         * testsuite/Makefile.am: Disable tests using -static if
1186         HAVE_STATIC is not true.
1187         * configure, testsuite/Makefile.in: Rebuild.
1188
1189 2011-07-01  Ian Lance Taylor  <iant@google.com>
1190
1191         PR gold/12525
1192         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1193         Assert if we see DW_EH_PE_indirect.
1194         * target.h (Target::ehframe_datarel_base): New function.
1195         (Target::do_ehframe_datarel_base): New target function.
1196         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1197         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1198         function.
1199
1200 2011-07-01  Ian Lance Taylor  <iant@google.com>
1201
1202         PR gold/12571
1203         * options.h (class General_options): Add
1204         --ld-generated-unwind-info.
1205         * ehframe.cc (Fde::write): Add address parameter.  Change all
1206         callers.  If associated with PLT, fill in address and size.
1207         (Cie::set_output_offset): Only add merge mapping if there is an
1208         object.
1209         (Cie::write): Add address parameter.  Change all callers.
1210         (Eh_frame::add_ehframe_for_plt): New function.
1211         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1212         input_offset_ fields into union u_, with new plt field.
1213         (Fde::Fde): Adjust for new union field.
1214         (Fde::Fde) [Output_data version]: New constructor.
1215         (Fde::add_mapping): Only add merge mapping if there is an object.
1216         (class Cie): Update declarations.
1217         (class Eh_frame): Declare add_ehframe_for_plt.
1218         * layout.cc (Layout::layout_eh_frame): Break out code into
1219         make_eh_frame_section, and call it.
1220         (Layout::make_eh_frame_section): New function.
1221         (Layout::add_eh_frame_for_plt): New function.
1222         * layout.h (class Layout): Update declarations.
1223         * merge.cc (Merge_map::add_mapping): Add assertion.
1224         * i386.cc: Include "dwarf.h".
1225         (class Output_data_plt_i386): Make first_plt_entry,
1226         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1227         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1228         and plt_eh_frame_fde.
1229         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1230         boundary.  Call add_eh_frame_for_plt if appropriate.
1231         * x86_64.cc: Include "dwarf.h".
1232         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1233         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1234         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1235         and plt_eh_frame_fde.
1236         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1237         appropriate.
1238
1239 2011-06-29  Ian Lance Taylor  <iant@google.com>
1240
1241         PR gold/12629
1242         * object.cc (Sized_relobj_file::layout_section): Change shdr
1243         parameter to be const.
1244         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1245         out of do_layout.
1246         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1247         appropriate.  Call layout_eh_frame_section.
1248         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1249         sections.
1250         * object.h (class Sized_relobj_file): Update declarations.
1251
1252 2011-06-29  Ian Lance Taylor  <iant@google.com>
1253
1254         PR gold/12652
1255         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1256         modifier.
1257         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1258
1259 2011-06-29  Ian Lance Taylor  <iant@google.com>
1260
1261         PR gold/12675
1262         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1263         SHT_X86_64_UNWIND.
1264         * layout.cc (Layout::layout_eh_frame): Likewise.
1265
1266 2011-06-29  Ian Lance Taylor  <iant@google.com>
1267
1268         PR gold/12695
1269         * layout.cc (Layout::symtab_section_shndx): New function.
1270         * layout.h (class Layout): Declare symtab_section_shndx.
1271         * output.cc (Output_section::write_header): Call it.
1272
1273 2011-06-29  Ian Lance Taylor  <iant@google.com>
1274
1275         PR gold/12818
1276         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1277         symbols which are not used in a relocation.
1278
1279 2011-06-28  Ian Lance Taylor  <iant@google.com>
1280
1281         PR gold/12898
1282         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1283         script create indistinguishable segments.
1284         (Layout::set_segment_offsets): Use stable_sort when sorting
1285         segments.  Pass this to Compare_segments constructor.
1286         * layout.h (class Layout): Make segment_precedes non-static.
1287         (class Compare_segments): Change from struct to class.  Add
1288         layout_ field.  Add constructor.
1289         * script-sections.cc
1290         (Script_sections::attach_sections_using_phdrs_clause): Rename
1291         local orphan to is_orphan.  Don't report failure to put empty
1292         section in segment.  On attachment failure, report name of
1293         section, and attach to first PT_LOAD segment.
1294
1295 2011-06-28  Ian Lance Taylor  <iant@google.com>
1296
1297         PR gold/12934
1298         * target-select.cc (Target_selector::Target_selector): Add
1299         emulation parameter.  Change all callers.
1300         (select_target_by_bfd_name): Rename from select_target_by_name.
1301         Change all callers.
1302         (select_target_by_emulation): New function.
1303         (supported_emulation_names): New function.
1304         * target-select.h (class Target_selector): Add emulation_ field.
1305         Update declarations.
1306         (Target_selector::recognize_by_bfd_name): Rename from
1307         recognize_by_name.  Change all callers.
1308         (Target_selector::supported_bfd_names): Rename from
1309         supported_names.  Change all callers.
1310         (Target_selector::recognize_by_emulation): New function.
1311         (Target_selector::supported_emulations): New function.
1312         (Target_selector::emulation): New function.
1313         (Target_selector::do_recognize_by_bfd_name): Rename from
1314         do_recognize_by_name.  Change all callers.
1315         (Target_selector::do_supported_bfd_names): Rename from
1316         do_supported_names.  Change all callers.
1317         (Target_selector::do_recognize_by_emulation): New function.
1318         (Target_selector::do_supported_emulations): New function.
1319         (select_target_by_bfd_name): Change name in declaration.
1320         (select_target_by_emulation): Declare.
1321         (supported_emulation_names): Declare.
1322         * parameters.cc (parameters_force_valid_target): Try to find
1323         target based on emulation from -m option.
1324         * options.h (class General_options): Change doc string for -m.
1325         * options.cc (help): Print emulations.
1326         (General_options::parse_V): Likewise.
1327         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1328         Add emulation parameter.  Change all callers.
1329
1330 2011-06-28  Ian Lance Taylor  <iant@google.com>
1331
1332         * target.h (class Target): Add osabi_ field.
1333         (Target::osabi): New function.
1334         (Target::set_osabi): New function.
1335         (Target::Target): Initialize osabi_.
1336         (Target::do_adjust_elf_header): Make pure virtual.
1337         (Sized_target::do_adjust_elf_header): Declare.
1338         * target.cc (Sized_target::do_adjust_elf_header): New function.
1339         (class Sized_target): Instantiate all versions.
1340         * freebsd.h (class Target_freebsd): Remove.
1341         (Target_selector_freebsd::do_recognize): Call set_osabi on
1342         Target.
1343         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1344         (Target_selector_freebsd::set_osabi): Remove.
1345         * i386.cc (class Target_i386): Inherit from Sized_target rather
1346         than Target_freebsd.
1347         * x86_64.cc (class Target_x86_64): Likewise.
1348
1349 2011-06-28  Ian Lance Taylor  <iant@google.com>
1350
1351         * target.h (Target::can_check_for_function_pointers): Rewrite.
1352         Make non-virtual.
1353         (Target::can_icf_inline_merge_sections): Likewise.
1354         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1355         (Target::Target_info): Add can_icf_inline_merge_sections field.
1356         (Target::do_can_check_for_function_pointers): New virtual
1357         function.
1358         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1359         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1360         from can_check_for_function_pointers, move in file.
1361         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1362         section_may_have_icf_unsafe_poineters, move in file.
1363         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1364         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1365         Rename from can_check_for_function_pointers, move in file.
1366         (Target_i386::can_icf_inline_merge_sections): Remove.
1367         (Target_i386::i386_info): Initialize
1368         can_icf_inline_merge_sections.
1369         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1370         Initialize can_icf_inline_merge_sections.
1371         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1372         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1373         Rename from can_check_for_function_pointers, move in file.
1374         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1375         (Target_x86_64::x86_64_info): Initialize
1376         can_icf_inline_merge_sections.
1377         * testsuite/testfile.cc (Target_test::test_target_info):
1378         Likewise.
1379         * icf.cc (get_section_contents): Correct formatting.
1380
1381 2011-06-27  Ian Lance Taylor  <iant@google.com>
1382
1383         * symtab.cc (Symbol::versioned_name): New function.
1384         (Symbol_table::add_to_final_symtab): Use versioned_name when
1385         appropriate.
1386         (Symbol_table::sized_write_symbol): Likewise.
1387         * symtab.h (class Symbol): Declare versioned_name.
1388         * stringpool.h (class Stringpool_template): Add variant of add
1389         which takes a std::basic_string.
1390         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1391         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1392         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1393         (ver_test_12.o): New target.
1394         * testsuite/Makefile.in: Rebuild.
1395
1396 2011-06-27  Doug Kwan  <dougkwan@google.com>
1397
1398         * arm.cc (Arm_relocate_functions::thm_jump8,
1399         Arm_relocate_functions::thm_jump11): Use a wider signed
1400         type to compute offset.
1401         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1402         arm_thm_jump8.
1403         * testsuite/Makefile.in: Regenerate.
1404         * testsuite/arm_branch_in_range.sh: Check test results of
1405         arm_thm_jump11 and arm_thm_jump8.
1406         * testsuite/arm_thm_jump11.s: New test source file.
1407         * testsuite/arm_thm_jump11.t: New linker script.
1408         * testsuite/arm_thm_jump8.s: New test source file.
1409         * testsuite/arm_thm_jump8.t: New linker script.
1410
1411 2011-06-24  Ian Lance Taylor  <iant@google.com>
1412
1413         * layout.cc: Include "object.h".
1414         (ctors_sections_in_init_array): New static variable.
1415         (Layout::is_ctors_in_init_array): New function.
1416         (Layout::layout): Add entry to ctors_sections_in_init_array if
1417         appropriate.
1418         * layout.h (class Layout): Declare is_ctors_in_init_array.
1419         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1420         is_ctors_reverse_view is set.
1421         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1422         all callers.  Set is_ctors_reverse_view field of View_size.
1423         (Sized_relobj_file::reverse_words): New function.
1424         * object.h (Sized_relobj_file::View_size): Add
1425         is_ctors_reverse_view field.
1426         (class Sized_relobj_file): Update declarations.
1427         * testsuite/initpri3.c: New test.
1428         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1429         initpri3b.
1430         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1431         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1432         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1433         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1434         * testsuite/Makefile.in: Rebuild.
1435
1436 2011-06-24  Cary Coutant  <ccoutant@google.com>
1437
1438         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1439         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1440         (debug_msg_cdebug.err): New targets.
1441         * testsuite/Makefile.in: Regenerate.
1442         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1443         Fix checks for link with shared library.
1444
1445 2011-06-24  Doug Kwan  <dougkwan@google.com>
1446
1447         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1448         skip empty text sections.
1449         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1450
1451 2011-06-22  Ian Lance Taylor  <iant@google.com>
1452
1453         PR gold/12910
1454         * options.h (class General_options): Add --ctors-in-init-array.
1455         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1456         friends as SHT_PROGBITS for merging sections.
1457         (Layout::layout): Remove special handling of .init_array and
1458         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1459         and .dtors if ctors_in_init_array.
1460         (Layout::make_output_section): Force correct section types for
1461         .init_array and friends.  Don't sort if doing relocatable link,
1462         Don't sort .ctors and .dtors if ctors_in_init_array.
1463         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1464         (Layout::output_section_name): Add relobj parameter.  Change all
1465         callers.  Handle .ctors. and .dtors. in code rather than table.
1466         Handle .ctors and .dtors if ctors_in_init_array.
1467         (Layout::match_file_name): New function, moved from output.cc.
1468         * layout.h (class Layout): Update declarations.
1469         * output.cc: Include "layout.h".
1470         (Input_section_sort_entry::get_priority): New function.
1471         (Input_section_sort_entry::match_file_name): Just call
1472         Layout::match_file_name.
1473         (Output_section::Input_section_sort_init_fini_compare::operator()):
1474         Handle .ctors and .dtors.  Sort by explicit priority rather than
1475         by name.
1476         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1477         * testsuite/initpri2.c: New test.
1478         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1479         (check_PROGRAMS): Add initpri2.
1480         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1481         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1482         * configure, testsuite/Makefile.in: Rebuild.
1483
1484 2011-06-19  Ian Lance Taylor  <iant@google.com>
1485
1486         PR gold/12880
1487         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1488         .interp section to a PT_INTERP segment even if we have seen a
1489         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1490         clause in a linker script.
1491         (Layout::finalize): Don't create a .interp section if we've
1492         already create a PT_INTERP segment.
1493         (Layout::create_interp): Always call choose_output_section (revert
1494         patch of 2011-06-17).  Don't create PT_INTERP segment.
1495         * script-sections.cc
1496         (Script_sections::create_note_and_tls_segments): Add a .interp
1497         section to a PT_INTERP segment even if we have seen a
1498         --dynamic-linker option.
1499
1500 2011-06-18  Ian Lance Taylor  <iant@google.com>
1501
1502         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1503         merely because a non-PT_LOAD segment has a dynamic reloc.
1504
1505 2011-06-18  Ian Lance Taylor  <iant@google.com>
1506
1507         * layout.cc (Layout::finish_dynamic_section): Don't create
1508         DT_FLAGS entry if not needed.
1509
1510 2011-06-18  Ian Lance Taylor  <iant@google.com>
1511
1512         PR gold/12745
1513         * layout.cc (Layout::layout_eh_frame): Correct handling of
1514         writable .eh_frame section.
1515
1516 2011-06-17  Ian Lance Taylor  <iant@google.com>
1517
1518         PR gold/12893
1519         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1520         symbol is redefined with the exact same object and value.
1521
1522 2011-06-17  Ian Lance Taylor  <iant@google.com>
1523
1524         PR gold/12880
1525         * layout.h (class Layout): Add interp_segment_ field.
1526         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1527         (Layout::attach_allocated_section_to_segment): If making shared
1528         library, put .interp section in PT_INTERP segment.
1529         (Layout::finalize): Also call create_interp if -dynamic-linker
1530         option was used.
1531         (Layout::create_interp): Assert that there is no PT_INTERP
1532         segment.  If not using a SECTIONS clause, use make_output_section.
1533         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1534         * script-sections.cc
1535         (Script_sections::create_note_and_tls_segments): If making shared
1536         library, put .interp section in PT_INTERP segment.
1537
1538 2011-06-17  Ian Lance Taylor  <iant@google.com>
1539
1540         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1541         when making a shared library.
1542
1543 2011-06-17  Ian Lance Taylor  <iant@google.com>
1544
1545         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1546         parameter.  Change all callers.  Don't issue warning about PC32
1547         against locally defined symbol.
1548
1549 2011-06-16  Ian Lance Taylor  <iant@google.com>
1550
1551         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1552         occurs in same object.
1553
1554 2011-06-14  Alan Modra  <amodra@gmail.com>
1555
1556         * po/POTFILES.in: Regenerate.
1557
1558 2011-06-09  Ian Lance Taylor  <iant@google.com>
1559
1560         * script-sections.cc
1561         (Orphan_output_section::set_section_addresses): For a relocatable
1562         link set address to 0.
1563
1564 2011-06-09  Cary Coutant  <ccoutant@google.com>
1565
1566         PR gold/12804
1567         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1568         used with --compress-debug-sections.
1569         * gold/object.cc (Sized_relobj_file::do_layout): Report
1570         uncompressed size of compressed input sections.
1571
1572 2011-06-08  Cary Coutant  <ccoutant@google.com>
1573
1574         PR gold/12804
1575         * testsuite/two_file_test_2_v1.cc: Change initialization of
1576         v2 to keep it in .data.
1577
1578 2011-06-07  Cary Coutant  <ccoutant@google.com>
1579
1580         * common.cc (Symbol_table::do_allocate_commons_list): Call
1581         gold_fallback.
1582         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1583         (Errors::fallback): New function.
1584         (gold_fallback): New function.
1585         * errors.h (Errors::fallback): New function.
1586         * gold.cc (gold_exit): Change status parameter to enum; adjust
1587         all callers.
1588         (queue_initial_tasks): Call gold_fallback.
1589         * gold.h: Include cstdlib.
1590         (Exit_status): New enum type.
1591         (gold_exit): Change status parameter to enum.
1592         (gold_fallback): New function.
1593         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1594         (Layout::create_symtab_sections): Likewise.
1595         (Layout::create_shdrs): Likewise.
1596         * main.cc (main): Adjust call to gold_exit.
1597         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1598         (Output_data_got::add_got_entry_pair): Likewise.
1599         (Output_section::add_input_section): Likewise.
1600         (Output_section::add_output_section_data): Likewise.
1601         (Output_segment::set_section_list_addresses): Likewise.
1602         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1603
1604 2011-06-07  Cary Coutant  <ccoutant@google.com>
1605
1606         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1607         for incremental links.
1608         * output.cc (Output_segment::set_section_list_addresses): Remove
1609         FIXME and test for TLS or BSS.
1610
1611 2011-06-07  Cary Coutant  <ccoutant@google.com>
1612
1613         * testsuite/Makefile.am: Add incremental_copy_test,
1614         incremental_common_test_1.
1615         * testsuite/Makefile.in: Regenerate.
1616         * testsuite/common_test_1_v1.c: New source file.
1617         * testsuite/common_test_1_v2.c: New source file.
1618         * testsuite/copy_test_v1.cc: New source file.
1619
1620 2011-06-07  Cary Coutant  <ccoutant@google.com>
1621
1622         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1623         update, allocate common from bss section's free list.
1624         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1625         linker-defined symbols.
1626         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1627         Skip GOT and PLT entries that are no longer referenced.
1628         (Output_section_incremental_inputs::write_info_blocks): Mark
1629         linker-defined symbols.
1630         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1631         * output.cc (Output_section::allocate): New function.
1632         * output.h (Output_section::allocate): New function.
1633         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1634         linker-defined symbols.
1635         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1636         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1637         (Symbol::init_base_output_data): Likewise.
1638         (Symbol::init_base_output_segment): Likewise.
1639         (Symbol::init_base_constant): Likewise.
1640         (Sized_symbol::init_output_data): Likewise.
1641         (Sized_symbol::init_output_segment): Likewise.
1642         (Sized_symbol::init_constant): Likewise.
1643         (Symbol_table::do_define_in_output_data): Likewise.
1644         (Symbol_table::do_define_in_output_segment): Likewise.
1645         (Symbol_table::do_define_as_constant): Likewise.
1646         * symtab.h (Symbol::is_predefined): New function.
1647         (Symbol::init_base_output_data): Add is_predefined parameter.
1648         (Symbol::init_base_output_segment): Likewise.
1649         (Symbol::init_base_constant): Likewise.
1650         (Symbol::is_predefined_): New data member.
1651         (Sized_symbol::init_output_data): Add is_predefined parameter.
1652         (Sized_symbol::init_output_segment): Likewise.
1653         (Sized_symbol::init_constant): Likewise.
1654         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1655
1656 2011-06-07  Cary Coutant  <ccoutant@google.com>
1657
1658         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1659         instead of emit_copy_reloc.
1660         (Copy_relocs::emit_copy_reloc): Refactor.
1661         (Copy_relocs::make_copy_reloc): New function.
1662         (Copy_relocs::add_copy_reloc): Remove.
1663         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1664         section.
1665         (Copy_relocs::make_copy_reloc): New function.
1666         (Copy_relocs::add_copy_reloc): Remove.
1667         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1668         unchanged input files.
1669         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1670         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1671         Reserve BSS space for COPY relocations.
1672         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1673         (Output_section_incremental_inputs::write_info_blocks): Record
1674         whether a symbol is copied from a shared object.
1675         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1676         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1677         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1678         (Incremental_input_entry_reader::get_output_symbol_index): Add
1679         is_copy parameter.
1680         (Incremental_binary::emit_copy_relocs): New function.
1681         (Incremental_binary::do_emit_copy_relocs): New function.
1682         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1683         new data member.
1684         (Sized_incremental_binary::add_copy_reloc): New function.
1685         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1686         (Sized_incremental_binary::Copy_reloc): New struct.
1687         (Sized_incremental_binary::Copy_relocs): New typedef.
1688         (Sized_incremental_binary::copy_relocs_): New data member.
1689         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1690         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1691         * target.h (Sized_target::emit_copy_reloc): New function.
1692         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1693
1694 2011-06-02  Cary Coutant  <ccoutant@google.com>
1695
1696         PR gold/12163
1697         * gold/archive.cc (Archive::Archive): Initialize new data member.
1698         (Archive::include_all_members): Return if archive has already been
1699         included.
1700         * gold/archive.h (Archive::include_all_members_): New data member.
1701
1702 2011-06-02  Nick Clifton  <nickc@redhat.com>
1703
1704         * dynobj.h: Fix spelling mistake in comment.
1705         * output.cc: Likewise.
1706
1707 2011-05-31  Doug Kwan  <dougkwan@google.com>
1708             Asier Llano
1709
1710         PR gold/12826
1711         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1712         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1713         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1714         redundant arm_exidx_test.so.
1715         * testsuite/Makefile.in: Regenerate.
1716         (check_SCRIPTS): Add pr12826.sh
1717         (check_DATA): Add pr12826.stdout
1718         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1719         * testsuite/pr12826.sh: New file.
1720         * testsuite/pr12826_1.s: Ditto.
1721         * testsuite/pr12826_1.s: Ditto.
1722
1723 2011-05-30  Ian Lance Taylor  <iant@google.com>
1724
1725         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1726         sections.
1727
1728 2011-05-29  Ian Lance Taylor  <iant@google.com>
1729
1730         PR gold/12804
1731         * testsuite/Makefile.am: Use different file name for two_file_test
1732         temporary file for each incremental test.
1733         * testsuite/Makefile.in: Rebuild.
1734
1735 2011-05-29  Ian Lance Taylor  <iant@google.com>
1736
1737         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1738         binary input file is empty.
1739
1740 2011-05-27  Ian Lance Taylor  <iant@google.com>
1741
1742         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1743         (ver_test_9.so): Likewise.
1744         * testsuite/Makefile.in: Rebuild.
1745
1746 2011-05-26 Cary Coutant  <ccoutant@google.com>
1747
1748         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1749         * incremental.cc (Incremental_inputs::report_input_section): Fix
1750         comment, indentation.
1751         (Incremental_inputs::report_comdat_group): New function.
1752         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1753         of data for incremental input file entry.
1754         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1755         group count, COMDAT group signatures.
1756         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1757         an unchanged input file.
1758         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1759         Initialize new data member.
1760         (Incremental_object_entry::add_comdat_group): New function.
1761         (Incremental_object_entry::get_comdat_group_count): New function.
1762         (Incremental_object_entry::get_comdat_signature_key): New function.
1763         (Incremental_object_entry::groups_): New data member.
1764         (Incremental_inputs::report_comdat_group): New function.
1765         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1766         data for incremental input file entry.
1767         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1768         (Incremental_input_entry_reader::get_input_section): Adjust size of
1769         data for incremental input file entry.
1770         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1771         (Incremental_input_entry_reader::get_comdat_group_signature): New
1772         function.
1773         * object.cc (Sized_relobj::include_section_group): Report kept
1774         COMDAT groups for incremental links.
1775
1776 2011-05-24  David Meyer  <pdox@google.com>
1777
1778         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1779         with name parameter.  Add found_name parameter.
1780         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1781         * dirsearch.h (class Dirsearch): Update declaration.
1782
1783 2011-05-24  Ian Lance Taylor  <iant@google.com>
1784
1785         * archive.cc (Library_base::should_include_member): Pull in object
1786         from archive if it defines the entry symbol.
1787         * parameters.cc (Parameters::entry): New function.
1788         * parameters.h (class Parameters): Declare entry.
1789         * output.h (class Output_file_header): Remove entry_ field.
1790         * output.cc (Output_file_header::Output_file_header): Remove entry
1791         parameter.  Change all callers.
1792         (Output_file_header::entry): Use parameters->entry.
1793         * gold.cc (queue_middle_tasks): Likewise.
1794         * plugin.cc (Plugin_hook::run): Likewise.
1795
1796 2011-05-24 Cary Coutant  <ccoutant@google.com>
1797
1798         * gold.cc (queue_initial_tasks): Pass incremental base filename
1799         to Output_file::open_base_file; don't print error message.
1800         * incremental-dump.cc (main): Adjust call to
1801         Output_file::open_for_modification.
1802         * incremental-dump.cc (main): Likewise.
1803         * incremental.cc (Incremental_inputs::report_command_line):
1804         Ignore --incremental-base option when comparing command lines.
1805         Ignore parameter when given as separate argument.
1806         * options.h (class General_options): Add --incremental-base.
1807         * output.cc (Output_file::Output_file):
1808         (Output_file::open_base_file): Add base_name and writable parameters;
1809         read base file into new file; print error message here.
1810         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1811         callers.
1812         * output.h (Output_file::open_for_modification): Rename to...
1813         (Output_file::open_base_file): ...this; add base_name and
1814         writable parameters; adjust all callers.
1815         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1816         callers.
1817         * testsuite/Makefile.am (incremental_test_4): Test
1818         --incremental-base.
1819         * testsuite/Makefile.in: Regenerate.
1820
1821 2011-05-24 Cary Coutant  <ccoutant@google.com>
1822
1823         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1824         incremental_test_4.
1825         * testsuite/Makefile.in: Regenerate.
1826         * testsuite/two_file_test_1_v1.cc: New test source file.
1827         * testsuite/two_file_test_1b_v1.cc: New test source file.
1828         * testsuite/two_file_test_2_v1.cc: New test source file.
1829
1830 2011-05-24 Cary Coutant  <ccoutant@google.com>
1831
1832         * dynobj.h (Dynobj::do_dynobj): New function.
1833         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1834         flag and soname for shared objects.
1835         * incremental.cc (Incremental_inputs::report_object): Make
1836         either Incremental_object_entry or Incremental_dynobj_entry; add
1837         soname to string table.
1838         (Incremental_inputs::report_input_section): Add assertion.
1839         (Output_section_incremental_inputs::set_final_data_size): Adjust
1840         type of input file entry for shared libraries; adjust size of
1841         shared library info entry.
1842         (Output_section_incremental_inputs::write_input_files): Write
1843         as_needed flag for shared libraries.
1844         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1845         of input file entry for shared libraries; write soname.
1846         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1847         soname from incremental info.
1848         * incremental.h (enum Incremental_input_flags): Add
1849         INCREMENTAL_INPUT_AS_NEEDED.
1850         (Incremental_input_entry::Incremental_input_entry): Initialize new
1851         data member.
1852         (Incremental_input_entry::set_as_needed): New function.
1853         (Incremental_input_entry::as_needed): New function.
1854         (Incremental_input_entry::do_dynobj_entry): New function.
1855         (Incremental_input_entry::as_needed_): New data member.
1856         (Incremental_object_entry::Incremental_object_entry): Don't check
1857         for shared library.
1858         (Incremental_object_entry::do_type): Likewise.
1859         (class Incremental_dynobj_entry): New class.
1860         (Incremental_input_entry_reader::as_needed): New function.
1861         (Incremental_input_entry_reader::get_soname): New function.
1862         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1863         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1864         size of shared library info entry.
1865         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1866         incremental link when adding DT_NEEDED entries.
1867         * object.h (Object::Object): Initialize new data member.
1868         (Object::dynobj): New function.
1869         (Object::set_as_needed): New function.
1870         (Object::as_needed): New function.
1871         (Object::do_dynobj): New function.
1872         (Object::as_needed_): New data member.
1873
1874 2011-05-24 Cary Coutant  <ccoutant@google.com>
1875
1876         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1877         info; adjust display of GOT entries.
1878         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1879         vector of input objects; remove file_status_.
1880         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1881         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1882         got_plt reader; call target hooks to reserve GOT entries.
1883         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1884         of input file info header and GOT info entry.
1885         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1886         relocation info.
1887         (Got_plt_view_info::got_descriptor): Remove.
1888         (Got_plt_view_info::sym_index): New data member.
1889         (Got_plt_view_info::input_index): New data member.
1890         (Local_got_offset_visitor::visit): Write input file index.
1891         (Global_got_offset_visitor::visit): Write 0 for input file index.
1892         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1893         with sym_index and input_index.
1894         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1895         incremental info GOT entry; replace got_descriptor with input_index.
1896         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1897         map from input file index to object.
1898         (Sized_relobj_incr::do_layout): Replace direct data member reference
1899         with accessor function.
1900         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1901         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1902         Adjust size of input file info header.
1903         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1904         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1905         (Incremental_input_entry_reader::get_input_section): Adjust size of
1906         input file info header.
1907         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1908         of incremental info GOT entry.
1909         (Incremental_got_plt_reader::get_got_desc): Remove.
1910         (Incremental_got_plt_reader::get_got_symndx): New function.
1911         (Incremental_got_plt_reader::get_got_input_index): New function.
1912         (Sized_incremental_binary::Sized_incremental_binary): Remove
1913         file_status_; add input_objects_.
1914         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1915         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1916         (Sized_incremental_binary::file_is_unchanged): Remove.
1917         (Sized_incremental_binary::set_input_object): New function.
1918         (Sized_incremental_binary::input_object): New function.
1919         (Sized_incremental_binary::file_status_): Remove.
1920         (Sized_incremental_binary::input_objects_): New data member.
1921         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1922         references.
1923         (Sized_relobj_incr::invalid_address): Move to base class.
1924         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1925         class.
1926         (Sized_relobj_incr::do_output_section_offset): Likewise.
1927         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1928         (Sized_relobj_incr::section_offsets_): Likewise.
1929         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1930         function.
1931         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1932         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1933         with accessor function.
1934         (Sized_relobj_file::do_layout): Likewise.
1935         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1936         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1937         (Sized_relobj_file::compute_final_local_value): Replace refs to
1938         section_offsets_ with accessor function.
1939         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1940         * object.h (Relobj::Relobj): Initialize new data members.
1941         (Relobj::add_dyn_reloc): New function.
1942         (Relobj::first_dyn_reloc): New function.
1943         (Relobj::dyn_reloc_count): New function.
1944         (Relobj::first_dyn_reloc_): New data member.
1945         (Relobj::dyn_reloc_count_): New data member.
1946         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1947         references.
1948         (Sized_relobj::Address): New typedef.
1949         (Sized_relobj::invalid_address): Move here from child class.
1950         (Sized_relobj::Sized_relobj): Initialize new data members.
1951         (Sized_relobj::sized_relobj): New function.
1952         (Sized_relobj::is_output_section_offset_invalid): Move here from
1953         child class.
1954         (Sized_relobj::get_output_section_offset): Likewise.
1955         (Sized_relobj::local_has_got_offset): Likewise.
1956         (Sized_relobj::local_got_offset): Likewise.
1957         (Sized_relobj::set_local_got_offset): Likewise.
1958         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1959         (Sized_relobj::clear_got_offsets): New function.
1960         (Sized_relobj::section_offsets): Move here from child class.
1961         (Sized_relobj::do_output_section_offset): Likewise.
1962         (Sized_relobj::do_set_section_offset): Likewise.
1963         (Sized_relobj::Local_got_offsets): Likewise.
1964         (Sized_relobj::local_got_offsets_): Likewise.
1965         (Sized_relobj::section_offsets_): Likewise.
1966         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1967         references.
1968         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1969         class.
1970         (Sized_relobj_file::sized_relobj): New function
1971         (Sized_relobj_file::local_has_got_offset): Move to base class.
1972         (Sized_relobj_file::local_got_offset): Likewise.
1973         (Sized_relobj_file::set_local_got_offset): Likewise.
1974         (Sized_relobj_file::get_output_section_offset): Likewise.
1975         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1976         (Sized_relobj_file::do_output_section_offset): Likewise.
1977         (Sized_relobj_file::do_set_section_offset): Likewise.
1978         (Sized_relobj_file::Local_got_offsets): Likewise.
1979         (Sized_relobj_file::local_got_offsets_): Likewise.
1980         (Sized_relobj_file::section_offsets_): Likewise.
1981         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1982         (all constructors).
1983         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1984         (Output_reloc::get_symbol_index): Likewise.
1985         (Output_reloc::local_section_offset): Likewise.
1986         (Output_reloc::get_address): Likewise.
1987         (Output_reloc::symbol_value): Likewise.
1988         (Output_data_got::reserve_slot): Move to class definition.
1989         (Output_data_got::reserve_local): New function.
1990         (Output_data_got::reserve_slot_for_global): Remove.
1991         (Output_data_got::reserve_global): New function.
1992         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1993         (all constructors, two instantiations).
1994         (Output_reloc::get_relobj): New function (two instantiations).
1995         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1996         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1997         (Output_data_reloc::add_global): Adjust type of relobj.
1998         (Output_data_reloc::add_global_relative): Likewise.
1999         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2000         (Output_data_reloc::add_local): Likewise.
2001         (Output_data_reloc::add_local_relative): Likewise.
2002         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2003         (Output_data_reloc::add_local_section): Likewise.
2004         (Output_data_reloc::add_output_section): Likewise.
2005         (Output_data_reloc::add_absolute): Likewise.
2006         (Output_data_reloc::add_target_specific): Likewise.
2007         (Output_data_got::reserve_slot): Move definition here.
2008         (Output_data_got::reserve_local): New function.
2009         (Output_data_got::reserve_global): New function.
2010         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2011         section_offsets_ with accessor function.
2012         (Sized_relobj_file::write_sections): Likewise.
2013         (Sized_relobj_file::do_relocate_sections): Likewise.
2014         * target.h (Sized_target::reserve_local_got_entry): New function.
2015         (Sized_target::reserve_global_got_entry): New function.
2016         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2017         (Target_x86_64::reserve_global_got_entry): New function.
2018         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2019
2020 2011-05-23 Cary Coutant  <ccoutant@google.com>
2021
2022         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2023         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2024         bit when checking got_type.
2025         * incremental.cc (Sized_incremental_binary::setup_readers):
2026         Store symbol table and string table locations; initialize bit vector
2027         of file status flags.
2028         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2029         unchanged files.
2030         (Sized_incremental_binary::do_process_got_plt): New function.
2031         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2032         (Output_section_incremental_inputs::set_final_data_size): Record
2033         file index for each input file.
2034         (Output_section_incremental_inputs::write_got_plt): Store file index
2035         instead of input entry offset for each GOT entry.
2036         * incremental.h
2037         (Incremental_input_entry::Incremental_input_entry): Initialize new
2038         data member.
2039         (Incremental_input_entry::set_offset): Store file index.
2040         (Incremental_input_entry::get_file_index): New function.
2041         (Incremental_input_entry::file_index_): New data member.
2042         (Incremental_binary::process_got_plt): New function.
2043         (Incremental_binary::do_process_got_plt): New function.
2044         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2045         data members.
2046         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2047         (Sized_incremental_binary::set_file_is_unchanged): New function.
2048         (Sized_incremental_binary::file_is_unchanged): New function.
2049         (Sized_incremental_binary::do_process_got_plt): New function.
2050         (Sized_incremental_binary::file_status_): New data member.
2051         (Sized_incremental_binary::main_symtab_loc_): New data member.
2052         (Sized_incremental_binary::main_strtab_loc_): New data member.
2053         * output.cc (Output_data_got::Got_entry::write): Add case
2054         RESERVED_CODE.
2055         (Output_data_got::add_global): Call add_got_entry.
2056         (Output_data_got::add_global_plt): Likewise.
2057         (Output_data_got::add_global_with_rel): Likewise.
2058         (Output_data_got::add_global_with_rela): Likewise.
2059         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2060         (Output_data_got::add_global_pair_with_rela): Likewise.
2061         (Output_data_got::add_local): Call add_got_entry.
2062         (Output_data_got::add_local_plt): Likewise.
2063         (Output_data_got::add_local_with_rel): Likewise.
2064         (Output_data_got::add_local_with_rela): Likewise.
2065         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2066         (Output_data_got::add_local_pair_with_rela): Likewise.
2067         (Output_data_got::reserve_slot): New function.
2068         (Output_data_got::reserve_slot_for_global): New function.
2069         (Output_data_got::add_got_entry): New function.
2070         (Output_data_got::add_got_entry_pair): New function.
2071         (Output_section::add_output_section_data): Edit FIXME.
2072         * output.h
2073         (Output_section_data_build::Output_section_data_build): New
2074         constructor with size parameter.
2075         (Output_data_space::Output_data_space): Likewise.
2076         (Output_data_got::Output_data_got): Initialize new data member; new
2077         constructor with size parameter.
2078         (Output_data_got::add_constant): Call add_got_entry.
2079         (Output_data_got::reserve_slot): New function.
2080         (Output_data_got::reserve_slot_for_global): New function.
2081         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2082         (Output_data_got::add_got_entry): New function.
2083         (Output_data_got::add_got_entry_pair): New function.
2084         (Output_data_got::free_list_): New data member.
2085         * target.h (Sized_target::init_got_plt_for_update): New function.
2086         (Sized_target::register_global_plt_entry): New function.
2087         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2088         Initialize new data member; call init; add constructor with PLT count.
2089         (Output_data_plt_x86_64::init): New function.
2090         (Output_data_plt_x86_64::add_relocation): New function.
2091         (Output_data_plt_x86_64::reserve_slot): New function.
2092         (Output_data_plt_x86_64::free_list_): New data member.
2093         (Target_x86_64::init_got_plt_for_update): New function.
2094         (Target_x86_64::register_global_plt_entry): New function.
2095         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2096         incremental updates.
2097         (Output_data_plt_x86_64::add_relocation): New function.
2098         * testsuite/object_unittest.cc (Object_test): Set default options.
2099
2100 2011-05-16  Ian Lance Taylor  <iant@google.com>
2101
2102         * options.h (class General_options): Make -i a synonym for -r.
2103
2104 2011-05-16  Ian Lance Taylor  <iant@google.com>
2105
2106         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2107
2108 2011-05-10 Cary Coutant  <ccoutant@google.com>
2109
2110         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2111         strip_all (-s).
2112
2113 2011-05-06  Ian Lance Taylor  <iant@google.com>
2114
2115         * layout.cc (Layout::layout): If the output section flags change,
2116         update the ordering.
2117
2118 2011-04-25 Cary Coutant  <ccoutant@google.com>
2119
2120         * incremental-dump.cc (dump_incremental_inputs): Print local
2121         symbol info for each input file.
2122         * incremental.cc
2123         (Output_section_incremental_inputs::set_final_data_size): Add local
2124         symbol info to input file entries in incremental info.
2125         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2126         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2127         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2128         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2129         implementation.
2130         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2131         (Sized_incr_relobj::do_relocate): Write the local symbols.
2132         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2133         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2134         Adjust size of input file header.
2135         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2136         (Incremental_inputs_reader::get_local_symbol_count): New function.
2137         (Incremental_inputs_reader::get_input_section): Adjust size of input
2138         file header.
2139         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2140         (Sized_incr_relobj::This): New typedef.
2141         (Sized_incr_relobj::sym_size): New const data member.
2142         (Sized_incr_relobj::Local_symbol): New struct.
2143         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2144         (Sized_incr_relobj::do_local_symbol_offset): New function.
2145         (Sized_incr_relobj::local_symbol_count_): New data member.
2146         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2147         (Sized_incr_relobj::local_symbol_index_): New data member.
2148         (Sized_incr_relobj::local_symbol_offset_): New data member.
2149         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2150         (Sized_incr_relobj::local_symbols_): New data member.
2151         * object.h (Relobj::output_local_symbol_count): New function.
2152         (Relobj::local_symbol_offset): New function.
2153         (Relobj::do_output_local_symbol_count): New function.
2154         (Relobj::do_local_symbol_offset): New function.
2155         (Sized_relobj::do_output_local_symbol_count): New function.
2156         (Sized_relobj::do_local_symbol_offset): New function.
2157
2158 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2159
2160         * descriptors.cc (set_close_on_exec): New function.
2161         (Descriptors::open): Use set_close_on_exec.
2162         * output.cc (S_ISLNK): Define if not defined.
2163
2164 2011-04-22 Cary Coutant  <ccoutant@google.com>
2165
2166         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2167         global symbol map.
2168         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2169         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2170         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2171         relocations.
2172         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2173         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2174         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2175         * incremental.h
2176         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2177         function.
2178         (Incremental_binary::apply_incremental_relocs): New function.
2179         (Incremental_binary::do_apply_incremental_relocs): New function.
2180         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2181         data member.
2182         (Sized_incremental_binary::add_global_symbol): New function.
2183         (Sized_incremental_binary::global_symbol): New function.
2184         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2185         (Sized_incremental_binary::symbol_map_): New data member.
2186         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2187         * target.h (Sized_target::apply_relocation): New function.
2188         * target-reloc.h (apply_relocation): New function.
2189         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2190
2191 2011-04-22  Doug Kwan  <dougkwan@google.com>
2192
2193         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2194         flag of a SHT_ARM_EXIDX section.
2195         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2196         * testsuite/Makefile.in: Regenerate.
2197         * testsuite/arm_exidx_test.s: New file.
2198         * testsuite/arm_exidx_test.sh: Same.
2199
2200 2011-04-20 Cary Coutant  <ccoutant@google.com>
2201
2202         PR gold/12689
2203         * archive.h (Incremental_archive_entry::Archive_member):
2204         Initialize arg_serial_ (second constructor).
2205
2206 2011-04-17  Ian Lance Taylor  <iant@google.com>
2207
2208         * object.cc (Relocate_info::location): Simplify location string.
2209         * errors.cc (Errors::error_at_location): Don't print program
2210         name.
2211         (Errors::warning_at_location): Likewise.
2212         (Errors::undefined_symbol): Likewise.
2213         * testsuite/debug_msg.sh: Update accordingly.
2214
2215 2011-04-14 Cary Coutant  <ccoutant@google.com>
2216
2217         * gold/layout.cc (Layout::symtab_section_offset): New function.
2218         * gold/layout.h (Layout::symtab_section_offset): New function.
2219         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2220
2221 2011-04-12  Ian Lance Taylor  <iant@google.com>
2222
2223         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2224         with MREMAP_MAYMOVE.
2225         * output.h (class Output_file): Add map_is_allocated_ field.
2226         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2227         not available, provide stubs.  If mremap is not available, #define
2228         it to gold_mremap.
2229         (MREMAP_MAYMOVE): Define if not defined.
2230         (Output_file::Output_file): Initialize map_is_allocated_.
2231         (Output_file::resize): Check map_is_allocated_.
2232         (Output_file::map_anonymous): If mmap fails, use malloc.
2233         (Output_file::unmap): Don't do anything for an anonymous map.
2234         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2235         is not available, provide stubs.
2236         (File_read::View::~View): Use free rather than delete[].
2237         (File_read::make_view): Use malloc rather than new[].  If mmap
2238         fails, use malloc.
2239         (File_read::find_or_make_view): Use malloc rather than new[].
2240         * gold.h: Remove HAVE_REMAP code.
2241         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2242         exists.  Rename mremap to gold_mremap.  If mmap is not available
2243         don't do anything.
2244         * configure, config.in: Rebuild.
2245
2246 2011-04-11  Ian Lance Taylor  <iant@google.com>
2247
2248         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2249         initialize local variable v.
2250
2251 2011-04-11  Cary Coutant  <ccoutant@google.com>
2252
2253         * archive.cc (Archive::include_member): Adjust call to
2254         report_object.
2255         (Add_archive_symbols::run): Track argument serial numbers.
2256         (Lib_group::include_member): Likewise.
2257         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2258         * archive.h (Incremental_archive_entry::Archive_member):
2259         Initialize arg_serial_.
2260         (Archive_member::arg_serial_): New data member.
2261         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2262         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2263         incremental link.
2264         (Sized_dynobj::do_for_all_local_got_entries): New function.
2265         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2266         function.
2267         * fileread.cc (get_mtime): New function.
2268         * fileread.h (get_mtime): New function.
2269         * gold.cc (queue_initial_tasks): Check for incremental update.
2270         (process_incremental_input): New function.
2271         (queue_middle_tasks): Don't force valid target for incremental
2272         update.
2273         * incremental-dump.cc (find_input_containing_global): Adjust
2274         size of symbol info entry.
2275         (dump_incremental_inputs): Dump argument serial number and
2276         in_system_directory flag; bias shndx by 1; print symbol names
2277         when dumping per-file symbol lists; use new symbol info readers.
2278         * incremental.cc
2279         (Output_section_incremental_inputs:update_data_size): New function.
2280         (Sized_incremental_binary::setup_readers): Setup input readers
2281         for each input file; build maps for files added from libraries
2282         and scripts.
2283         (Sized_incremental_binary::check_input_args): New function.
2284         (Sized_incremental_binary::do_check_inputs): Build map of argument
2285         serial numbers to input arguments.
2286         (Sized_incremental_binary::do_file_has_changed): Rename
2287         do_file_is_unchanged to this; compare file modification times.
2288         (Sized_incremental_binary::do_init_layout): New function.
2289         (Sized_incremental_binary::do_reserve_layout): New function.
2290         (Sized_incremental_binary::do_get_input_reader): Remove.
2291         (Sized_incremental_binary::get_symtab_view): New function.
2292         (Incremental_checker::can_incrementally_link_output_file): Remove.
2293         (Incremental_inputs::report_command_line): Exclude --debug options.
2294         (Incremental_inputs::report_archive_begin): Add parameter; track
2295         argument serial numbers; don't put input file entry for archive
2296         before archive members.
2297         (Incremental_inputs::report_archive_end): Put input file entry
2298         for archive after archive members.
2299         (Incremental_inputs::report_object): Add parameter; track argument
2300         serial numbers and in_system_directory flag.
2301         (Incremental_inputs::report_script): Add parameter; track argument
2302         serial numbers.
2303         (Output_section_incremental_inputs::set_final_data_size): Adjust
2304         size of symbol info entry; check for forwarding symbols.
2305         (Output_section_incremental_inputs::write_input_files): Write
2306         in_system_directory flag and argument serial number.
2307         (Output_section_incremental_inputs::write_info_blocks): Map section
2308         indices between incremental info and original input file; store
2309         input section index for each symbol.
2310         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2311         change operator() to visit().
2312         (class Global_got_offset_visitor): Likewise.
2313         (class Global_symbol_visitor_got_plt):
2314         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2315         classes.
2316         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2317         (Sized_incr_relobj::do_read_symbols): New function.
2318         (Sized_incr_relobj::do_layout): New function.
2319         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2320         (Sized_incr_relobj::do_add_symbols): New function.
2321         (Sized_incr_relobj::do_should_include_member): New function.
2322         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2323         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2324         (Sized_incr_relobj::do_section_size): New function.
2325         (Sized_incr_relobj::do_section_name): New function.
2326         (Sized_incr_relobj::do_section_contents): New function.
2327         (Sized_incr_relobj::do_section_flags): New function.
2328         (Sized_incr_relobj::do_section_entsize): New function.
2329         (Sized_incr_relobj::do_section_address): New function.
2330         (Sized_incr_relobj::do_section_type): New function.
2331         (Sized_incr_relobj::do_section_link): New function.
2332         (Sized_incr_relobj::do_section_info): New function.
2333         (Sized_incr_relobj::do_section_addralign): New function.
2334         (Sized_incr_relobj::do_initialize_xindex): New function.
2335         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2336         (Sized_incr_relobj::do_read_relocs): New function.
2337         (Sized_incr_relobj::do_gc_process_relocs): New function.
2338         (Sized_incr_relobj::do_scan_relocs): New function.
2339         (Sized_incr_relobj::do_count_local_symbols): New function.
2340         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2341         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2342         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2343         (Sized_incr_relobj::do_relocate): New function.
2344         (Sized_incr_relobj::do_set_section_offset): New function.
2345         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2346         (Sized_incr_dynobj::do_read_symbols): New function.
2347         (Sized_incr_dynobj::do_layout): New function.
2348         (Sized_incr_dynobj::do_add_symbols): New function.
2349         (Sized_incr_dynobj::do_should_include_member): New function.
2350         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2351         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2352         (Sized_incr_dynobj::do_section_size): New function.
2353         (Sized_incr_dynobj::do_section_name): New function.
2354         (Sized_incr_dynobj::do_section_contents): New function.
2355         (Sized_incr_dynobj::do_section_flags): New function.
2356         (Sized_incr_dynobj::do_section_entsize): New function.
2357         (Sized_incr_dynobj::do_section_address): New function.
2358         (Sized_incr_dynobj::do_section_type): New function.
2359         (Sized_incr_dynobj::do_section_link): New function.
2360         (Sized_incr_dynobj::do_section_info): New function.
2361         (Sized_incr_dynobj::do_section_addralign): New function.
2362         (Sized_incr_dynobj::do_initialize_xindex): New function.
2363         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2364         (make_sized_incremental_object): New function.
2365         (Incremental_library::copy_unused_symbols): New function.
2366         (Incremental_library::do_for_all_unused_symbols): New function.
2367         * incremental.h (enum Incremental_input_flags): New type.
2368         (class Incremental_checker): Remove.
2369         (Incremental_input_entry::Incremental_input_entry): Add argument
2370         serial number.
2371         (Incremental_input_entry::arg_serial): New function.
2372         (Incremental_input_entry::set_is_in_system_directory): New function.
2373         (Incremental_input_entry::is_in_system_directory): New function.
2374         (Incremental_input_entry::arg_serial_): New data member.
2375         (Incremental_input_entry::is_in_system_directory_): New data member.
2376         (class Script_info): Move here from script.h.
2377         (Script_info::Script_info): Add filename parameter.
2378         (Script_info::filename): New function.
2379         (Script_info::filename_): New data member.
2380         (Incremental_script_entry::Incremental_script_entry): Add argument
2381         serial number.
2382         (Incremental_object_entry::Incremental_object_entry): Likewise.
2383         (Incremental_object_entry::add_input_section): Build list of input
2384         sections with map to original shndx.
2385         (Incremental_object_entry::get_input_section_index): New function.
2386         (Incremental_object_entry::shndx_): New data member.
2387         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2388         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2389         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2390         serial number.
2391         (Incremental_inputs::report_archive_begin): Likewise.
2392         (Incremental_inputs::report_object): Likewise.
2393         (Incremental_inputs::report_script): Likewise.
2394         (class Incremental_global_symbol_reader): New class.
2395         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2396         and store flags and input file type.
2397         (Incremental_input_entry_reader::arg_serial): New function.
2398         (Incremental_input_entry_reader::type): Extract type from flags.
2399         (Incremental_input_entry_reader::is_in_system_directory): New function.
2400         (Incremental_input_entry_reader::get_input_section_count): Call
2401         accessor function for type.
2402         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2403         function for type; adjust size of global symbol entry.
2404         (Incremental_input_entry_reader::get_global_symbol_count): Call
2405         accessor function for type.
2406         (Incremental_input_entry_reader::get_object_count): Likewise.
2407         (Incremental_input_entry_reader::get_object_offset): Likewise.
2408         (Incremental_input_entry_reader::get_member_count): Likewise.
2409         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2410         (Incremental_input_entry_reader::get_member_offset): Likewise.
2411         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2412         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2413         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2414         (Incremental_input_entry_reader::get_global_symbol_reader): New
2415         function.
2416         (Incremental_input_entry_reader::get_output_symbol_index): New
2417         function.
2418         (Incremental_input_entry_reader::type_): Remove.
2419         (Incremental_input_entry_reader::flags_): New data member.
2420         (Incremental_inputs_reader::input_file_offset): New function.
2421         (Incremental_inputs_reader::input_file_index): New function.
2422         (Incremental_inputs_reader::input_file): Call input_file_offset.
2423         (Incremental_inputs_reader::input_file_at_offset): New function.
2424         (Incremental_relocs_reader::get_r_type): Reformat.
2425         (Incremental_relocs_reader::get_r_shndx): Reformat.
2426         (Incremental_relocs_reader::get_r_offset): Reformat.
2427         (Incremental_relocs_reader::data): New function.
2428         (Incremental_binary::Incremental_binary): Initialize new data members.
2429         (Incremental_binary::check_inputs): Add cmdline parameter.
2430         (Incremental_binary::file_is_unchanged): Remove.
2431         (Input_reader::arg_serial): New function.
2432         (Input_reader::get_unused_symbol_count): New function.
2433         (Input_reader::get_unused_symbol): New function.
2434         (Input_reader::do_arg_serial): New function.
2435         (Input_reader::do_get_unused_symbol_count): New function.
2436         (Input_reader::do_get_unused_symbol): New function.
2437         (Incremental_binary::input_file_count): New function.
2438         (Incremental_binary::get_input_reader): Change signature to use
2439         index instead of filename.
2440         (Incremental_binary::file_has_changed): New function.
2441         (Incremental_binary::get_input_argument): New function.
2442         (Incremental_binary::get_library): New function.
2443         (Incremental_binary::get_script_info): New function.
2444         (Incremental_binary::init_layout): New function.
2445         (Incremental_binary::reserve_layout): New function.
2446         (Incremental_binary::output_file): New function.
2447         (Incremental_binary::do_check_inputs): New function.
2448         (Incremental_binary::do_file_is_unchanged): Remove.
2449         (Incremental_binary::do_file_has_changed): New function.
2450         (Incremental_binary::do_init_layout): New function.
2451         (Incremental_binary::do_reserve_layout): New function.
2452         (Incremental_binary::do_input_file_count): New function.
2453         (Incremental_binary::do_get_input_reader): Change signature.
2454         (Incremental_binary::input_args_map_): New data member.
2455         (Incremental_binary::library_map_): New data member.
2456         (Incremental_binary::script_map_): New data member.
2457         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2458         new data members.
2459         (Sized_incremental_binary::output_section): New function.
2460         (Sized_incremental_binary::inputs_reader): Add const.
2461         (Sized_incremental_binary::symtab_reader): Add const.
2462         (Sized_incremental_binary::relocs_reader): Add const.
2463         (Sized_incremental_binary::got_plt_reader): Add const.
2464         (Sized_incremental_binary::get_symtab_view): New function.
2465         (Sized_incremental_binary::Inputs_reader): New typedef.
2466         (Sized_incremental_binary::Input_entry_reader): New typedef.
2467         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2468         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2469         (Sized_incremental_binary::do_file_has_changed): New function.
2470         (Sized_incremental_binary::do_init_layout): New function.
2471         (Sized_incremental_binary::do_reserve_layout): New function.
2472         (Sized_input_reader::Inputs_reader): Remove.
2473         (Sized_input_reader::Input_entry_reader): Remove.
2474         (Sized_input_reader::do_arg_serial): New function.
2475         (Sized_input_reader::do_get_unused_symbol_count): New function.
2476         (Sized_input_reader::do_get_unused_symbol): New function.
2477         (Sized_incremental_binary::do_input_file_count): New function.
2478         (Sized_incremental_binary::do_get_input_reader): Change signature;
2479         use index instead of filename.
2480         (Sized_incremental_binary::section_map_): New data member.
2481         (Sized_incremental_binary::input_entry_readers_): New data member.
2482         (class Sized_incr_relobj): New class.
2483         (class Sized_incr_dynobj): New class.
2484         (make_sized_incremental_object): New function.
2485         (class Incremental_library): New class.
2486         * layout.cc (Free_list::num_lists): New static data member.
2487         (Free_list::num_nodes): New static data member.
2488         (Free_list::num_removes): New static data member.
2489         (Free_list::num_remove_visits): New static data member.
2490         (Free_list::num_allocates): New static data member.
2491         (Free_list::num_allocate_visits): New static data member.
2492         (Free_list::init): New function.
2493         (Free_list::remove): New function.
2494         (Free_list::allocate): New function.
2495         (Free_list::dump): New function.
2496         (Free_list::print_stats): New function.
2497         (Layout_task_runner::run): Resize output file for incremental updates.
2498         (Layout::Layout): Initialize new data members.
2499         (Layout::set_incremental_base): New function.
2500         (Layout::init_fixed_output_section): New function.
2501         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2502         incremental updates.
2503         (Layout::create_gold_note): Do not create gold note section for
2504         incremental updates.
2505         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2506         for incremental updates.
2507         (Layout::set_section_offsets): For incremental updates, allocate space
2508         from free list.
2509         (Layout::create_symtab_sections): Layout with offsets relative to
2510         start of section; for incremental updates, allocate space from free
2511         list.
2512         (Layout::create_shdrs): For incremental updates, allocate space from
2513         free list.
2514         (Layout::finish_dynamic_section): For incremental updates, do not
2515         check --as-needed (fixed in subsequent patch).
2516         * layout.h (class Free_list): New class.
2517         (Layout::set_incremental_base): New function.
2518         (Layout::incremental_base): New function.
2519         (Layout::init_fixed_output_section): New function.
2520         (Layout::allocate): New function.
2521         (Layout::incremental_base_): New data member.
2522         (Layout::free_list_): New data member.
2523         * main.cc (main): Print Free_list statistics.
2524         * object.cc (Relobj::finalize_incremental_relocs): Add
2525         clear_counts parameter; clear counts only when clear_counts is set.
2526         (Sized_relobj::Sized_relobj): Initialize new base class.
2527         (Sized_relobj::do_layout): Don't report special sections.
2528         (Sized_relobj::do_for_all_local_got_entries): New function.
2529         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2530         symtab_off to all symbol table offsets.
2531         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2532         * object.h (class Got_offset_list): Move to top of file.
2533         (Object::Object): Allow case where input_file == NULL.
2534         (Object::~Object): Likewise.
2535         (Object::input_file): Assert that input_file != NULL.
2536         (Object::lock): Allow case where input_file == NULL.
2537         (Object::unlock): Likewise.
2538         (Object::is_locked): Likewise.
2539         (Object::token): Likewise.
2540         (Object::release): Likewise.
2541         (Object::is_incremental): New function.
2542         (Object::get_mtime): New function.
2543         (Object::for_all_local_got_entries): New function.
2544         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2545         (Object::set_is_in_system_directory): New function.
2546         (Object::is_in_system_directory): New function.
2547         (Object::do_is_incremental): New function.
2548         (Object::do_get_mtime): New function.
2549         (Object::do_for_all_local_got_entries): New function.
2550         (Object::is_in_system_directory_): New data member.
2551         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2552         (class Sized_relobj_base): New class.
2553         (class Sized_relobj): Derive from Sized_relobj_base.
2554         (class Sized_relobj::Symbols): Redeclare from base class.
2555         (class Sized_relobj::local_got_offset_list): Remove.
2556         (class Sized_relobj::Output_sections): Redeclare from base class.
2557         (class Sized_relobj::do_for_all_local_got_entries): New function.
2558         (class Sized_relobj::write_local_symbols): Add offset parameter.
2559         (class Sized_relobj::local_symbol_offset_): Update comment.
2560         (class Sized_relobj::local_dynsym_offset_): Update comment.
2561         * options.cc (Input_arguments::add_file): Remove const.
2562         * options.h (Input_file_argument::Input_file_argument):
2563         Initialize arg_serial_ (all constructors).
2564         (Input_file_argument::set_arg_serial): New function.
2565         (Input_file_argument::arg_serial): New function.
2566         (Input_file_argument::arg_serial_): New data member.
2567         (Input_arguments::Input_arguments): Initialize file_count_.
2568         (Input_arguments::add_file): Remove const.
2569         (Input_arguments::number_of_input_files): New function.
2570         (Input_arguments::file_count_): New data member.
2571         (Command_line::number_of_input_files): Call
2572         Input_arguments::number_of_input_files.
2573         * output.cc (Output_segment_headers::Output_segment_headers):
2574         Set current size.
2575         (Output_section::Input_section::current_data_size): New function.
2576         (Output_section::Output_section): Initialize new data members.
2577         (Output_section::add_input_section): Don't do merge sections for
2578         an incremental link; allocate space from free list for an
2579         incremental update.
2580         (Output_section::add_output_section_data): Allocate space from
2581         free list for an incremental update.
2582         (Output_section::update_data_size): New function.
2583         (Output_section::set_fixed_layout): New function.
2584         (Output_section::reserve): New function.
2585         (Output_segment::set_section_addresses): Remove const.
2586         (Output_segment::set_section_list_addresses): Remove const; allocate
2587         space from free list for an incremental update.
2588         (Output_segment::set_offset): Adjust size of RELRO segment for an
2589         incremental update.
2590         * output.h (Output_data::current_data_size): Move here from
2591         child classes.
2592         (Output_data::pre_finalize_data_size): New function.
2593         (Output_data::update_data_size): New function.
2594         (Output_section_headers::update_data_size): new function.
2595         (Output_section_data_build::current_data_size): Move to Output_data.
2596         (Output_data_strtab::update_data_size): New function.
2597         (Output_section::current_data_size): Move to Output_data.
2598         (Output_section::set_fixed_layout): New function.
2599         (Output_section::has_fixed_layout): New function.
2600         (Output_section::reserve): New function.
2601         (Output_section::update_data_size): New function.
2602         (Output_section::has_fixed_layout_): New data member.
2603         (Output_section::free_list_): New data member.
2604         (Output_segment::set_section_addresses): Remove const.
2605         (Output_segment::set_section_list_addresses): Remove const.
2606         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2607         New function.
2608         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2609         New function.
2610         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2611         parameter when calling Add_symbols constructor; store argument
2612         serial number for members of a lib group.
2613         (Add_symbols::locks): Allow case where token == NULL.
2614         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2615         (Read_member::~Read_member): New function.
2616         (Read_member::is_runnable): New function.
2617         (Read_member::locks): New function.
2618         (Read_member::run): New function.
2619         (Check_script::~Check_script): New function.
2620         (Check_script::is_runnable): New function.
2621         (Check_script::locks): New function.
2622         (Check_script::run): New function.
2623         (Check_library::~Check_library): New function.
2624         (Check_library::is_runnable): New function.
2625         (Check_library::locks): New function.
2626         (Check_library::run): New function.
2627         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2628         (Add_symbols::library_): New data member.
2629         (class Read_member): New class.
2630         (class Check_script): New class.
2631         (class Check_library): New class.
2632         * reloc.cc (Read_relocs::is_runnable): Allow case where
2633         token == NULL.
2634         (Read_relocs::locks): Likewise.
2635         (Scan_relocs::locks): Likewise.
2636         (Relocate_task::locks): Likewise.
2637         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2638         to clear counters.
2639         (Sized_relobj::incremental_relocs_scan): Fix comment.
2640         (Sized_relobj::do_relocate): Pass output file offset to
2641         write_local_symbols.
2642         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2643         from class declaration.
2644         * script.cc (read_input_script): Allocate Script_info; pass
2645         argument serial number to report_script.
2646         * script.h (class Script_info): Move to incremental.h.
2647         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2648         * symtab.h (Symbol_table::add_from_incrobj): New function.
2649         (Symbol_table::set_file_offset): New function.
2650
2651 2011-04-05  Cary Coutant  <ccoutant@google.com>
2652
2653         * incremental-dump.cc (dump_incremental_inputs): Change signature
2654         to take a Sized_incremental_binary; change caller.  Use readers
2655         in Sized_incremental_binary.
2656         * incremental.cc
2657         (Sized_incremental_binary::find_incremental_inputs_sections):
2658         Rename do_find_incremental_inputs_sections to this.
2659         (Sized_incremental_binary::setup_readers): New function.
2660         (Sized_incremental_binary::do_check_inputs): Check
2661         has_incremental_info_ flag; move setup code to setup_readers;
2662         use input readers.
2663         (Sized_incremental_binary::do_file_is_unchanged): New function.
2664         (Sized_incremental_binary::do_get_input_reader): New function.
2665         * incremental.h (class Incremental_binary): Move to end of file.
2666         (Incremental_binary::file_is_unchanged): New function.
2667         (Incremental_binary::do_file_is_unchanged): New function.
2668         (Incremental_binary::Input_reader): New class.
2669         (Incremental_binary::get_input_reader): New function.
2670         (class Sized_incremental_binary): Move to end of file.
2671         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2672         input section reader classes.
2673         (Sized_incremental_binary::has_incremental_info): New function.
2674         (Sized_incremental_binary::inputs_reader): New function.
2675         (Sized_incremental_binary::symtab_reader): New function.
2676         (Sized_incremental_binary::relocs_reader): New function.
2677         (Sized_incremental_binary::got_plt_reader): New function.
2678         (Sized_incremental_binary::do_file_is_unchanged): New function.
2679         (Sized_incremental_binary::Sized_input_reader): New class.
2680         (Sized_incremental_binary::get_input_reader): New function.
2681         (Sized_incremental_binary::find_incremental_inputs_sections):
2682         Rename do_find_incremental_inputs_sections to this.
2683         (Sized_incremental_binary::setup_readers): New function.
2684         (Sized_incremental_binary::has_incremental_info_): New data member.
2685         (Sized_incremental_binary::inputs_reader_): New data member.
2686         (Sized_incremental_binary::symtab_reader_): New data member.
2687         (Sized_incremental_binary::relocs_reader_): New data member.
2688         (Sized_incremental_binary::got_plt_reader_): New data member.
2689         (Sized_incremental_binary::current_input_file_): New data member.
2690
2691 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2692
2693         PR gold/12640
2694         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2695         violation.
2696
2697 2011-03-30  Cary Coutant  <ccoutant@google.com>
2698
2699         * archive.cc (Archive::include_member): Adjust call to report_object.
2700         (Add_archive_symbols::run): Add script_info to call to
2701         report_archive_begin.
2702         (Lib_group::include_member): Adjust call to report_object.
2703         (Add_lib_group_symbols::run): Adjust call to report_object.
2704         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2705         blocks.  Add object count for script input files.
2706         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2707         script_info parameter; change all callers.
2708         (Incremental_inputs::report_object): Add script_info parameter;
2709         change all callers.
2710         (Incremental_inputs::report_script): Store backpointer to
2711         incremental info entry.
2712         (Output_section_incremental_inputs::set_final_data_size): Record
2713         additional information for scripts.
2714         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2715         * incremental.h (Incremental_script_entry::add_object): New function.
2716         (Incremental_script_entry::get_object_count): New function.
2717         (Incremental_script_entry::get_object): New function.
2718         (Incremental_script_entry::objects_): New data member; adjust
2719         constructor.
2720         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2721         (Incremental_inputs::report_object): Add script_info parameter.
2722         (Incremental_inputs_reader::get_object_count): New function.
2723         (Incremental_inputs_reader::get_object_offset): New function.
2724         * options.cc (Input_arguments::add_file): Return reference to
2725         new input argument.
2726         * options.h (Input_argument::set_script_info): New function.
2727         (Input_argument::script_info): New function.
2728         (Input_argument::script_info_): New data member; adjust all
2729         constructors.
2730         (Input_file_group::add_file): Return reference to new input argument.
2731         (Input_file_lib::add_file): Likewise.
2732         (Input_arguments::add_file): Likewise.
2733         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2734         * script.cc (Parser_closure::Parser_closure): Add script_info
2735         parameter; adjust all callers.
2736         (Parser_closure::script_info): New function.
2737         (Parser_closure::script_info_): New data member.
2738         (read_input_script): Report scripts earlier to incremental info.
2739         (script_add_file): Set script_info in Input_argument.
2740         (script_add_library): Likewise.
2741         * script.h (Script_options::Script_info): Rewrite class.
2742
2743 2011-03-29  Cary Coutant  <ccoutant@google.com>
2744
2745         * archive.cc (Library_base::should_include_member): Move
2746         method here from class Archive.
2747         (Archive::Archive): Initialize base class.
2748         (Archive::should_include_member): Move to base class.
2749         (Archive::do_for_all_unused_symbols): New function.
2750         (Add_archive_symbols::run): Remove redundant access to
2751         incremental_inputs.
2752         (Lib_group::Lib_group): Initialize base class.
2753         (Lib_group::do_filename): New function.
2754         (Lib_group::include_member): Pass pointer to Lib_group to
2755         report_object.
2756         (Lib_group::do_for_all_unused_symbols): New function.
2757         (Add_lib_group_symbols::run): Report archive information for
2758         incremental links.
2759         * archive.h (class Library_base): New base class.
2760         (class Archive): Derive from Library_base.
2761         (Archive::filename): Move to base class.
2762         (Archive::set_incremental_info): Likewise.
2763         (Archive::incremental_info): Likewise.
2764         (Archive::Should_include): Likewise.
2765         (Archive::should_include_member): Likewise.
2766         (Archive::Armap_entry): Remove.
2767         (Archive::Unused_symbol_iterator): Remove.
2768         (Archive::unused_symbols_begin): Remove.
2769         (Archive::unused_symbols_end): Remove.
2770         (Archive::do_filename): New function.
2771         (Archive::do_get_mtime): New function.
2772         (Archive::do_for_all_unused_symbols): New function.
2773         (Archive::task_): Move to base class.
2774         (Archive::incremental_info_): Likewise.
2775         (class Lib_group): Derive from Library_base.
2776         (Lib_group::do_filename): New function.
2777         (Lib_group::do_get_mtime): New function.
2778         (Lib_group::do_for_all_unused_symbols): New function.
2779         (Lib_group::task_): Move to base class.
2780         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2781         function.
2782         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2783         function.
2784         * incremental.cc (Incremental_inputs::report_archive_begin):
2785         Use Library_base; call library's get_mtime; add incremental inputs
2786         entry before members.
2787         (class Unused_symbol_visitor): New class.
2788         (Incremental_inputs::report_archive_end): Use Library_base; use
2789         visitor class to record unused symbols; don't add incremental inputs
2790         entry after members.
2791         (Incremental_inputs::report_object): Use Library_base.
2792         * incremental.h
2793         (Incremental_archive_entry::Incremental_archive_entry): Remove
2794         unused Archive parameter.
2795         (Incremental_inputs::report_archive_begin): Use Library_base.
2796         (Incremental_inputs::report_archive_end): Likewise.
2797         (Incremental_inputs::report_object): Likewise.
2798         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2799         function.
2800         * object.h (Object::for_all_global_symbols): New function.
2801         (Object::do_for_all_global_symbols): New function.
2802         (Sized_relobj::do_for_all_global_symbols): New function.
2803         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2804         function.
2805         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2806         function.
2807
2808 2011-03-27  Ian Lance Taylor  <iant@google.com>
2809
2810         * archive.cc (Archive::interpret_header): Return -1 if something
2811         goes wrong.  Change callers accordingly.
2812
2813 2011-03-25  Cary Coutant  <ccoutant@google.com>
2814
2815         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2816         * testsuite/Makefile.in: Regenerate.
2817
2818 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2819
2820         * plugin.cc (get_view): New.
2821         (Plugin::load): Pass get_view to the plugin.
2822         (Plugin_manager::get_view): New.
2823
2824 2011-03-21  Ian Lance Taylor  <iant@google.com>
2825
2826         * testsuite/final_layout.sh: Rewrite to not use dc.
2827         * testsuite/relro_test.sh: Fail if dc is not present.
2828
2829 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2830
2831         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2832         Change == to -eq.
2833         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2834         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2835         Change == to -eq.
2836         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2837         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2838
2839 2011-03-14  Ian Lance Taylor  <iant@google.com>
2840
2841         * script-sections.cc (Sort_output_sections::script_compare):
2842         Rename from is_before, change return type.
2843         (Sort_output_sections::operator()): Adjust accordingly.
2844
2845 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2846
2847         PR gold/12572
2848         * testsuite/odr_violation2.cc: Add comment to make all error line
2849         numbers double digits.
2850         * testsuite/debug_msg.sh: Adjust expected errors.
2851
2852 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2853
2854         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2855         but mark earlier ones as non-canonical
2856         (offset_to_iterator): Update search target and example
2857         (do_addr2line): Return extra lines in a vector*
2858         (format_file_lineno): Extract from do_addr2line
2859         (one_addr2line): Add vector* out-param
2860         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2861         when a lineno entry appeared last for its instruction
2862         (Dwarf_line_info): Add vector* out-param
2863         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2864         * symtab.cc (Odr_violation_compare): Include the lineno in the
2865         comparison again.
2866         (linenos_from_loc): New. Combine the canonical line for an
2867         address with its other lines.
2868         (True_if_intersect): New. Helper functor to make
2869         std::set_intersection a query.
2870         (detect_odr_violations): Compare sets of lines instead of just
2871         one line for each function. This became less deterministic, but
2872         has fewer false positives.
2873         * symtab.h: Declarations.
2874         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2875         mix an optimized and non-optimized object in the same binary
2876         (odr_violation2.so): Same.
2877         * testsuite/Makefile.in: Regenerate from Makefile.am.
2878         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2879         * testsuite/debug_msg.sh: Update line numbers and add
2880         assertions.
2881         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2882         non-optimized context.
2883         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2884         isn't inlined, and use OdrDerived in an optimized context.
2885         * testsuite/odr_header1.h: Defines OdrDerived, where
2886         optimization will change the
2887         first-instruction-in-the-destructor's file and line number.
2888         * testsuite/odr_header2.h: Defines OdrBase.
2889
2890 2011-03-09  Ian Lance Taylor  <iant@google.com>
2891
2892         * fileread.cc (File_read::clear_views): Don't delete the whole
2893         file view.
2894
2895 2011-03-08  Ian Lance Taylor  <iant@google.com>
2896
2897         PR gold/12525
2898         * fileread.cc: #include <climits>.
2899         (GOLD_IOV_MAX): Define.
2900         (File_read::read_multiple): Limit number of entries by iov_max.
2901         * fileread.h (class File_read): Always set max_readv_entries to
2902         128.
2903
2904 2011-03-07  Ian Lance Taylor  <iant@google.com>
2905
2906         PR gold/12525
2907         * options.h (class General_options): Add -dy and -dn.
2908
2909 2011-03-02  Cary Coutant  <ccoutant@google.com>
2910
2911         * testsuite/script_test_9.t: Add TLS segment.
2912
2913 2011-03-02  Simon Baldwin  <simonb@google.com>
2914
2915         * configure.ac: Add check for gnu_indirect_function support in
2916         the toolchain building binutils.
2917         * configure: Rebuild.
2918
2919 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2920
2921         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2922         plugin only symbols.
2923         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2924         in plugin files as not needed in the symbol table.
2925
2926 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2927
2928         * output.cc (Output_section::add_input_section): Delay fill
2929         generation for section ordering.
2930
2931 2011-02-09  Ian Lance Taylor  <iant@google.com>
2932
2933         PR gold/12316
2934         * object.h (class Sized_relobj): Remove clear_local_symbols.
2935         * reloc.cc (Sized_relobj::do_relocate): Don't call
2936         clear_local_symbols.
2937
2938 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2939
2940         * plugin.cc (is_visible_from_outside): Return true for symbols
2941         in the -u option.
2942
2943 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2944
2945         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2946         filename.
2947
2948 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2949
2950         * icf.h (is_section_foldable_candidate): Change type of parameter
2951         to std::string.
2952         * icf.cc (Icf::find_identical_sections): Change type of local variable
2953         section_name to be std::string.
2954         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2955
2956 2011-01-25  Ian Lance Taylor  <iant@google.com>
2957
2958         * script.cc (script_add_extern): Rewrite to use
2959         add_symbol_reference.
2960
2961 2011-01-25  Doug Kwan  <dougkwan@google.com>
2962
2963         * icf.cc (get_section_contents): Always lock section's object.
2964
2965 2011-01-24  Ian Lance Taylor  <iant@google.com>
2966
2967         * options.h (class General_options): Accept
2968         --no-detect-odr-violations.
2969
2970 2011-01-24  Ian Lance Taylor  <iant@google.com>
2971
2972         * version.cc (version_string): Bump to 1.11.
2973
2974 2011-01-24  Ian Lance Taylor  <iant@google.com>
2975
2976         * plugin.cc (class Plugin_rescan): Define new class.
2977         (Plugin_manager::claim_file): Set any_claimed_.
2978         (Plugin_manager::save_archive): New function.
2979         (Plugin_manager::save_input_group): New function.
2980         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2981         necessary.
2982         (Plugin_manager::new_undefined_symbol): New function.
2983         (Plugin_manager::rescan): New function.
2984         (Plugin_manager::rescannable_defines): New function.
2985         (Plugin_manager::add_input_file): Set any_added_.
2986         * plugin.h (class Plugin_manager): define new fields rescannable_,
2987         undefined_symbols_, any_claimed_, and any_added_.  Declare
2988         Plugin_rescan as friend.  Declare new functions.
2989         (Plugin_manager::Rescannable): Define type.
2990         (Plugin_manager::Rescannable_list): Define type.
2991         (Plugin_manager::Undefined_symbol_list): Define type.
2992         (Plugin_manager::Plugin_manager): Initialize new fields.
2993         * archive.cc (Archive::defines_symbol): New function.
2994         (Add_archive_symbols::run): Pass archive to plugins if any.
2995         * archive.h (class Archive): Declare defines_symbol.
2996         * readsyms.cc (Input_group::~Input_group): New function.
2997         (Finish_group::run): Pass input_group to plugins if any.
2998         * readsyms.h (class Input_group): Declare destructor.
2999         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3000         any.
3001
3002 2011-01-10  Ian Lance Taylor  <iant@google.com>
3003
3004         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3005         section as relro.
3006         (Layout::set_segment_offsets): Reset increase_relro before calling
3007         set_section_addresses a second time.
3008
3009 2011-01-04  Cary Coutant  <ccoutant@google.com>
3010
3011         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3012         sections before NOBITS sections.
3013
3014 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3015
3016         * version.cc (print_version): Update copyright to 2011.
3017
3018 2010-12-23  Cary Coutant  <ccoutant@google.com>
3019
3020         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3021         of OS to this->add.  Add OD parameter to second form of the function.
3022
3023 2010-12-20  Ian Lance Taylor  <iant@google.com>
3024
3025         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3026         second of two consecutive entries with same offset.
3027
3028 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3029
3030         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3031         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3032         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3033         to avoid unneeded links against $(LDADD).
3034         * testsuite/Makefile.in: Regenerate.
3035
3036 2010-12-15  Ian Lance Taylor  <iant@google.com>
3037
3038         PR gold/12324
3039         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3040         for R_X86_64_32 and R_X86_64_PC32.
3041         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3042         ver_matching_def_pic.o.
3043         (ver_matching_def_pic.o): New target.
3044
3045 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3046
3047         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3048         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3049         Move definition before File_read::View member definitions.
3050         (File_read::View::~View): Initialize and hold lock before
3051         updating current_mapped_bytes.
3052
3053 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3054
3055         * dwarf_reader.cc: Remove outdated comment.
3056         * gold-threads.cc: Fix typo in error message.
3057         * archive.cc: Fix typos in comments.
3058         * archive.h: Likewise.
3059         * arm-reloc-property.cc: Likewise.
3060         * arm-reloc-property.h: Likewise.
3061         * arm-reloc.def: Likewise.
3062         * arm.cc: Likewise.
3063         * attributes.h: Likewise.
3064         * cref.cc: Likewise.
3065         * ehframe.cc: Likewise.
3066         * fileread.h: Likewise.
3067         * gold.h: Likewise.
3068         * i386.cc: Likewise.
3069         * icf.cc: Likewise.
3070         * incremental.h: Likewise.
3071         * int_encoding.cc: Likewise.
3072         * layout.h: Likewise.
3073         * main.cc: Likewise.
3074         * merge.h: Likewise.
3075         * object.cc: Likewise.
3076         * object.h: Likewise.
3077         * options.cc: Likewise.
3078         * readsyms.cc: Likewise.
3079         * reduced_debug_output.cc: Likewise.
3080         * reloc.cc: Likewise.
3081         * script-sections.cc: Likewise.
3082         * sparc.cc: Likewise.
3083         * symtab.h: Likewise.
3084         * target-reloc.h: Likewise.
3085         * target.cc: Likewise.
3086         * target.h: Likewise.
3087         * timer.cc: Likewise.
3088         * timer.h: Likewise.
3089         * x86_64.cc: Likewise.
3090
3091 2010-12-09  Cary Coutant  <ccoutant@google.com>
3092
3093         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3094         stack.
3095         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3096         parameter; change all callers.
3097         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3098         * options.h (warn_execstack): New option.
3099
3100 2010-12-07  Doug Kwan  <dougkwan@google.com>
3101
3102         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3103         like function call relocations.
3104
3105 2010-12-07  Ian Lance Taylor  <iant@google.com>
3106
3107         * archive.cc (Archive::get_elf_object_for_member): Permit
3108         punconfigured to be NULL.
3109         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3110         (Archive::include_member): Pass NULL to get_elf_object_for_member
3111         if we searched for the archive and this is the first included
3112         object.
3113
3114 2010-12-01  Ian Lance Taylor  <iant@google.com>
3115
3116         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3117         track_relocs_type_ field.
3118         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3119         Set track_relocs_type_.
3120         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3121         contents when using RELA relocs.
3122         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3123         reloc_map_.
3124         * reloc.cc (Track_relocs::next_addend): New function.
3125         * reloc.h (class Track_relocs): Declare next_addend.
3126
3127 2010-12-01  Ian Lance Taylor  <iant@google.com>
3128
3129         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3130         virtual destructor.
3131
3132 2010-12-01  Ian Lance Taylor  <iant@google.com>
3133
3134         * README: Update compilers known to work and fail.
3135
3136 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3137
3138         * configure.in: For --enable-gold, handle value `default' instead of
3139         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3140         not the default.
3141         * configure: Regenerate.
3142
3143 2010-11-18  Doug Kwan  <dougkwan@google.com>
3144
3145         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3146         and right_alignment to be zero.  Store result alignment only if it is
3147         greater than existing alignment.
3148
3149 2010-11-16  Cary Coutant  <ccoutant@google.com>
3150
3151         PR gold/12220
3152         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3153         Check for ".zdebug_line".
3154
3155 2010-11-16  Doug Kwan  <dougkwan@google.com>
3156             Cary Coutant  <ccoutant@google.com>
3157
3158         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3159         by reference; adjust all callers.
3160         * output.cc (Output_segment::set_section_addresses): Adjust references
3161         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3162         list is empty.
3163         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3164         end at page boundary.
3165
3166 2010-11-16  Cary Coutant  <ccoutant@google.com>
3167
3168         PR gold/12220
3169         * layout.cc (Layout::choose_output_section): Transform names of
3170         compressed sections even when using a script with a SECTIONS clause.
3171         (Layout::output_section_name): Remove code to transform
3172         compressed debug section names.
3173         * output.cc (Output_section::add_input_section): Use uncompressed
3174         section size when tracking input sections.
3175
3176 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3177
3178         * symtab.h (Symbol::NON_PIC_REF): Remove.
3179         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3180         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3181         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3182         (Symbol::use_plt_offset): Take a flags argument and pass it
3183         directly to needs_dynamic_reloc.  Restrict check for undefined
3184         weak symbols to function calls.
3185         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3186         (Target_arm::Scan::global): Use it.
3187         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3188         (Target_arm::Relocate::relocate): Likewise.
3189         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3190         parameter with an r_type parameter.  Use get_reference_flags
3191         to get the flags.
3192         (Target_arm::Relocate::relocate): Update accordingly.
3193         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3194         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3195         (Target_i386::Scan::global): Likewise.
3196         (Target_i386::Relocate::relocate): Likewise.
3197         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3198         parameter with an r_type parameter.  Use get_reference_flags
3199         to get the flags.
3200         (Target_i386::Relocate::relocate): Update accordingly.
3201         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3202         (Target_powerpc::Scan::global): Use it.
3203         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3204         (Target_powerpc::Relocate::relocate): Likewise.
3205         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3206         (Target_sparc::Scan::global): Use it.
3207         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3208         (Target_sparc::Relocate::relocate): Likewise.
3209         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3210         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3211         (Target_x86_64::Scan::global): Likewise.
3212         (Target_x86_64::Relocate::relocate): Likewise.
3213
3214 2010-11-08  Doug Kwan  <dougkwan@google.com>
3215             Cary Coutant  <ccoutant@google.com>
3216
3217         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3218         (Arm_exidx_merge_section::section_contents_): New data member.
3219         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3220         (Arm_input_section::~Arm_input_section): De-allocate memory.
3221         (Arm_input_section::original_contents_): New data member.       
3222         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3223         in parameters instead of calling Object::section_contents without
3224         locking.
3225         (Arm_output_section::group_section): New parameter TASK.  Pass it
3226         to callees that need locking objects.
3227         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3228         to lock EXIDX input sections.  Fix a formatting issue.  Call
3229         Arm_exidx_merged_section::build_contents to create merged section
3230         contents.
3231         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3232         to lock object of stub table owner.
3233         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3234         TEXT_SIZE to initialize data member TEXT_SIZE_.
3235         (Arm_exidx_input_section::addralign): Fix typo in comment.
3236         (Arm_exidx_input_section::text_size): New method.
3237         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3238         that require locking objects.  Lock objects before scanning for stubs
3239         and updating local symbols.
3240         (Arm_input_section<big_endian>::init): Copy contents of original
3241         input section.
3242         (Arm_input_section<big_endian>::do_write): Use saved contents of
3243         original input section instead of calling Object::section_contents
3244         without locking.
3245         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3246         size without calling Object::section_size().
3247         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3248         for size.  Allocate a buffer for merged EXIDX entries.
3249         (Arm_exidx_merged_section::build_contents): New method.
3250         (Arm_exidx_merged_section::do_write): Move merge section contents
3251         building code to Arm_exidx_merged_section::build_contetns.  Write
3252         out contetns in buffer instead of building it on the fly.
3253         (Arm_relobj::make_exidx_input_section): Also pass text section size
3254         to Arm_exidx_input_section constructor.
3255         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3256         (Arm_dynobj::do_read_symbols): Fix memory leak.
3257         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3258         * target.h: (class Task): Add forward declaration.
3259         (Target::relax): Add new parameter TASK and pass it to
3260         Target::do_relax().
3261         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3262
3263 2010-11-05  Cary Coutant  <ccoutant@google.com>
3264
3265         PR gold/10708
3266         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3267         object when reading from the file.
3268         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3269         second layout pass.
3270         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3271         when reading section contents.
3272         (get_section_contents): Likewise.
3273         (icf::find_identical_sections): Likewise.
3274         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3275         object when reading from the file.
3276         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3277         the object when doing deferred section layout.
3278
3279 2010-11-03  Nick Clifton  <nickc@redhat.com>
3280
3281         PR gold/12001
3282         * script.h (class Symbol_assignment: name): New member.  Returns
3283         the name of the symbol.
3284         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3285         Returns true if the given symbol name is on the list of
3286         assignments wating to be processed.
3287         * archive.cc (should_incldue_member): If the symbol is undefined,
3288         check to see if it is on the list of symbols pending assignment.
3289
3290 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3291
3292         * script-sections.cc (Script_sections::find_memory_region): Check
3293         for a NULL output section pointer.
3294
3295 2010-10-29  Doug Kwan  <dougkwan@google.com>
3296
3297         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3298         Output_section::add_relaxed_input_section.
3299         * output.cc (Output_section::add_relaxed_input_section): Add new
3300         arguments LAYOUT and NAME.  Set section order index.
3301         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3302         Copy section order index.
3303         * output.h (Output_section::add_relaxed_input_section): Add new
3304         arguments LAYOUT and NAME.
3305
3306 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3307
3308         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3309         NATIVE_OR_CROSS_LINKER.
3310         * testsuite/Makefile.in: Regenerate.
3311
3312 2010-10-20  Doug Kwan  <dougkwan@google.com>
3313
3314         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3315         without SHF_LINK_ORDER flags.
3316         * layout.cc (Layout::choose_output_section): Do not filter
3317         SHF_LINK_ORDER flag in a relocatable link.
3318
3319 2010-10-17  Cary Coutant  <ccoutant@google.com>
3320
3321         * output.h (Output_segment::set_section_addresses): Change function
3322         signature.  Update all callers.
3323         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3324         sections.
3325         (Output_segment::set_section_addresses): Align after last TLS
3326         section.  Add padding before last relro section instead of after.
3327
3328 2010-10-17  Doug Kwan  <dougkwan@google.com>
3329
3330         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3331         GOT output section to be writable.
3332
3333 2010-10-14  Cary Coutant  <ccoutant@google.com>
3334
3335         * debug.h (DEBUG_INCREMENTAL): New flag.
3336         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3337         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3338         mode.
3339         * incremental.cc (report_command_line): Ignore all forms of
3340         --incremental.
3341         * layout.cc (Layout::Layout): Check parameters for incremental link
3342         mode.
3343         * options.cc (General_options::parse_incremental): New function.
3344         (General_options::parse_no_incremental): New function.
3345         (General_options::parse_incremental_full): New function.
3346         (General_options::parse_incremental_update): New function.
3347         (General_options::incremental_mode_): New data member.
3348         (General_options::finalize): Check incremental_mode_.
3349         * options.h (General_options): Update help text for --incremental.
3350         Add --no-incremental, --incremental-full, --incremental-update.
3351         (General_options::Incremental_mode): New enum type.
3352         (General_options::incremental_mode): New function.
3353         (General_options::incremental_mode_): New data member.
3354         * parameters.cc (Parameters::incremental_mode_): New data member.
3355         (Parameters::set_options): Set incremental_mode_.
3356         (Parameters::set_incremental_full): New function.
3357         (Parameters::incremental): New function.
3358         (Parameters::incremental_update): New function.
3359         (set_parameters_incremental_full): New function.
3360         * parameters.h (Parameters::set_incremental_full): New function.
3361         (Parameters::incremental): New function.
3362         (Parameters::incremental_update): New function.
3363         (Parameters::incremental_mode_): New data member.
3364         (set_parameters_incremental_full): New function.
3365         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3366         incremental link mode.
3367         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3368         (Sized_relobj::do_relocate_sections): Likewise.
3369         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3370         option.
3371         * testsuite/Makefile.in: Regenerate.
3372         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3373
3374 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3375
3376         * script-sections.h (class Script_sections): Make
3377         Sections_elements typedef public.
3378         * script-sections.cc (class Sort_output_sections): Add elements_
3379         field.  Add constructor which sets it; change all callers.
3380         (Sort_output_sections::is_before): New function.
3381         (Sort_output_sections::operator()): Call is_before.
3382         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3383         conditional.
3384         * testsuite/script_test_10.sh: New test. Test script section
3385         order.
3386         * testsuite/script_test_10.t: Likewise.
3387         * testsuite/script_test_10.s: Likewise.
3388         * testsuite/Makefile.am: Wrap the cross linker tests and the
3389         common tests into NATIVE_OR_CROSS_LINKER.
3390         (check_SCRIPTS): Add script_test_10.sh.
3391         (check_DATA): Add script_test_10.stdout.
3392         (script_test_10.o, script_test_10): New targets.
3393         (script_test_10.stdout): New target.
3394         * configure, testsuite/Makefile.in: Regenerate.
3395
3396 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3397
3398         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3399         error for the deprecated relocations.
3400         (Target_arm::Scan::global): Likewise.
3401         (Target_arm::Relocate::relocate): Likewise.
3402
3403 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3404
3405         * fileread.cc (Input_file::find_file): Initialize *found_name
3406         and *namep when using the fallback search for case 4.
3407
3408 2010-10-11  Cary Coutant  <ccoutant@google.com>
3409
3410         * options.h (class General_options): Redefine -z lazy as an alias for
3411         the negation of -z now.
3412
3413 2010-10-11  Ian Lance Taylor  <iant@google.com>
3414
3415         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3416         binding.
3417
3418 2010-10-06  Nick Clifton  <nickc@redhat.com>
3419
3420         * script-sections.cc(class Memory_region): Remove
3421         current_lma_offset_ field.  Rename current_vma_offset_ to
3422         current_offset_.  Add last_section_ field.
3423         (Memory_region::get_current_vma_address): Rename to
3424         get_current_address.
3425         (Memory_region::get_current_lma_address): Delete.
3426         (Memory_region::increment_vma_offset): Rename to
3427         increment_offset.
3428         (Memory_region::increment_lma_offset): Delete.
3429         (Memory_region::attributes_compatible): New method.  Returns
3430         true if the provided section is compatible with the region.
3431         (Memory_region::get_last_section): New method.  Returns the last
3432         section to use the region.
3433         (Memory_region::set_last_section): New method.  Stores the last
3434         section to use the region.
3435         (Script_sections::block_in_region): New method.  Returns true if
3436         a block of memory is contained within a region.
3437         (Script_sections::find_memory_region): New method.  Locates a
3438         memory region to be used to set a VMA or LMA address.
3439         (Output_section_definition::set_section_addresses): Add code to
3440         check for addresses set by memory regions.
3441         (Output_segment::set_section_addresses): Remove memory region
3442         walking code.
3443         (Script_sections::create_segment): Add a warning if a header
3444         segment is created outside of any region.
3445         * script-sections.h (class Script_sections): Add prototypes for
3446         find_memory_region and block_in_region methods.
3447         * testsuite/memory_test.s: Use .long instead of .word.
3448         * testsuite/memory_test.t: Add some more output sections.
3449         * testsuite/memory_test.sh: Update expected output.
3450
3451 2010-10-02  Doug Kwan  <dougkwan@google.com>
3452
3453         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3454         defintion to symtab.h
3455         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3456         declaration to defintion.
3457
3458 2010-10-01  Nick Clifton  <nickc@redhat.com>
3459
3460         * expression.cc (eval): Replace dummy argument with NULL.
3461         (eval_maybe_dot): Check for a NULL result section pointer.
3462         (Symbol_expression::value): Likewise.
3463         (Dot_expression::value): Likewise.
3464         (BINARY_EXPRESSION): Likewise.
3465         (Max_expression::value): Likewise.
3466         (Min_expression::value): Likewise.
3467         (Absolute_expression::value): Likewise.
3468         (Addr_expression::value_from_output_section): Likewise.
3469         (Loaddddr_expression::value_from_output_section): Likewise.
3470         (Segment_start_expression::value): Likewise.
3471         * script-sections.cc
3472         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3473         argument with NULL.
3474         (Sections_elememt_dot_assignment::set_section_addresses):
3475         Likewise.
3476         (Output_data_expression::do_write_to_buffer): Likewise.
3477         (Output_section_definition::finalize_symbols): Likewise.
3478         (Output_section_definition::set_section_addresses): Likewise.
3479
3480 2010-09-30  Doug Kwan  <dougkwan@google.com>
3481
3482         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3483
3484 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3485
3486         * target.h (Target::can_icf_inline_merge_sections): New virtual
3487         function.
3488         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3489         virtual function.
3490         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3491         virtual function.
3492         * icf.cc (get_section_contents): Inline merge sections only when
3493         target allows it.
3494
3495 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3496
3497         * configure: Regenerate.
3498
3499 2010-09-17  Ian Lance Taylor  <iant@google.com>
3500
3501         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3502         * testsuite/Makefile.am (memory_test.o): New target.
3503         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3504         memory_test.t.
3505         * testsuite/Makefile.in: Rebuild.
3506
3507 2010-09-17  Doug Kwan  <dougkwan@google.com>
3508
3509         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3510         defintion if relocation uses GOT entries of the symbol.
3511         * testsuite/icf_safe_test.sh: Fix test.
3512         * testsuite/icf_safe_so_test.sh: Fix test.
3513
3514 2010-09-16  Cary Coutant  <ccoutant@google.com>
3515
3516         * script_sections.cc (class Memory_region): Remove "NULL" from
3517         vector initializations.
3518
3519 2010-09-15  Cary Coutant  <ccoutant@google.com>
3520
3521         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3522         Resolve forwarding symbols.
3523
3524 2010-09-15  Doug Kwan  <dougkwan@google.com>
3525
3526         * gold/testsuite/script_test_3.t: Add ARM special sections.
3527         * gold/testsuite/script_test_4.t: Same.
3528         * gold/testsuite/script_test_5.t: Same.
3529         * gold/testsuite/script_test_6.t: Same.
3530         * gold/testsuite/script_test_7.t: Same.
3531         * gold/testsuite/script_test_7.t: Same.
3532         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3533
3534 2010-09-14  Cary Coutant  <ccoutant@google.com>
3535
3536         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3537         (Target_x86_64::Relocate::relocate_tls): Replace check for
3538         saw_tls_block_reloc_ with test for executable section.
3539
3540 2010-09-12  Cary Coutant  <ccoutant@google.com>
3541
3542         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3543         position-independent executables to shared libraries need dynamic
3544         relocations.
3545         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3546         position-independent executables.
3547         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3548         * testsuite/Makefile.in: Regenerate.
3549
3550 2010-09-10  Nick Clifton  <nickc@redhat.com>
3551
3552         PR gold/11997
3553         * testsuite/memory_test.t: Discard any sections that are not
3554         needed.
3555
3556 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3557
3558         PR gold/11996
3559         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3560         "This::" to work around a bug in gcc 4.2.
3561
3562         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3563
3564 2010-09-09  Rafael Espindola  <espindola@google.com>
3565
3566         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3567         sections with different PF_X flags in the same segment.
3568         (Layout::find_first_load_seg): Search all segments to find the first
3569         one.
3570         * options.h (rosegment): New.
3571
3572 2010-09-08  Rafael Espindola  <espindola@google.com>
3573
3574         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3575
3576 2010-09-08  Doug Kwan  <dougkwan@google.com>
3577
3578         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3579         (Arm_relobj::do_relocate_sections): Add new parameter for output
3580         file to match the parent.
3581         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3582         of local symbols instead of input values.  Update code to track
3583         changes in gold::relocate_section.
3584         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3585         (Sized_relobj::compute_final_local_value_internal): New methods.
3586         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3587         body into private version of Sized_relobj::compute_final_local_value.
3588         Call the inline method.
3589         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3590         merged symbol value if there is one.
3591         (Symbol_value::has_output_value): New method defintiion.
3592         (Sized_relobj::Compute_final_local_value_status): New enum type.
3593         (Sized_relobj::compute_final_local_value): New methods.
3594         (Sized_relobj::compute_final_local_value_internal): New methods.
3595         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3596         and arm_cortex_a8.sh.
3597         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3598         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3599         New tests.
3600         * Makefile.in: Regenerate.
3601         * testsuite/arm_bl_out_of_range.s: Update test.
3602         * testsuite/thumb_bl_out_of_range.s: Ditto.
3603         * testsuite/thumb_blx_out_of_range.s: Ditto.
3604         * testsuite/arm_branch_out_of_range.sh: New file.
3605         * testsuite/arm_cortex_a8.sh: Ditto.
3606         * testsuite/arm_cortex_a8_b.s: Ditto.
3607         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3608         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3609         * testsuite/arm_cortex_a8_bl.s: Ditto.
3610         * testsuite/arm_cortex_a8_blx.s: Ditto.
3611         * testsuite/arm_cortex_a8_local.s: Ditto.
3612         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3613         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3614
3615 2010-09-08  Rafael Espindola  <espindola@google.com>
3616
3617         * Makefile.am (memory_test.stdout): Run readelf with -W.
3618         * Makefile.in: Regenerate.
3619         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3620         64 bit output.
3621
3622 2010-09-08  Rafael Espindola  <espindola@google.com>
3623
3624         * script-sections.cc (Script_sections::add_memory_region): Convert
3625         field precision to int.
3626         * script.cc (script_set_section_region, script_set_section_region):
3627         Convert field precision to int.
3628
3629 2010-09-08  Rafael Espindola  <espindola@google.com>
3630
3631         * arm.cc (do_finalize_sections): Create the __exidx_start and
3632         __exdix_end symbols even when the section is missing.
3633
3634 2010-09-08  Nick Clifton  <nickc@redhat.com>
3635
3636         * README: Remove claim that MEMORY is not supported.
3637         * expression.cc (script_exp_function_origin)
3638         (script_exp_function_length): Move from here to ...
3639         * script.cc: ... here.
3640         (script_set_section_region, script_add_memory)
3641         (script_parse_memory_attr, script_include_directive): New
3642         functions.
3643         * script-sections.cc
3644         (class Memory_region): New class.
3645         (class Output_section_definition): Add set_memory_region,
3646         set_section_vma, set_section_lma and get_section_name methods.
3647         (class Script_Sections): Add add_memory_region,
3648         find_memory_region, find_memory_region_origin,
3649         find_memory_region_length and set_memory_region methods.
3650         Have set_section_addresses method walk the list of set memory
3651         regions.
3652         Extend the print methos to display memory regions.
3653         * script-sections.h: Add prototypes for new methods.
3654         Add enum for MEMORY region attributes.
3655         * yyscript.y: Add support for parsing MEMORY regions.
3656         * script-c.h: Add prototypes for new functions.
3657         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3658         * testsuite/Makefile.in: Regenerate.
3659         * testsuite/memory_test.sh: New script.
3660         * testsuite/memory_test.s: New assembler source file.
3661         * testsuite/memory_test.t: New linker script.
3662
3663 2010-08-27  Doug Kwan  <dougkwan@google.com>
3664
3665         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3666         reference override an existing dynamic weak reference.
3667         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3668         * testsuite/Makefile.in: Regenerate.
3669         * testsuite/dyn_weak_ref.sh: New file.
3670         * testsuite/dyn_weak_ref_1.c: Ditto.
3671         * testsuite/dyn_weak_ref_2.c: Ditto.
3672
3673 2010-08-27  Ian Lance Taylor  <iant@google.com>
3674
3675         * incremental.h (class Incremental_input_entry): Add virtual
3676         destructor.
3677
3678 2010-08-27  Ian Lance Taylor  <iant@google.com>
3679
3680         * testsuite/start_lib_test_3.c: Mark t3 as used.
3681
3682 2010-08-27  Nick Clifton  <nickc@redhat.com>
3683
3684         * options.cc (version_script): Fix small typo in previous
3685         whitespace tidyup.
3686
3687 2010-08-25  Nick Clifton  <nickc@redhat.com>
3688
3689         * archive.cc: Formatting fixes: Remove whitespace between
3690         typename and following asterisk.  Remove whitespace between
3691         function name and opening parenthesis.
3692         * archive.h: Likewise.
3693         * arm.cc: Likewise.
3694         * attributes.cc: Likewise.
3695         * attributes.h: Likewise.
3696         * common.cc: Likewise.
3697         * copy-relocs.cc: Likewise.
3698         * dirsearch.h: Likewise.
3699         * dynobj.cc: Likewise.
3700         * ehframe.cc: Likewise.
3701         * ehframe.h: Likewise.
3702         * expression.cc: Likewise.
3703         * fileread.cc: Likewise.
3704         * fileread.h: Likewise.
3705         * gc.h: Likewise.
3706         * gold-threads.cc: Likewise.
3707         * gold.cc: Likewise.
3708         * i386.cc: Likewise.
3709         * icf.h: Likewise.
3710         * incremental-dump.cc: Likewise.
3711         * incremental.cc: Likewise.
3712         * layout.cc: Likewise.
3713         * layout.h: Likewise.
3714         * main.cc: Likewise.
3715         * merge.cc: Likewise.
3716         * merge.h: Likewise.
3717         * object.cc: Likewise.
3718         * object.h: Likewise.
3719         * options.cc: Likewise.
3720         * options.h: Likewise.
3721         * output.cc: Likewise.
3722         * output.h: Likewise.
3723         * plugin.cc: Likewise.
3724         * plugin.h: Likewise.
3725         * powerpc.cc: Likewise.
3726         * reloc.cc: Likewise.
3727         * script-c.h: Likewise.
3728         * script-sections.cc: Likewise.
3729         * script.cc: Likewise.
3730         * stringpool.cc: Likewise.
3731         * symtab.cc: Likewise.
3732         * symtab.h: Likewise.
3733         * target.cc: Likewise.
3734         * timer.cc: Likewise.
3735         * timer.h: Likewise.
3736         * version.cc: Likewise.
3737         * x86_64.cc: Likewise.
3738
3739 2010-08-24  Nick Clifton  <nickc@redhat.com>
3740
3741         PR 11899
3742         * layout.cc (segment_precedes): Sort segments by their physical
3743         addresses, if they have been set.
3744
3745 2010-08-23  Cary Coutant  <ccoutant@google.com>
3746
3747         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3748         symbols data.
3749         (Lib_group::include_member): Unlock object after deleting its
3750         symbols data.
3751         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3752         the bug fixed here.
3753
3754 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3755             Cary Coutant  <ccoutant@google.com>
3756
3757         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3758         constructor, and set_blocker.
3759         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3760         readsyms_blocker_.
3761         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3762         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3763         * testsuite/Makefile.am (start_lib_test): New test case.
3764         * testsuite/Makefile.in: Regenerate.
3765         * testsuite/start_lib_test_main.c: New file.
3766         * testsuite/start_lib_test_1.c: New file.
3767         * testsuite/start_lib_test_2.c: New file.
3768         * testsuite/start_lib_test_3.c: New file.
3769
3770 2010-08-19  Ian Lance Taylor  <iant@google.com>
3771
3772         * Makefile.in: Rebuild with automake 1.11.1.
3773         * aclocal.m4: Likewise.
3774         * testsuite/Makefile.in: Likewise.
3775
3776 2010-08-19  Ian Lance Taylor  <iant@google.com>
3777
3778         PR 10893
3779         * i386.cc (class Output_data_plt_i386): Update declarations.
3780         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3781         local_ifuncs_ fields.
3782         (Target_i386::do_plt_section_for_global): New function.
3783         (Target_i386::do_plt_section_for_local): New function.
3784         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3785         parameter; change all callers.  Initialize global_ifuncs_ and
3786         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3787         __rel_iplt_end.
3788         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3789         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3790         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3791         symbols.
3792         (Target_i386::make_plt_section): New function, broken out of
3793         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3794         (Target_i386::make_plt_entry): Call make_plt_section.
3795         (Target_i386::make_local_ifunc_plt_entry): New function.
3796         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3797         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3798         R_386_IRELATIVE to switch.
3799         (Target_i386::Scan::global): Likewise.
3800         (Target_i386::Relocate::relocate): Likewise.
3801         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3802         switch.
3803         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3804         (Target_x86_64::do_plt_section_for_global): New function.
3805         (Target_x86_64::do_plt_section_for_local): New function.
3806         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3807         parameter; change all callers.  If doing a static link define
3808         __rela_iplt_start and __rela_iplt_end.
3809         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3810         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3811         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3812         to point to .plt.
3813         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3814         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3815         switch.
3816         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3817         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3818         R_X86_64_IRELATIVE to switch.
3819         (Target_x86_64::Scan::global): Likewise.
3820         (Target_x86_64::Relocate::relocate): Likewise.
3821         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3822         switch.
3823         * target.h (class Target): Add plt_section_for_global and
3824         plt_section_for_local functions.  Add do_plt_section_for_global
3825         and do_plt_section_for_local virtual functions.
3826         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3827         clarifying comments.
3828         (Symbol::use_plt_offset): Handle IFUNC symbol.
3829         * object.cc (Sized_relobj::Sized_relobj): Initialize
3830         local_plt_offsets_.
3831         (Sized_relobj::local_has_plt_offset): New function.
3832         (Sized_relobj::local_plt_offset): New function.
3833         (Sized_relobj::set_local_plt_offset): New function.
3834         (Sized_relobj::do_count): Handle IFUNC symbol.
3835         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3836         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3837         is_ifunc_symbol functions.
3838         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3839         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3840         local_plt_offsets_ field.
3841         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3842         * output.h (class Output_section_data): Add non-const
3843         output_section function.
3844         (class Output_data_got): Update declarations.
3845         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3846         Add use_plt_offset parameter to global and local constructors.
3847         Change all callers.  Change local_sym_index_ field to 31 bits.
3848         Change GSYM_CODE and CONSTANT_CODE accordingly.
3849         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3850         doing a static link don't set sh_link field.
3851         (Output_data_got::Got_entry::write): Use PLT offset if
3852         appropriate.
3853         (Output_data_got::add_global_plt): New function.
3854         (Output_data_got::add_local_plt): New function.
3855         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3856         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3857         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3858         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3859         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3860         IFUNC conditional.
3861         * testsuite/ifunc-sel.h: New file.
3862         * testsuite/ifuncmain1.c: New file.
3863         * testsuite/ifuncmain1vis.c: New file.
3864         * testsuite/ifuncmod1.c: New file.
3865         * testsuite/ifuncdep2.c: New file.
3866         * testsuite/ifuncmain2.c: New file.
3867         * testsuite/ifuncmain3.c: New file.
3868         * testsuite/ifuncmod3.c: New file.
3869         * testsuite/ifuncmain4.c: New file.
3870         * testsuite/ifuncmain5.c: New file.
3871         * testsuite/ifuncmod5.c: New file.
3872         * testsuite/ifuncmain6pie.c: New file.
3873         * testsuite/ifuncmod6.c: New file.
3874         * testsuite/ifuncmain7.c: New file.
3875         * configure, testsuite/Makefile.in: Rebuild.
3876
3877 2010-08-18  Ian Lance Taylor  <iant@google.com>
3878
3879         * incremental.cc
3880         (Output_section_incremental_inputs::write_input_files): Add cast
3881         to avoid signed/unsigned comparison warning.
3882         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3883
3884 2010-08-12  Cary Coutant  <ccoutant@google.com>
3885
3886         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3887
3888 2010-08-13  Ian Lance Taylor  <iant@google.com>
3889
3890         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3891
3892 2010-08-12  Cary Coutant  <ccoutant@google.com>
3893             Doug Kwan  <dougkwan@google.com>
3894
3895         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3896         defintion overrides non-weak undef, remember that the original undef
3897         is not weak.
3898         * symtab.cc (Symbol_table::sized_write_global): For undef without
3899         an original weak binding, set binding to global in output.
3900         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3901         * testsuite/Makefile.in: Regenerate.
3902         * testsuite/strong_ref_weak_def.sh: New file.
3903         * testsuite/strong_ref_weak_def_1.c: Ditto.
3904         * testsuite/strong_ref_weak_def_2.c: Ditto.
3905
3906 2010-08-12  Cary Coutant  <ccoutant@google.com>
3907
3908         * testsuite/incremental_test.sh: Rewrite.
3909         * testsuite/incremental_test_1.c: Rewrite.
3910         * testsuite/incremental_test_2.c: Rewrite.
3911
3912 2010-08-12  Cary Coutant  <ccoutant@google.com>
3913
3914         * arm.cc (Target_arm::got_size): Add const.
3915         (Target_arm::got_entry_count): New function.
3916         (Target_arm::plt_entry_count): New function.
3917         (Target_arm::first_plt_entry_offset): New function.
3918         (Target_arm::plt_entry_size): New function.
3919         (Output_data_plt_arm::entry_count): New function.
3920         (Output_data_plt_arm::first_plt_entry_offset): New function.
3921         (Output_data_plt_arm::get_plt_entry_size): New function.
3922         * i386.cc (Target_i386::got_size): Add const.
3923         (Target_i386::got_entry_count): New function.
3924         (Target_i386::plt_entry_count): New function.
3925         (Target_i386::first_plt_entry_offset): New function.
3926         (Target_i386::plt_entry_size): New function.
3927         (Output_data_plt_i386::entry_count): New function.
3928         (Output_data_plt_i386::first_plt_entry_offset): New function.
3929         (Output_data_plt_i386::get_plt_entry_size): New function.
3930         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3931         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3932         * incremental.cc: Include target.h.
3933         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3934         parameter.  Adjust all callers.  Find incremental_got_plt section.
3935         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3936         section.
3937         (Output_section_incremental_inputs::set_final_data_size): Calculate
3938         size of incremental_got_plt section.
3939         (Output_section_incremental_inputs::do_write): Write the
3940         incremental_got_plt section.
3941         (Got_plt_view_info): New struct.
3942         (Local_got_offset_visitor): New class.
3943         (Global_got_offset_visitor): New class.
3944         (Global_symbol_visitor_got_plt): New class.
3945         (Output_section_incremental_inputs::write_got_plt): New function.
3946         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3947         Add parameter.  Adjust all callers.
3948         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3949         (Incremental_inputs::got_plt_section): New function.
3950         (Incremental_inputs::got_plt_section_): New data member.
3951         (Incremental_got_plt_reader): New class.
3952         * layout.cc (Layout::create_incremental_info_sections): Add the
3953         incremental_got_plt section.
3954         * object.h (Got_offset_list::get_list): New function.
3955         (Got offset_list::for_all_got_offsets): New function.
3956         (Sized_relobj::local_got_offset_list): New function.
3957         * powerpc.cc (Target_powerpc::got_size): Add const.
3958         (Target_powerpc::got_entry_count): New function.
3959         (Target_powerpc::plt_entry_count): New function.
3960         (Target_powerpc::first_plt_entry_offset): New function.
3961         (Target_powerpc::plt_entry_size): New function.
3962         (Output_data_plt_powerpc::entry_count): New function.
3963         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3964         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3965         * sparc.cc (Target_sparc::got_size): Add const.
3966         (Target_sparc::got_entry_count): New function.
3967         (Target_sparc::plt_entry_count): New function.
3968         (Target_sparc::first_plt_entry_offset): New function.
3969         (Target_sparc::plt_entry_size): New function.
3970         (Output_data_plt_sparc::entry_count): New function.
3971         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3972         (Output_data_plt_sparc::get_plt_entry_size): New function.
3973         * symtab.h (Symbol::got_offset_list): New function.
3974         (Symbol_table::for_all_symbols): New function.
3975         * target.h (Sized_target::got_entry_count): New function.
3976         (Sized_target::plt_entry_count): New function.
3977         (Sized_target::plt_entry_size): New function.
3978         * x86_64.cc (Target_x86_64::got_size): Add const.
3979         (Target_x86_64::got_entry_count): New function.
3980         (Target_x86_64::plt_entry_count): New function.
3981         (Target_x86_64::first_plt_entry_offset): New function.
3982         (Target_x86_64::plt_entry_size): New function.
3983         (Output_data_plt_x86_64::entry_count): New function.
3984         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3985         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3986
3987 2010-08-12  Cary Coutant  <ccoutant@google.com>
3988
3989         * archive.cc: Include incremental.h.
3990         (Archive::Archive): Initialize incremental_info_.
3991         (Archive::include_member): Record archive members in incremental info.
3992         (Add_archive_symbols::run): Record begin and end of an archive in
3993         incremental info.
3994         (Lib_group::include_member): Record objects in incremental info.
3995         * archive.h (Incremental_archive_entry): Forward declaration.
3996         (Archive::set_incremental_info): New member function.
3997         (Archive::incremental_info): New member function.
3998         (Archive::Unused_symbol_iterator): New class.
3999         (Archive::unused_symbols_begin): New member function.
4000         (Archive::unused_symbols_end): New member function.
4001         (Archive::incremental_info_): New data member.
4002         * incremental-dump.cc (find_input_containing_global): New function.
4003         (dump_incremental_inputs): Dump new incremental info sections.
4004         * incremental.cc: Include symtab.h.
4005         (Output_section_incremental_inputs): New class.
4006         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4007         new incremental info sections.
4008         (Sized_incremental_binary::do_check_inputs): Likewise.
4009         (Incremental_inputs::report_archive): Remove.
4010         (Incremental_inputs::report_archive_begin): New function.
4011         (Incremental_inputs::report_archive_end): New function.
4012         (Incremental_inputs::report_object): New function.
4013         (Incremental_inputs::finalize_inputs): Remove.
4014         (Incremental_inputs::report_input_section): New function.
4015         (Incremental_inputs::report_script): Rewrite.
4016         (Incremental_inputs::finalize): Do nothing but finalize string table.
4017         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4018         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4019         (Incremental_inputs::create_data_sections): New function.
4020         (Incremental_inputs::relocs_entsize): New function.
4021         (Output_section_incremental_inputs::set_final_data_size): New function.
4022         (Output_section_incremental_inputs::do_write): New function.
4023         (Output_section_incremental_inputs::write_header): New function.
4024         (Output_section_incremental_inputs::write_input_files): New function.
4025         (Output_section_incremental_inputs::write_info_blocks): New function.
4026         (Output_section_incremental_inputs::write_symtab): New function.
4027         * incremental.h (Incremental_script_entry): Forward declaration.
4028         (Incremental_object_entry): Forward declaration.
4029         (Incremental_archive_entry): Forward declaration.
4030         (Incremental_inputs): Forward declaration.
4031         (Incremental_inputs_header_data): Remove.
4032         (Incremental_inputs_header): Remove.
4033         (Incremental_inputs_header_write): Remove.
4034         (Incremental_inputs_entry_data): Remove.
4035         (Incremental_inputs_entry): Remove.
4036         (Incremental_inputs_entry_write): Remove.
4037         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4038         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4039         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4040         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4041         Likewise.
4042         (Incremental_input_entry): New class.
4043         (Incremental_script_entry): New class.
4044         (Incremental_object_entry): New class.
4045         (Incremental_archive_entry): New class.
4046         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4047         (Incremental_inputs::report_inputs): Remove.
4048         (Incremental_inputs::report_archive): Remove.
4049         (Incremental_inputs::report_archive_begin): New function.
4050         (Incremental_inputs::report_archive_end): New function.
4051         (Incremental_inputs::report_object): Change prototype.
4052         (Incremental_inputs::report_input_section): New function.
4053         (Incremental_inputs::report_script): Change prototype.
4054         (Incremental_inputs::get_reloc_count): New function.
4055         (Incremental_inputs::set_reloc_count): New function.
4056         (Incremental_inputs::create_data_sections): New function.
4057         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4058         (Incremental_inputs::inputs_section): New function.
4059         (Incremental_inputs::symtab_section): New function.
4060         (Incremental_inputs::relocs_section): New function.
4061         (Incremental_inputs::get_stringpool): Add const.
4062         (Incremental_inputs::command_line): Add const.
4063         (Incremental_inputs::inputs): Remove.
4064         (Incremental_inputs::command_line_key): New function.
4065         (Incremental_inputs::input_file_count): New function.
4066         (Incremental_inputs::input_files): New function.
4067         (Incremental_inputs::relocs_entsize): New function.
4068         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4069         (Incremental_inputs::finalize_inputs): Remove.
4070         (Incremental_inputs::Input_info): Remove.
4071         (Incremental_inputs::lock_): Remove.
4072         (Incremental_inputs::inputs_): Change type.
4073         (Incremental_inputs::inputs_map_): Remove.
4074         (Incremental_inputs::current_object_entry_): New data member.
4075         (Incremental_inputs::inputs_section_): New data member.
4076         (Incremental_inputs::symtab_section_): New data member.
4077         (Incremental_inputs::relocs_section_): New data member.
4078         (Incremental_inputs::reloc_count_): New data member.
4079         (Incremental_inputs_reader): New class.
4080         (Incremental_symtab_reader): New class.
4081         (Incremental_relocs_reader): New class.
4082         * layout.cc (Layout::finalize): Move finalization of incremental info
4083         and creation of incremental info sections to follow finalization of
4084         symbol table.  Set offsets for postprocessing sections.
4085         (Layout::create_incremental_info_sections): Call
4086         Incremental_inputs::create_data_sections.  Add incremental symtab
4087         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4088         sections to layout after input sections.
4089         * layout.h (struct Timespec): Forward declaration.
4090         (Layout::incremental_inputs): Add const.
4091         (Layout::create_incremental_info_sections): Add parameter.
4092         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4093         * object.cc: Include incremental.h.
4094         (Relobj::finalize_incremental_relocs): New function.
4095         (Sized_relobj::do_layout): Record input sections in incremental info.
4096         * object.h (Object::output_section): New function.
4097         (Object::output_section_offset): Moved from Relobj.
4098         (Object::get_incremental_reloc_base): New function.
4099         (Object::get_incremental_reloc_count): New function.
4100         (Object::do_output_section): New function.
4101         (Object::do_output_section_offset): Moved from Relobj.
4102         (Object::do_get_incremental_reloc_base): New function.
4103         (Object::do_get_incremental_reloc_count): New function.
4104         (Object::Object): Initialize new data members.
4105         (Relobj::output_section): Renamed do_output_section and moved to
4106         protected.
4107         (Relobj::output_section_offset): Moved to Object.
4108         (Relobj::do_get_incremental_reloc_base): New function.
4109         (Relobj::do_get_incremental_reloc_count): New function.
4110         (Relobj::allocate_incremental_reloc_counts): New function.
4111         (Relobj::count_incremental_reloc): New function.
4112         (Relobj::finalize_incremental_relocs): New function.
4113         (Relobj::next_incremental_reloc_index): New function.
4114         (Relobj::reloc_counts_): New data member.
4115         (Relobj::reloc_bases_): New data member.
4116         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4117         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4118         (Sized_relobj::incremental_relocs_scan): New function.
4119         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4120         (Sized_relobj::incremental_relocs_write): New function.
4121         (Sized_relobj::incremental_relocs_write_reltype): New function.
4122         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4123         incremental link.
4124         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4125         archives and object files elsewhere.
4126         (Add_symbols::run): Report object files here.
4127         (Finish_group::run): Report end of archive at end of group.
4128         * reloc.cc: Include layout.h, incremental.h.
4129         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4130         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4131         (Sized_relobj::incremental_relocs_scan): New function.
4132         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4133         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4134         (Sized_relobj::incremental_relocs_write): New function.
4135         (Sized_relobj::incremental_relocs_write_reltype): New function.
4136         * script.cc (read_input_script): Rewrite test for incremental link.
4137         Change call to Incremental_inputs::report_script.
4138         * symtab.h (Symbol_table::first_global_index): New function.
4139         (Symbol_table::output_count): New function.
4140
4141 2010-08-12  Doug Kwan  <dougkwan@google.com>
4142
4143         * arm.cc (Target_arm::merge_object_attributes): Check command line
4144         options --no-wchar-size-warning and --no-enum-size-warning.
4145         * options.h (General_options): Add ld-compatible options
4146         --no-enum-size-warning and --no-wchar-size-warning.
4147
4148 2010-08-04  Ian Lance Taylor  <iant@google.com>
4149
4150         * x86_64.cc (Target_x86_64::Scan::local): Use
4151         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4152         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4153         (Target_x86_64::Scan::global): Likewise.
4154         (Target_x86_64::Relocate::relocate): Likewise.
4155         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4156         Likewise.
4157
4158 2010-08-03  Cary Coutant  <ccoutant@google.com>
4159
4160         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4161         to reserve space in merged_strings vector. Keep total input size
4162         for stats.
4163         (Output_merge_string::do_print_merge_stats): Print total input size.
4164         * merge.h (Output_merge_string): Add input_size_ field.
4165         * stringpool.cc (Stringpool_template::string_length): Move
4166         implementations out of Stringpool_template class and place in
4167         stringpool.h.
4168         * stringpool.h (string_length): Move out of Stringpool_template.
4169
4170 2010-08-03  Ian Lance Taylor  <iant@google.com>
4171
4172         PR 11712
4173         * layout.cc (relaxation_loop_body): If address of load segment is
4174         set, adjust address to include headers if possible.
4175
4176 2010-08-03  Ian Lance Taylor  <iant@google.com>
4177
4178         * version.cc (version_string): Bump to 1.10.
4179
4180 2010-08-03  Ian Lance Taylor  <iant@google.com>
4181
4182         PR 11805
4183         * layout.h (enum Output_section_order): Define.
4184         (class Layout): Update declarations.
4185         * layout.cc (Layout::get_output_section): Add order parameter.
4186         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4187         is_first_non_relro parameters.  Change all callers.
4188         (Layout::choose_output_section): Likewise.
4189         (Layout::add_output_section_data): Likewise.
4190         (Layout::make_output_section): Likewise.  Set order.
4191         (Layout::default_section_order): New function.
4192         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4193         * output.cc (Output_section::Output_section): Initialize order_.
4194         Don't initialize deleted fields.
4195         (Output_segment::Output_segment): Don't initialize deleted
4196         fields.
4197         (Output_segment::add_output_section_to_load): New function
4198         replacing add_output_section.  Change all callers to call this or
4199         add_output_section_to_nonload.
4200         (Output_segment::add_output_section_to_nonload): New function.
4201         (Output_segment::remove_output_section): Rewrite.
4202         (Output_segment::add_initial_output_data): Likewise.
4203         (Output_segment::has_any_data_sections): Likewise.
4204         (Output_segment::is_first_section_relro): Likewise.
4205         (Output_segment::maximum_alignment): Likewise.
4206         (Output_segment::has_dynamic_reloc): New function replacing
4207         dynamic_reloc_count.  Change all callers.
4208         (Output_segment::has_dynamic_reloc_list): New function replacing
4209         dynamic_reloc_count_list.  Change all callers.
4210         (Output_segment::set_section_addresses): Rewrite.
4211         (Output_segment::set_offset): Rewrite.
4212         (Output_segment::find_first_and_last_list): Remove.
4213         (Output_segment::set_tls_offsets): Rewrite.
4214         (Output_segment::first_section_load_address): Likewise.
4215         (Output_segment::output_section_count): Likewise.
4216         (Output_segment::section_with_lowest_load_address): Likewise.
4217         (Output_segment::write_section_headers): Likewise.
4218         (Output_segment::print_sections_to_map): Likewise.
4219         * output.h (class Output_data): Remove dynamic_reloc_count_
4220         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4221         (Output_data::add_dynamic_reloc): Rewrite.
4222         (Output_data::has_dynamic_reloc): New function.
4223         (Output_data::dynamic_reloc_count): Remove.
4224         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4225         is_last_relro_, is_first_non_relro_, is_interp_,
4226         is_dynamic_linker_section_ fields.  Add order and set_order
4227         functions.  Remove is_relro_local, set_is_relro_local,
4228         is_last_relro, set_is_last_relro, is_first_non_relro,
4229         set_is_first_non_relro functions, is_interp, set_is_interp,
4230         is_dynamic_linker_section, and set_is_dynamic_linker_section
4231         functions.
4232         (class Output_segment): Change Output_data_list from std::list to
4233         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4234         output_bss_ fields.  Update declarations.
4235
4236 2010-08-02  Ian Lance Taylor  <iant@google.com>
4237
4238         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4239         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4240         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4241
4242 2010-08-02  Ian Lance Taylor  <iant@google.com>
4243
4244         PR 11855
4245         * script.cc (Script_options::Script_options): Initialize
4246         symbol_definitions_ and symbol_references_.
4247         (Script_options::add_symbol_assignment): Update
4248         symbol_definitions_ and symbol_references_.
4249         (Script_options::add_symbol_reference): New function.
4250         (script_symbol): New function.
4251         * script.h (class Script_options): Add symbol_definitions_ and
4252         symbol_references_ fields.
4253         (Script_options::referenced_const_iterator): New type.
4254         (Script_options::referenced_begin): New function.
4255         (Script_options::referenced_end): New function.
4256         (Script_options::is_referenced): New function.
4257         (Script_options::any_unreferenced): New function.
4258         * script-c.h (script_symbol): Declare.
4259         * yyscript.y (exp): Call script_symbol.
4260         * symtab.cc: Include "script.h".
4261         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4262         Change all callers.  Check symbols referenced by scripts.
4263         (Symbol_table::add_undefined_symbols_from_command_line): Add
4264         layout parameter.  Change all callers.
4265         (Symbol_table::do_add_undefined_symbols_from_command_line):
4266         Likewise.  Break out loop body.  Check symbols referenced by
4267         scripts.
4268         (Symbol_table::add_undefined_symbol_from_command_line): New
4269         function broken out of
4270         do_add_undefined_symbols_from_command_line.
4271         * symtab.h (class Symbol_table): Update declarations.
4272         * archive.cc: Include "layout.h".
4273         (Archive::should_include_member): Add layout parameter.  Change
4274         all callers.  Check for symbol mentioned in expression.
4275         * archive.h (class Archive): Update declaration.
4276         * object.cc (Sized_relobj::do_should_include_member): Add layout
4277         parameter.
4278         * object.h (Object::should_include_member): Add layout parameter.
4279         Change all callers.
4280         (Object::do_should_include_member): Add layout parameter.
4281         (class Sized_relobj): Update declaration.
4282         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4283         parameter.
4284         * dynobj.h (class Sized_dynobj): Update declaration.
4285         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4286         layout parameter.
4287         * plugin.h (class Sized_pluginobj): Update declaration.
4288
4289 2010-08-02  Ian Lance Taylor  <iant@google.com>
4290
4291         PR 11866
4292         * output.cc (Output_segment::set_offset): Search for the first and
4293         last sections rather than assuming that the list is in order.
4294         (Output_segment::find_first_and_last_list): New function.
4295         * output.h (class Output_segment): Update declarations.
4296         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4297         (relro_strip_test_SOURCES): New variable.
4298         (relro_strip_test_DEPENDENCIES): New variable.
4299         (relro_strip_test_LDFLAGS): New variable.
4300         (relro_strip_test_LDADD): New variable.
4301         (relro_strip_test.so): New target.
4302
4303 2010-08-02  Ian Lance Taylor  <iant@google.com>
4304
4305         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4306         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4307         (Target_i386::got_tlsdesc_section): New function.
4308         (Target_i386::got_section): Create space for GOT entries for
4309         TLSDESC relocations.
4310         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4311         R_386_TLS_GOTDESC.
4312         (Target_i386::Scan::global): Likewise.
4313         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4314         using TLSDESC GOT.
4315         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4316         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4317         (Target_x86_64::got_tlsdesc_section): New function.
4318         (Target_x86_64::got_section): Create space for GOT entries for
4319         TLSDESC relocations.
4320         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4321         R_386_TLS_GOTDESC.
4322         (Target_x86_64::Scan::global): Likewise.
4323         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4324         using TLSDESC GOT.
4325
4326 2010-08-02  Ian Lance Taylor  <iant@google.com>
4327
4328         * testsuite/final_layout.sh: Use dc to convert from hex to
4329         decimal.
4330
4331 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4332
4333         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4334         paramter to the call to gold::gc_process_relocs.
4335         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4336         paramter to the call to gold::gc_process_relocs.
4337         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4338         parameter to the call to gold::gc_process_relocs.
4339         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4340         template parameter to the call to gold::gc_process_relocs.
4341         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4342         paramter to the call to gold::gc_process_relocs.
4343         * gc.h (get_embedded_addend_size): New function.
4344         (gc_process_relocs): Save the size of the reloc for use by ICF.
4345         * icf.cc (get_section_contents): Get the addend from the text section
4346         for SHT_REL relocation sections.
4347         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4348         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4349         * int_encoding.h (read_from_pointer): New overloaded function.
4350         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4351         * testsuite/icf_sht_rel_addend_test.sh: New file.
4352         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4353         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4354
4355 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4356
4357         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4358         * Makefile.in: Regenerate.
4359         * testsuite/Makefile.in: Regenerate.
4360
4361 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4362
4363         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4364         * gold/testsuite/debug_msg.cc: Likewise.
4365         * gold/testsuite/odr_violation1.cc
4366         * gold/testsuite/odr_violation2.cc
4367
4368 2010-07-21  Cary Coutant  <ccoutant@google.com>
4369
4370         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4371         string, and length fields.
4372         (Output_merge_string::Merged_strings_list): New type.
4373         (Output_merge_string::Merged_strings_lists): New typedef.
4374         (Output_merge_string): Replace merged_strings_ with
4375         merged_strings_lists_.
4376         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4377         Merged_strings_list per input object and section.  Don't store pointer
4378         to the string.  Don't store length with each merged string entry.
4379         (Output_merge_string::finalize_merged_data): Loop over list of merged
4380         strings lists.  Recompute length of each merged string.
4381
4382 2010-07-15  Cary Coutant  <ccoutant@google.com>
4383
4384         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4385         here.
4386
4387 2010-07-14  Ian Lance Taylor  <iant@google.com>
4388
4389         * descriptors.cc (Descriptors::open): Report correct name in error
4390         message.
4391
4392 2010-07-13  Doug Kwan  <dougkwan@google.com>
4393
4394         * arm.cc (Arm_input_section::Arm_input_section): For a
4395         SHT_ARM_EXIDX section, always keeps the input sections.
4396         (Arm_input_section::set_exidx_section_link): New method.
4397         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4398         has_errors_ to false.
4399         (Arm_exidx_input_section::has_errors,
4400         Arm_exidx_input_section::set_has_errors): New methods.
4401         (Arm_exidx_input_section::has_errors_): New data member.
4402         (Arm_relobj::get_exidx_shndx_list): New method.
4403         (Arm_output_section::append_text_sections_to_list): Do not skip
4404         section without SHF_EXECINSTR.
4405         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4406         errors.
4407         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4408         section header.  Make error messages more verbose.  Check for
4409         a non-executable section linked to an EXIDX section.
4410         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4411         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4412         check that there is no deferred EXIDX section if we exit early.
4413         Instead of not making an EXIDX section in case of an error, make one
4414         and set the has_errors flag of it.
4415         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4416         in a relocatable link.
4417         (Target_arm::do_relax): Look for the EXIDX output section instead of
4418         assuming that it is called .ARM.exidx.
4419         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4420         section list.  Do not check for SHF_EXECINSTR section flags but
4421         skip any input section with errors.
4422         * output.cc (Output_section::Output_section): Initialize
4423         always_keeps_input_sections_ to false.
4424         (Output_section::add_input_section): Check for
4425         always_keeps_input_sections_.
4426         *  output.h (Output_section::always_keeps_input_sections,
4427         Output_section::set_always_keeps_input_sections): New methods.
4428         (Output_section::always_keeps_input_sections): New data member.
4429
4430 2010-07-13  Rafael Espindola  <espindola@google.com>
4431
4432         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4433         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4434
4435 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4436             Ian Lance Taylor  <iant@google.com>
4437
4438         * output.h (Output_section_lookup_maps::add_merge_section):
4439         Correct check of whether value was inserted.
4440         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4441         (Output_section_lookup_maps::add_relaxed_input_section):
4442         Likewise.
4443         * arm.cc (Target_arm::got_section): Remove used local os.
4444         * i386.cc (Target_i386::got_section): Likewise.
4445         * x86_64.cc (Target_x86_64::got_section): Likewise.
4446         * sparc.cc (Target_sparc::got_section): Likewise.
4447         (Target_sparc::relocate): Remove unused local have_got_offset.
4448         * powerpc.cc (Target_powerpc::relocate): Likewise.
4449
4450 2010-07-13  Ian Lance Taylor  <iant@google.com>
4451
4452         * compressed_output.cc (zlib_decompress): Fix signature in
4453         !HAVE_ZLIB_H case.
4454
4455         * archive.cc (Archive::include_member): Unlock an external member
4456         of a thin archive.  Don't bother to delete an object we know is
4457         NULL.
4458
4459 2010-07-12  Cary Coutant  <ccoutant@google.com>
4460
4461         * compressed_output.cc (zlib_decompress): New function.
4462         (get_uncompressed_size): New function.
4463         (decompress_input_section): New function.
4464         * compressed_output.h (get_uncompressed_size): New function.
4465         (decompress_input_section): New function.
4466         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4467         Handle compressed debug sections.
4468         * layout.cc (is_compressed_debug_section): New function.
4469         (Layout::output_section_name): Map compressed section names to
4470         canonical names.
4471         * layout.h (is_compressed_debug_section): New function.
4472         (is_debug_info_section): Recognize compressed debug sections.
4473         * merge.cc: Include compressed_output.h.
4474         (Output_merge_data::do_add_input_section): Handle compressed
4475         debug sections.
4476         (Output_merge_string::do_add_input_section): Handle compressed
4477         debug sections.
4478         * object.cc: Include compressed_output.h.
4479         (Sized_relobj::Sized_relobj): Initialize new data members.
4480         (build_compressed_section_map): New function.
4481         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4482         * object.h (Object::section_is_compressed): New method.
4483         (Object::do_section_is_compressed): New method.
4484         (Sized_relobj::Compressed_section_map): New type.
4485         (Sized_relobj::do_section_is_compressed): New method.
4486         (Sized_relobj::compressed_sections_): New data member.
4487         * output.cc (Output_section::add_input_section): Handle compressed
4488         debug sections.
4489         * reloc.cc: Include compressed_output.h.
4490         (Sized_relobj::write_sections): Handle compressed debug sections.
4491
4492 2010-07-08  Cary Coutant  <ccoutant@google.com>
4493
4494         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4495         weak when resolving to a dynamic def.
4496         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4497         for weak undef/dynamic def cases. Adjust callers.
4498         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4499         undef_binding_weak_.
4500         (Symbol_table::sized_write_globals): Adjust symbol binding.
4501         (Symbol_table::sized_write_symbol): Add binding parameter.
4502         * symtab.h (Symbol::set_undef_binding): New method.
4503         (Symbol::is_undef_binding_weak): New method.
4504         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4505         (Symbol_table::should_override): Add new parameter.
4506         (Symbol_table::sized_write_symbol): Add new parameter.
4507
4508         * testsuite/weak_undef_file1.cc: Add new test case.
4509         * testsuite/weak_undef_file2.cc: Fix header comment.
4510         * testsuite/weak_undef_test.cc: Add new test case.
4511
4512 2010-06-29  Doug Kwan  <dougkwan@google.com>
4513
4514         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4515         Initialize USE_SYMBOL_.
4516         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4517         definition.
4518         (Arm_reloc_property::uses_symbol_): New data member declaration.
4519         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4520         uses symbol value and symbol is undefined but not weakly undefined.
4521
4522 2010-06-28  Rafael Espindola  <espindola@google.com>
4523
4524         * plugin.cc (Plugin::load): Use dlerror.
4525
4526 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4527
4528         * symtab.cc (detect_odr_violations): When reporting an ODR
4529         violation, report an object where the symbol is defined.
4530
4531 2010-06-25  Doug Kwan  <dougkwan@google.com>
4532
4533         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4534         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4535         definition.
4536         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4537         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4538         target hook to detect function points.
4539         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4540         * icf.h (Icf::check_section_for_function_pointers): Change type of
4541         parameter SECTION_NAME to const reference to std::string.  Use
4542         target hook to determine if section may have unsafe pointers.
4543         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4544         method definition.
4545
4546 2010-06-21  Rafael Espindola  <espindola@google.com>
4547
4548         * fileread.cc (Input_file::find_fie): New
4549         (Input_file::open): Use Input_file::find_fie.
4550         * fileread.h (Input_file::find_fie): New
4551         * plugin.cc (set_extra_library_path): New.
4552         (Plugin::load): Add set_extra_library_path to the transfer vector.
4553         (Plugin_manager::set_extra_library_path): New.
4554         (Plugin_manager::add_input_file): Use the extra search path if set.
4555         (set_extra_library_path(): New.
4556         * plugin.h (Plugin_manager): Add set_extra_library_path and
4557         extra_search_path_.
4558
4559 2010-06-19  Cary Coutant  <ccoutant@google.com>
4560
4561         * layout.cc (gdb_sections): Add .debug_types.
4562         (lines_only_debug_sections): Likewise.
4563
4564 2010-06-18  Rafael Espindola  <espindola@google.com>
4565
4566         * plugin.cc (add_input_file,add_input_library)
4567         (Plugin_manager::add_input_file): Make filename arguments const.
4568         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4569         const.
4570
4571 2010-06-16  Doug Kwan  <dougkwan@google.com>
4572
4573         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4574         .ARM.attributes section if we have not merged any input
4575         attributes sections.
4576
4577 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4578
4579         * arm.cc: Allow combining objects with no EABI version
4580         information.
4581
4582 2010-06-15  Rafael Espindola  <espindola@google.com>
4583
4584         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4585
4586 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4587
4588         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4589         (struct iovec): Correct !HAVE_READV definition.
4590
4591 2010-06-10  Cary Coutant  <ccoutant@google.com>
4592
4593         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4594         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4595         reloc sections.
4596         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4597
4598         PR 11683
4599         * symtab.h (Symbol::is_placeholder): New member function.
4600         * target-reloc.h (relocate_section): Check for placeholder symbols.
4601
4602         * testsuite/Makefile.am (plugin_test_8): New test.
4603         (plugin_test_9): New test.
4604         * testsuite/Makefile.in: Regenerate.
4605
4606 2010-06-09  Nick Clifton  <nickc@redhat.com>
4607
4608         * yyscript.y (input_list_element): Allow strings prefixed with
4609         the '-' character.  Treat these as libraries.
4610         * script.cc (script_add_library): New function.  Adds a library
4611         specified by "-l<name>" found in an input script.
4612         * script-c.h: Add prototype for script_add_library.
4613
4614 2010-06-07  Doug Kwan  <dougkwan@google.com>
4615
4616         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4617         Restrict stub-group size to be within long conditional branch
4618         range when working around cortex-A8 erratum.
4619
4620 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4621
4622         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4623         #ifdef typo.
4624
4625 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4626
4627         PR gold/11658
4628         * output.cc
4629         (Output_section::Input_section_sort_entry::compare_section_ordering):
4630         Change to return non-zero correctly.
4631         (Output_section::Input_section_sort_section_order_index_compare
4632         ::operator()): Change to fix ambiguity in comparisons.
4633
4634 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4635
4636         * gold.h (is_wildcard_string): New function.
4637         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4638         (Layout::layout_eh_frame): Ditto.
4639         (Layout::find_section_order_index): New method.
4640         (Layout::read_layout_from_file): New method.
4641         * layout.h (Layout::find_section_order_index): New method.
4642         (Layout::read_layout_from_file): New method.
4643         (Layout::input_section_position_): New private member.
4644         (Layout::input_section_glob_): New private member.
4645         * main.cc (main): Call read_layout_from_file here.
4646         * options.h (--section-ordering-file): New option.
4647         * output.cc (Output_section::input_section_order_specified_): New
4648         member.
4649         (Output_section::Output_section): Initialize new member.
4650         (Output_section::add_input_section): Add new parameter.
4651         Keep input sections when --section-ordering-file is used.
4652         (Output_section::set_final_data_size): Sort input sections when
4653         section ordering file is specified.
4654         (Output_section::Input_section_sort_entry): Add new parameter.
4655         Check sorting type.
4656         (Output_section::Input_section_sort_entry::compare_section_ordering):
4657         New method.
4658         (Output_section::Input_section_sort_compare::operator()): Change to
4659         consider section_order_index.
4660         (Output_section::Input_section_sort_init_fini_compare::operator()):
4661         Change to consider section_order_index.
4662         (Output_section::Input_section_sort_section_order_index_compare
4663         ::operator()): New method.
4664         (Output_section::sort_attached_input_sections): Change to sort
4665         according to section order when specified.
4666         (Output_section::add_input_section<32, true>): Add new parameter.
4667         (Output_section::add_input_section<64, true>): Add new parameter.
4668         (Output_section::add_input_section<32, false>): Add new parameter.
4669         (Output_section::add_input_section<64, false>): Add new parameter.
4670         * output.h (Output_section::add_input_section): Add new parameter.
4671         (Output_section::input_section_order_specified): New
4672         method.
4673         (Output_section::set_input_section_order_specified): New method.
4674         (Input_section::Input_section): Initialize section_order_index_.
4675         (Input_section::section_order_index): New method.
4676         (Input_section::set_section_order_index): New method.
4677         (Input_section::section_order_index_): New member.
4678         (Input_section::Input_section_sort_section_order_index_compare): New
4679         struct.
4680         (Output_section::input_section_order_specified_): New member.
4681         * script-sections.cc (is_wildcard_string): Delete and move modified
4682         method to gold.h.
4683         (Output_section_element_input::Output_section_element_input): Modify
4684         call to is_wildcard_string.
4685         (Output_section_element_input::Input_section_pattern
4686         ::Input_section_pattern): Ditto.
4687         (Output_section_element_input::Output_section_element_input): Ditto.
4688         * testsuite/Makefile.am (final_layout): New test case.
4689         * testsuite/Makefile.in: Regenerate.
4690         * testsuite/final_layout.cc: New file.
4691         * testsuite/final_layout.sh: New file.
4692
4693 2010-06-01  Rafael Espindola  <espindola@google.com>
4694
4695         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4696
4697 2010-06-01  Rafael Espindola  <espindola@google.com>
4698
4699         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4700         visibility of symbols.
4701
4702 2010-05-27  Doug Kwan  <dougkwan@google.com>
4703
4704         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4705         from start of output section instead of address for a local symbol
4706         in a merged or relaxed section when doing a relocatable link.
4707
4708 2010-05-26  Rafael Espindola  <espindola@google.com>
4709
4710        PR 11604
4711         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4712         adding sections the garbage collector removed.
4713         * gold/testsuite/Makefile.am: Add test.
4714         * gold/testsuite/Makefile.in: Regenerate.
4715         * gold/testsuite/plugin_test_7.sh: New.
4716         * gold/testsuite/plugin_test_7_1.c: New.
4717         * gold/testsuite/plugin_test_7_2.c: New.
4718
4719 2010-05-26  Rafael Espindola  <espindola@google.com>
4720
4721         * script-sections.cc (Output_section_definition::set_section_addresses):
4722         Check for --section-start.
4723
4724 2010-05-26  Doug Kwan  <dougkwan@google.com>
4725
4726         * arm.cc (Arm_scan_relocatable_relocs): New class.
4727         (Target_arm::relocate_special_relocatable): New method.
4728         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4729         (Arm_relocate_functions::thumb_branch_common): Same.
4730         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4731         instead of Default_scan_relocatable_relocs.
4732         * target-reloc.h (relocate_for_relocatable): Let target handle
4733         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4734         * target.h (Sized_target::relocate_special_relocatable): New method.
4735
4736 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4737
4738         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4739
4740 2010-05-23  Doug Kwan  <dougkwan@google.com>
4741
4742         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4743         instead of a cast.
4744         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4745         with a direct branch, not a conditional branch, to a stub.
4746         * merge.cc (Output_merge_base::record_input_section): New method
4747         defintion.
4748         (Output_merge_data::do_add_input_section): Record input section if
4749         keeps-input-sections flag is set.
4750         (Output_merge_string::do_add_input_section): Ditto.
4751         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4752         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4753         INPUT_SECTIONS_.
4754         (Output_merge_base::keeps_input_sections,
4755         Output_merge_base::set_keeps_input_sections,
4756         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4757         method definitions.
4758         (Output_merge_base::Input_sections): New type declaration.
4759         (Output_merge_base::input_sections_begin,
4760         Output_merge_base::input_sections_end,
4761         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4762         (Output_merge_base::bool keeps_input_sections_,
4763         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4764         Output_merge_base::input_sections_): New data members.
4765         (Output_merge_data::do_set_keeps_input_sections): New method
4766         defintion.
4767         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4768         * output.cc (Output_section::Input_section::relobj): Move method
4769         defintion from class declaration to here and handle merge sections.
4770         (Output_section::Input_section::shndx): Ditto.
4771         (Output_section::Output_section): Remove initializations of removed
4772         data members and initialize new data member LOOKUP_MAPS_.
4773         (Output_section::add_input_section): Set keeps-input-sections flag
4774         for a newly created merge output section as appropriate.  Adjust code
4775         to use Output_section_lookup_maps class.
4776         (Output_section::add_relaxed_input_section): Adjst code for lookup
4777         maps code refactoring.
4778         (Output_section::add_merge_input_section): Add a new parameter
4779         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4780         class.  If adding input section to a newly created merge output
4781         section fails, remove the new merge section.
4782         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4783         Adjust code for use of the Output_section_lookup_maps class.
4784         (Output_section::find_merge_section): Ditto.
4785         (Output_section::build_lookup_maps): New method defintion.
4786         (Output_section::find_relaxed_input_section): Adjust code to use
4787         Output_section_lookup_maps class.
4788         (Output_section::get_input_sections): Export merge sections.  Adjust
4789         code to use Output_section_lookup_maps class.
4790         (Output_section:::add_script_input_section): Adjust code to use
4791         Output_section_lookup_maps class.  Update lookup maps for merge
4792         sections also.
4793         (Output_section::discard_states): Use Output_section_lookup_maps.
4794         (Output_section::restore_states): Same.
4795         * output.h (Merge_section_properties): Move class defintion out of
4796         Output_section.
4797         (Output_section_lookup_maps): New class.
4798         (Output_section::Input_section::is_merge_section): New method
4799         defintion.
4800         (Output_section::Input_section::relobj): Move defintion out of class
4801         defintion.  Declare method only.
4802         (Output_section::Input_section::shndx): Ditto.
4803         (Output_section::Input_section::output_merge_base): New method defintion.
4804         (Output_section::Input_section::u2_.pomb): New union field.
4805         (Output_section::Merge_section_by_properties_map,
4806         Output_section::Output_section_data_by_input_section_map,
4807         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4808         Remove types.
4809         (Output_section::add_merge_input_section): Add new parameter
4810         KEEPS_INPUT_SECTIONS.
4811         (Output_section::build_lookup_maps): New method declaration.
4812         (Output_section::merge_section_map_,
4813         Output_section::merge_section_by_properties_map_,
4814         Output_section::relaxed_input_section_map_,
4815         Output_section::is_relaxed_input_section_map_valid_): Remove data
4816         members.
4817         (Output_section::lookup_maps_): New data member.
4818
4819 2010-05-21  Doug Kwan  <dougkwan@google.com>
4820
4821         PR gold/11619
4822         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4823         avoid a compilation error.
4824
4825 2010-05-19  Rafael Espindola  <espindola@google.com>
4826
4827         * script-sections.cc (Output_section_definition::allocate_to_segment):
4828         Update the phdrs_list even when the output section is NULL.
4829         * testsuite/Makefile.am: Add test.
4830         * testsuite/Makefile.in: Regenerate.
4831         * testsuite/script_test_9.cc: New.
4832         * testsuite/script_test_9.sh: New.
4833         * testsuite/script_test_9.t: New.
4834
4835 2010-05-19  Doug Kwan  <dougkwan@google.com>
4836
4837         * arm.cc (Arm_input_section::original_size): New method.
4838         (Arm_input_section::do_addralign): Add a cast.
4839         (Arm_input_section::do_output_offset): Remove static cast.
4840         (Arm_input_section::original_addralign,
4841          Arm_input_section::original_size_): Change type to uint32_t.
4842         (Arm_input_section::init): Add safe casts for section alignment
4843         and size.
4844         (Arm_input_section::set_final_data_size): Do not set address and
4845         offset of stub table.
4846         (Arm_output_section::fix_exidx_coverage): Change use of of
4847         Output_section::Simple_input_section to that of
4848         Output_section::Input_section.
4849         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4850         except for the first pass.
4851         * output.cc (Output_section::get_input_sections): Change type of
4852         input_sections to std::list<Input_section>.
4853         (Output_section::add_script_input_section): Rename from
4854         Output_section::add_simple_input_section.  Change type of SIS
4855         parameter from Simple_input_section to Input_section.
4856         * output.h (Output_section::Simple_input_section): Remove class.
4857         (Output_section::Input_section): Change class visibility to public.
4858         (Output_section::Input_section::addralign): Use stored alignments
4859         for special input sections if set.
4860         (Output_section::Input_section::set_addralign): New method.
4861         (Output_section::get_input_sections): Change parameter type from
4862         list of Simple_input_section to list of Input_section.
4863         (Output_section::add_script_input_section): Rename from
4864         Output_section::add_simple_input_section. Change first parameter's
4865         type from Simple_input_section to Input_section and remove the
4866         second and third parameters.
4867         * script-sections.cc (Input_section::Input_section_list): Change
4868         type to list of Output_section::Input_section/
4869         (Input_section_info::Input_section_info): Change parameter type of
4870         INPUT_SECTION to Output_section::Input_section.
4871         (Input_section_info::input_section): Change return type.
4872         (Input_section_info::input_section_): Change type to
4873         Output_section::Input_section.
4874         (Output_section_element_input::set_section_addresses): Adjust code
4875         to use Output_section::Input_section instead of
4876         Output_section::Simple_input_section.  Adjust code for renaming
4877         of Output_section::add_simple_input_section.
4878         (Orphan_output_section::set_section_addresses): Ditto.
4879
4880 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4881
4882         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4883         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4884
4885 2010-05-18  Rafael Espindola  <espindola@google.com>
4886
4887         * options.cc (General_options::finalize): Handle -nostdlib.
4888         * options.h (nostdlib): New option.
4889         * script.cc (script_add_search_dir): Handle -nostdlib.
4890
4891 2010-05-12  Doug Kwan  <dougkwan@google.com>
4892
4893         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4894         attributes section only if there no attributes section after merging.
4895         (Target_arm::merge_object_attributes): Move value of
4896         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4897         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4898         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4899         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4900         and arm_attr_merge_7.stdout.
4901         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4902         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4903         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4904         arm_attr_merge_7b.o): New rules.
4905         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4906         arm_attr_merge_7
4907         * testsuite/Makefile.in: Regenerate.
4908         * testsuite/arm_attr_merge.sh: New file.
4909         * testsuite/arm_attr_merge_[67][ab].s: Same.
4910
4911 2010-05-05  Nick Clifton  <nickc@redhat.com>
4912
4913         * po/es.po: Updated Spanish translation.
4914
4915 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4916
4917         * Makefile.am (install-exec-local): Properly install gold as
4918         default cross linker.
4919         * Makefile.in: Regenerated.
4920
4921 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4922             Nick Clifton  <nickc@redhat.com>
4923
4924         * configure.ac (install_as_default): Define and set to false
4925         unless --enable-gold or --enable-gold=both/gold has been
4926         specified.
4927         * configure: Regenerate.
4928
4929         * Makefile.am (install-exec-local): Install the executable as
4930         'ld.gold'.  If install_as_default is true then also install it as
4931         'ld'.
4932         * Makefile.in: Regenerated.
4933
4934 2010-04-24  Ian Lance Taylor  <iant@google.com>
4935
4936         * layout.cc (Layout::layout_reloc): In relocatable link don't
4937         combine reloc sections for grouped sections.
4938
4939 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4940
4941         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4942         sections that are not ordinary to icf.
4943         * icf.cc (get_section_contents): Handle relocation pointing to section
4944         with no object or shndx information.
4945         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4946         * testsuite/Makefile.in: Regenerate.
4947         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4948         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4949
4950 2010-04-22  Ian Lance Taylor  <iant@google.com>
4951
4952         * expression.cc (Expression::Expression_eval_info): Add
4953         result_alignment_pointer field.
4954         (Expression::eval_with_dot): Add result_alignment_pointer
4955         parameter.  Change all callers.
4956         (Expression::eval_maybe_dot): Likewise.
4957         (class Binary_expression): Add alignment_pointer parameter to
4958         left_value and right_value.  Change all callers.
4959         (BINARY_EXPRESSION): Set result alignment.
4960         (class Trinary_expression): Add alignment_pointer parameter to
4961         arg2_value and arg3_value.  Change all callers.
4962         (Trinary_cond::value): Set result alignment.
4963         (Max_expression::value, Min_expression::value): Likewise.
4964         (Align_expression::value): Likewise.
4965         * script-sections.cc (class Sections_element): Add dot_alignment
4966         parameter to set_section_addresses virtual function.  Update
4967         instantiations.
4968         (class Output_section_element): Likewise.
4969         (Script_sections::create_segments): Add dot_alignment parameter.
4970         Change all callers.
4971         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4972         (Script_sections::set_phdrs_clause_addresses): Likewise.
4973         * script-sections.h: Update declarations.
4974         * script.h: Update declarations.
4975         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4976         min_p_align.
4977         * testsuite/script_test_3.t: Set large alignment.
4978         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4979         segment has expected alignment.
4980
4981 2010-04-22  Nick Clifton  <nickc@redhat.com>
4982
4983         * po/gold.pot: Updated by the Translation project.
4984         * po/vi.po: Updated Vietnamese translation.
4985
4986 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4987
4988         * testsuite/Makefile.am (check_PROGRAMS): Add
4989         icf_virtual_function_folding_test.
4990         * testsuite/Makefile.in: Regenerated.
4991
4992 2010-04-15  Andrew Haley  <aph@redhat.com>
4993
4994         * options.h (merge_exidx_entries): New option.
4995         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4996         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4997         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4998         (Target_arm::merge_exidx_entries): New function.
4999         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5000         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5001         to Arm_exidx_fixup constructor.
5002         Add new arg, merge_exidx_entries.
5003         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5004         Arm_output_section::fix_exidx_coverage.
5005
5006 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5007
5008         * icf.cc (get_section_contents): Check for preemptible functions.
5009         Ignore addend when appropriate.
5010         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5011         section folded.
5012         (add_from_relobj): Check for section folded.
5013         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5014         * symtab.h (should_add_dynsym_entry): Add new parameter.
5015         * target-reloc.h (scan_relocs): Check for section folded.
5016         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5017         Check reloc types for function pointers in shared objects.
5018         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5019         case.
5020         (icf_preemptible_functions_test): New test case.
5021         (icf_string_merge_test): New test case.
5022         * testsuite.Makefile.in: Regenerate.
5023         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5024         bar_glob.  Refactor code.
5025         * testsuite/icf_preemptible_functions_test.cc: New file.
5026         * testsuite/icf_preemptible_functions_test.sh: New file.
5027         * testsuite/icf_string_merge_test.cc: New file.
5028         * testsuite/icf_string_merge_test.sh: New file.
5029         * testsuite/icf_virtual_function_folding_test.cc: New file.
5030         * testsuite/icf_virtual_function_folding_test.sh: New file.
5031
5032 2010-04-14  Doug Kwan  <dougkwan@google.com>
5033
5034         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5035         for local symbol recounting if we remove a section due to ICF.
5036         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5037         there are no regular objects in input.
5038
5039 2010-04-13  Doug Kwan  <dougkwan@google.com>
5040
5041         * arm.cc (Arm_input_section::set_final_data_size): Compute
5042         accurate final data size instead of using current data size.
5043
5044 2010-04-09  Doug Kwan  <dougkwan@google.com>
5045
5046         * layout.cc (Layout::choose_output_section): Handle script section
5047         types.
5048         (Layout::make_output_section_for_script): Add section type parameter.
5049         Handle script section types.
5050         * layout.h (Layout::make_output_section_for_script): Add section
5051         type parameter.
5052         * output.cc (Output_section::Output_section): Initialize data member
5053         is_noload_.
5054         (Output_section::do_reset_address_and_file_offset): Do not set address
5055         to 0 if section is a NOLOAD section.
5056         * output.h (Output_section::is_noload): New method.
5057         (Output_section::set_is_noload): Ditto.
5058         (Output_section::is_noload_): New data member.
5059         * script-c.h (Script_section_type): New enum type.
5060         (struct Parser_output_section_header): Add new file section_type.
5061         * script-sections.cc (Sections_element::output_section_name): Add
5062         parameter for returning script section type.
5063         (Output_section_definition::output_section_name): Ditto.
5064         (Output_section_definition::section_type)P; New method.
5065         (Output_section_definiton::script_section_type_name): Ditto.
5066         (Output_section_definition::script_section_type_): New data member.
5067         (Output_section_definition::Output_section_definition): Initialize
5068         data member Output_section_definition::script_section_type_.
5069         (Output_section_definition::create_sections): Pass script section type
5070         to Layout::make_output_section_for_script.
5071         (Output_section_definition::output_section_name): Return script
5072         section type to caller.
5073         (Output_section_definition::set_section_address): Do not advance
5074         dot value and load address if section type is NOLOAD.  Set address
5075         of NOLOAD sections regardless of section flags.
5076         (Output_section_definition::print): Print section type if it is
5077         not SCRIPT_SECTION_TYPE_NONE.
5078         (Output_section_definition::section_type): New method.
5079         (Output_section_definition::script_section_type_name): Ditto.
5080         (Script_sections::output_section_name): Add new parameter
5081         PSECTION_TYPE for returning script section type.  Pass it to
5082         section elements.  Handle discard sections.
5083         (Sort_output_sections::operator()): Handle NOLOAD sections.
5084         * script-sections.h (Script_sections::Section_type): New enum type.
5085         (Script_sections::output_section_name): Add a new parameter for
5086         returning script section type.
5087         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5088         INFO and NOLOAD.
5089         * yyscript.y (union): Add new field SECTION_TYPE.
5090         (COPY, DSECT, INFO, NOLOAD): New tokens.
5091         (opt_address_and_section_type): Change type to output_section_header.
5092         (section_type): New non-terminal
5093         (section_header): Handle section type.
5094         (opt_address_and_section_type): Return section type value.
5095
5096 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5097
5098         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5099         * testsuite/plugin_common_test_2.c (foo): Likewise.
5100
5101 2010-04-08  Doug Kwan  <dougkwan@google.com>
5102
5103         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5104         Output_merge_data.
5105         * output.cc (Output_section::add_merge_input_section): Simplify
5106         code and return status of Output_merge_base::add_input_section.
5107         Update merge section map only if Output_merge_base::add_input_section
5108         returns true.
5109
5110 2010-04-07  Doug Kwan  <dougkwan@google.com>
5111
5112         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5113         if section is marked as containing instructions but has no mapping
5114         symbols.
5115         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5116         correct section index.
5117         (Arm_relobj::find_linked_text_section): Ditto.
5118
5119 2010-04-07  Cary Coutant  <ccoutant@google.com>
5120
5121         * archive.cc (include_member): Destroy Read_symbols_data object before
5122         releasing file.
5123         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5124         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5125         (Read_symbols_data::~Read_symbols_data) New destructor.
5126         (Section_relocs::Section_relocs) New constructor.
5127         (Section_relocs::~Section_relocs) New destructor.
5128         (Read_relocs_data::Read_relocs_data) New constructor.
5129         (Read_relocs_data::~Read_relocs_data) New destructor.
5130         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5131         pointers to NULL after deleting.
5132
5133 2010-04-07  Doug Kwan  <dougkwan@google.com>
5134
5135         * arm.cc: Replace "endianity" with "endianness" in comments.
5136         (Arm_exidx_cantunwind): Ditto.
5137         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5138         (Arm_relobj::merge_flags_and_attributes): New method.
5139         (Arm_relobj::merge_flags_and_attributes_): New data member.
5140         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5141         (Arm_relobj::scan_sections_for_stubs): Ditto.
5142         (Arm_relobj::do_read_symbols): Check to see if we really want to
5143         merge processor-specific flags and attributes.  Exit early if
5144         an object is empty except for section names and the undefined symbol.
5145         (Target_arm::do_finalize_sections): Move check for ELF format to
5146         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5147         attributes from a regular object only when we have determined that
5148         it is aapropriate.  Do not create an .ARM.attributes section in
5149         output if there is no regular input object.
5150         (Target_arm::merge_processor_specific_flags): Check
5151         --warn-mismatch before printing any error.
5152         (Target_arm::merge_object_attributes): Ditto.
5153         * gold.cc (queue_middle_tasks): Handle the case in which there is
5154         no regular object in input.
5155         * options.cc (General_options::parse_EB): New method.
5156         (General_options::parse_EL): Same.
5157         (General_options::General_options): Initialize endianness_.
5158         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5159         New options.
5160         (General_options::Endianness): New enum.
5161         (General_options::endianness): New method.
5162         (General_options::endianness_): New data member.
5163         * parameters.cc (Parameters::set_options): Check target endianness.
5164         (Parameters::set_target_once): Ditto.
5165         (Parameters::check_target_endianness): New method.
5166         (parameters_force_valid_target): If either -EL or -EB is specified,
5167         use it to define endianness of default target.
5168         * parameters.h (Parameters::check_target_endianness): New method
5169         declaration.
5170         * target.h (class Target): Change "endianity" to "endianness"
5171         in comments.
5172
5173 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5174
5175         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5176         * configure: Regenerate.
5177         * Makefile.in: Regenerate.
5178         * testsuite/Makefile.in: Regenerate.
5179
5180 2010-04-06  Cary Coutant  <ccoutant@google.com>
5181
5182         gcc PR lto/42757
5183         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5184         prevailing definitions of common symbols.
5185         * testsuite/plugin_test_6.sh: New test case.
5186         * testsuite/plugin_common_test_1.c: New test case.
5187         * testsuite/plugin_common_test_2.c: New test case.
5188         * testsuite/Makefile.am (plugin_test_6): New test case.
5189         * testsuite/Makefile.in: Regenerate.
5190
5191 2010-04-06  Nick Clifton  <nickc@redhat.com>
5192
5193         * po/vi.po: New Vietnamese translation.
5194
5195 2010-03-30  Doug Kwan  <dougkwan@google.com>
5196
5197         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5198
5199 2010-03-25  Doug Kwan  <dougkwan@google.com>
5200
5201         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5202         to avoid a conversion warning on a 32-bit host.
5203
5204 2010-03-24  Ian Lance Taylor  <iant@google.com>
5205
5206         * testsuite/script_test_3.t: Add a TLS segment.
5207         * testsuite/Makefile.am (check_PROGRAMS): Add
5208         tls_phdrs_script_test.
5209         (tls_phdrs_script_test_SOURCES): Define.
5210         (tls_phdrs_script_test_DEPENDENCIES): Define.
5211         (tls_phdrs_script_test_LDFLAGS): Define.
5212         (tls_phdrs_script_test_LDADD): Define.
5213         * testsuite/Makefile.in: Rebuild.
5214
5215 2010-03-23  Cary Coutant  <ccoutant@google.com>
5216
5217         * fileread.cc (find_or_make_view): Fix comment.
5218
5219 2010-03-23  Ian Lance Taylor  <iant@google.com>
5220
5221         * script-sections.cc (class Orphan_section_placement): Define
5222         PLACE_TLS and PLACE_TLS_BSS.
5223         (Orphan_section_placement::Orphan_section_placement): Initialize
5224         new places.
5225         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5226         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5227         (tls_script_test_SOURCES): Define.
5228         (tls_script_test_DEPENDENCIES): Define.
5229         (tls_script_test_LDFLAGS): Define.
5230         (tls_script_test_LDADD): Define.
5231         * testsuite/Makefile.in: Rebuild.
5232
5233 2010-03-22  Doug Kwan  <dougkwan@google.com>
5234
5235         * arm.cc (Arm_relocate_functions::abs8,
5236         Arm_relocate_functions::abs16): Use correct check for overflow
5237         specified in the ARM ELF specs.
5238         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5239         target of a BLX instruction specially.
5240         (Reloc_stub::stub_type_for_reloc): Ditto.
5241         (Relocate::relocate): Use symbolic names instead of numeric relocation
5242         codes to report error.
5243         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5244         workaround.
5245         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5246         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5247         thumb2_blx_out_of_range.stdout
5248         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5249         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5250         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5251         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5252         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5253         thumb2_blx_in_range, thumb2_blx_in_range.o,
5254         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5255         thumb2_blx_out_of_range.o): New rules.
5256         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5257         thumb2_blx_in_range and thumb2_blx_out_of_range.
5258         * testsuite/Makefile.in: Regenerate.
5259         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5260         * testsuite/thumb_blx_in_range.s: New file.
5261         * testsuite/thumb_blx_out_of_range.s: New file.
5262
5263 2010-03-22  Rafael Espindola  <espindola@google.com>
5264
5265         * archive.cc (Should_include): Move to archive.h.
5266         (should_include_member): Make it a member of Archive.
5267         (Lib_group): New.
5268         (Add_lib_group_symbols): New.
5269         * archive.h: Include options.h.
5270         (Archive_member): Moved from Archive.
5271         (Should_include): Moved from archive.cc.
5272         (Lib_group): New.
5273         (Add_lib_group_symbols): New.
5274         * dynobj.cc (do_should_include_member): New.
5275         * dynobj.h (do_should_include_member): New.
5276         * gold.cc (queue_initial_tasks): Update call to queue.
5277         * main.cc (main): Print lib group stats.
5278         * object.cc (do_should_include_member): New.
5279         * object.h: Include archive.h.
5280         (Object::should_include_member): New.
5281         (Object::do_should_include_member): New.
5282         (Sized_relobj::do_should_include_member): New.
5283         * options.cc (General_options::parse_start_lib): New.
5284         (General_options::parse_end_lib): New.
5285         (Input_arguments::add_file): Handle lib groups.
5286         (Input_arguments::start_group): Check we are not in a lib.
5287         (Input_arguments::start_lib): New.
5288         (Input_arguments::end_lib): New.
5289         * options.h (General_options): Add start_lib and end_lib.
5290         (Input_argument::lib_): New.
5291         (Input_argument::lib): New.
5292         (Input_argument::is_lib): New.
5293         (Input_file_lib): New.
5294         (Input_arguments::in_lib_): New.
5295         (Input_arguments::in_lib): New.
5296         (Input_arguments::start_lib): New.
5297         (Input_arguments::end_lib_): New.
5298         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5299         in unused members as preempted.
5300         (Sized_pluginobj::do_should_include_member): New.
5301         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5302         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5303         return the blocker.
5304         (Read_symbols::do_whole_lib_group): New.
5305         (Read_symbols::do_lib_group): New.
5306         (Read_symbols::do_read_symbols): Handle lib groups.
5307         (Read_symbols::get_name): Handle lib groups.
5308         * readsyms.h (Read_symbols): Add an archive member pointer.
5309         (Read_symbols::do_whole_lib_group): New.
5310         (Read_symbols::do_lib_group): New.
5311         (Read_symbols::member_): New.
5312         * script.cc (read_input_script): Update call to queue_soon.
5313
5314 2010-03-19  Doug Kwan  <dougkwan@google.com>
5315
5316         * arm.cc (Stub_table::Stub_table): Initialize new data members
5317         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5318         (Stub_table::add_reloc_stub): Assign stub offset and update
5319         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5320         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5321         New data members.
5322         (Stub_table::update_data_size_and_addralign): Use
5323         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5324         instead of going over all reloc stubs.
5325         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5326         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5327         Stringpool_template::offset_ to size of Stringpool_char.
5328         (Stringpool_template::new_key_offset): Remove code to initialize
5329         Stringpool_template::offset_.
5330         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5331         Stringpool_template::offset_ to zero.
5332
5333 2010-03-15  Doug Kwan  <dougkwan@google.com>
5334
5335         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5336         offset_.
5337         (Stringpool_template::new_key_offset): New method.
5338         (Stringpool_template::add_string): Assign offsets when adding new
5339         strings.
5340         (Stringpool_template::set_string_offsets): Do not set string offsets
5341         when not optimizing.
5342         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5343         member size_.
5344         (Chunked_vector::clear): Clear size_.
5345         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5346         (Chunked_vector::size): Return size_.
5347         (Chunked_vector::push_back): Use size_ to find insert position.
5348         (Chunked_vector::size_): New data member.
5349         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5350         (Stringpool_template::new_key_offset): New method declaration.
5351         (Stringpool_template::offset_): New data member.
5352
5353 2010-03-15   Rafael Espindola  <espindola@google.com>
5354
5355         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5356         Add_symbols' constructor.
5357         * readsyms.h (Add_symbols): Remove the input_group member.
5358
5359 2010-03-10  Ian Lance Taylor  <iant@google.com>
5360
5361         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5362         target to ask whether a reference to a symbol requires a stack
5363         split.
5364         * target.h (Target::is_call_to_non_split): New function.
5365         (Target::do_is_call_to_non_split): Declare virtual function.
5366         * target.cc: Include "symtab.h".
5367         (Target::do_is_call_to_non_split): New function.
5368         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5369
5370 2010-03-10  Cary Coutant  <ccoutant@google.com>
5371
5372         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5373         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5374         (File_read::open[2]): Add whole_file_view_ to list of views.
5375         (File_read::make_view): Remove test of whole_file_view_.
5376         (File_read::find_or_make_view): Create whole_file_view_ if
5377         necessary.
5378         (File_read::clear_views): Replace bool parameter with enum;
5379         adjust all callers.  Don't delete views with permanent data;
5380         do delete cached views and views from archives if
5381         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5382         if clearing the corresponding view.
5383         * fileread.h (File_read::Clear_views_mode): New enum.
5384         (File_read::View::is_permanent_view): New method.
5385         (File_read::clear_views): Replace bool parameter
5386         with enum; adjust all callers.
5387         * options.h (General_options): Change keep_files_mapped option;
5388         add map_whole_files.
5389         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5390         releasing the file.
5391         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5392         the file.
5393
5394 2010-03-10  David S. Miller  <davem@davemloft.net>
5395
5396         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5397
5398 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5399
5400         * icf.cc (get_section_contents): Add '@' marker after processing the
5401         merge reloc.
5402
5403 2010-03-08  Doug Kwan  <dougkwan@google.com>
5404
5405         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5406         due to a conversion warning.
5407         (Arm_relobj::update_output_local_symbol_count): Check for local
5408         symbol with unset output index.
5409
5410 2010-03-05  Ian Lance Taylor  <iant@google.com>
5411
5412         * options.h (class General_options): Add --spare-dynamic-tags.
5413         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5414         --spare-dynamic-tags.
5415
5416 2010-03-05  Ian Lance Taylor  <iant@google.com>
5417
5418         * incremental.cc: Include "libiberty.h".
5419
5420 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5421
5422         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5423         function, is_info_ member.
5424         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5425         (Versions::Versions): Update caller.
5426         (Versions::define_base_version): Likewise.
5427         (Versions::add_def): Likewise.
5428
5429 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5430
5431         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5432         (Scan::possible_function_pointer_reloc): New function.
5433         (Scan::local_reloc_may_be_function_pointer): Change to call
5434         possible_function_pointer_reloc.
5435         (Scan::global_reloc_may_be_function_pointer): Ditto.
5436         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5437         relocations in ".data.rel.ro._ZTV" section.
5438         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5439         * testsuite/icf_safe_so_test.cc: Ditto.
5440         * testsuite/icf_safe_test.cc: Ditto.
5441         * testsuite/icf_safe_test.sh: Ditto.
5442
5443 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5444             Ian Lance Taylor  <iant@google.com>
5445
5446         * target-reloc.h (relocate_section): Check the symbol table index
5447         for -1U before setting the local symbol index.
5448         (scan_relocatable_relocs): If copying the relocation, record that
5449         the local symbol is required.
5450         * object.h (Symbol_value::is_output_symtab_index_set): New
5451         function.
5452         (Symbol_value::may_be_discarded_from_output_symtab): New
5453         function.
5454         (Symbol_value::has_output_symtab_entry): New function.
5455         (Symbol_value::needs_output_symtab_entry): Remove.
5456         (Symbol_value::output_symtab_index): Make sure the symbol index is
5457         set.
5458         (Symbol_value::set_output_symtab_index): Make sure the symbol
5459         index is not set.  Make sure the new index is valid.
5460         (Symbol_value::set_must_have_output_symtab_entry): New function.
5461         (Symbol_value::has_output_dynsym_entry): New function.
5462         (Symbol_value::set_output_dynsym_index): Make sure the new index
5463         is valid.
5464         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5465         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5466         local symbol if permitted.
5467         (Sized_relobj::do_finalize_local_symbols): Call
5468         is_output_symtab_index_set rather than needs_output_symtab_entry.
5469         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5470         rather than needs_output_symtab_entry.  Call
5471         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5472         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5473         is_output_symtab_index_set rather than needs_output_symtab_entry.
5474         * testsuite/discard_locals_relocatable_test.c: New file.
5475         * testsuite/discard_locals_test.sh: Test -r.
5476         * testsuite/Makefile.am (check_DATA): Add
5477         discard_locals_relocatable_test1.syms,
5478         discard_local_relocatable_test2.syms.
5479         (MOSTLYCLEANFILES): Likewise.  Also add
5480         discard_locals_relocatable_test1.lout and
5481         discard_locals_relocatable_test2.out.
5482         (discard_locals_relocatable_test1.syms): New target.
5483         (discard_locals_relocatable_test.o): New target.
5484         (discard_locals_relocatable_test1.out): New target.
5485         (discard_locals_relocatable_test2.syms): New target.
5486         (discard_locals_relocatable_test2.out): New target.
5487         (various): Add missing ../ld-new dependencies.
5488         * testsuite/Makefile.in: Rebuild.
5489
5490 2010-03-03  Nick Clifton  <nickc@redhat.com>
5491
5492         * po/fi.po: New Finnish translation.
5493
5494 2010-03-01  Doug Kwan  <dougkwan@google.com>
5495
5496         * layout.cc (Layout::Layout): Force section types of .init_array*,
5497         .preinit_array* and .fini_array* sections.
5498         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5499         Fix check of return value of std::string::find.().
5500         (Output_section::Input_section_sort_compare::operator()): Remove
5501         comment about .init_array.
5502         (Output_section::Input_section_sort_init_fini_compare::operator()):
5503         New method.
5504         (Output_section::sort_attached_input_sections): Handle .init_array
5505         and .fini_array specially.
5506         * output.h (Output_section::Inut_section_sort_compare): Update
5507         comment.
5508         (Output_section::Input_section_sort_init_fini_compare): New struct.
5509
5510 2010-02-26  Doug Kwan  <dougkwan@google.com>
5511
5512         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5513         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5514         * testsuite/debug_msg.sh: Avoid matching source line number for
5515         use of global variable undef_int.
5516
5517 2010-02-26  Doug Kwan  <dougkwan@google.com>
5518
5519         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5520         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5521         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5522         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5523         * options.cc (General_options::General_options): Initialize member
5524         fix_v4bx_.
5525         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5526         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5527         and rm_no_fix_v4bx.stdout
5528         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5529         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5530         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5531         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5532         and arm_no_fix_v4bx.
5533         * Makefile.in: Regenerate.
5534         * testsuite/arm_fix_v4bx.s: New file.
5535         * testsuite/arm_fix_v4bx.sh: Ditto.
5536
5537 2010-02-24  Doug Kwan  <dougkwan@google.com>
5538
5539         * arm.cc (Target_arm::got_section): Make the .got section the first
5540         non RELRO section in the data segment.
5541         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5542         suffixes of section names.
5543
5544 2010-02-24  Doug Kwan  <dougkwan@google.com>
5545
5546         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5547         flags and attributes merging if an input file is a binary file.
5548         * fileread.cc (Input_file::open): Record format of original file.
5549         * fileread.h (Input_file::Format): New enum type.
5550         (Input_file::Input_file): Initialize data member format_.
5551         (Input_file::format): New method definition.
5552         (Input_file::format_):: New data member.
5553
5554 2010-02-24  Doug Kwan  <dougkwan@google.com>
5555
5556         * arm.cc (Arm_output_data_got): New class.
5557         (ARM_TCB_SIZE): New constant
5558         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5559         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5560         If user uses a script with a SECTIONS clause, issue only a warning
5561         for a misplaced EXIDX input section.  Otherwise, issue an error.
5562         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5563         garbage collection.
5564         (Target_arm::got_mode_index_entry): Handle static linking.
5565         (Target_arm::Scan::local): Ditto.
5566         (Target_arm::Scan::global): Ditto.
5567         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5568         all incorrectly implemented relocations.
5569         (Target_arm::fix_exidx_coverage): Pass layout to
5570         Arm_output_section::fix_exidx_coverage.
5571         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5572         from ".ARM.exidx." and ".ARM.extab.".
5573
5574 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5575
5576         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5577         section if it does not already exist.
5578         * attributes.cc (Attributes_section_data::Attributes_section_data):
5579         Don't crash if size is zero.
5580
5581 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5582             Ian Lance Taylor  <iant@google.com>
5583
5584         * gold.cc (queue_middle_tasks): If no input files were opened,
5585         exit.
5586         * workqueue.h (Task_function::Task_function): Assert that there is
5587         a blocker.
5588
5589 2010-02-22  Doug Kwan  <dougkwan@google.com>
5590
5591         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5592         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5593         types to avoid warnings due to different uint64_t implementations
5594         on different hosts.
5595
5596 2010-02-21  Doug Kwan  <dougkwan@google.com>
5597
5598         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5599         handling of the maximum backward branch offset.
5600         (Arm_relocate_functions::thumb_branch_common): Ditto.
5601         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5602         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5603         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5604         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5605         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5606         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5607         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5608         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5609         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5610         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5611         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5612         thumb2_bl_out_of_range.o): New rules.
5613         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5614         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5615         thumb2_bl_out_of_range
5616         * testsuite/Makefile.in: Regenerate.
5617         * testsuite/arm_bl_in_range.s: New file.
5618         * testsuite/arm_bl_out_of_range.s: Ditto.
5619         * testsuite/arm_branch_in_range.sh: Ditto.
5620         * testsuite/arm_branch_range.t: Ditto.
5621         * testsuite/thumb2_branch_range.t: Ditto.
5622         * testsuite/thumb_bl_in_range.s: Ditto.
5623         * testsuite/thumb_bl_out_of_range.s: Ditto.
5624         * testsuite/thumb_branch_range.t: Ditto.
5625
5626 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5627
5628         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5629         Add reloc offset information.
5630         * icf.cc (get_section_contents): Change iterators to point to the new
5631         vectors. Add reloc offset information to the contents.
5632         * icf.h (Icf::Sections_reachable_info): New typedef.
5633         (Icf::Sections_reachable_list): New typedef.
5634         (Icf::Offset_info): New typedef.
5635         (Icf::Reloc_info): New struct typedef.
5636         (Icf::Reloc_info_list): New typedef.
5637         (Icf::symbol_reloc_list): Delete method.
5638         (Icf::addend_reloc_list): Delete method.
5639         (Icf::section_reloc_list): Delete method.
5640         (Icf::reloc_info_list): New method.
5641         (Icf::reloc_info_list_): New member.
5642
5643 2010-02-19  Doug Kwan  <dougkwan@google.com>
5644
5645         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5646         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5647         * arm.cc (Arm_relocation_functions): New forward declaration.
5648         (Target_arm::Target_arm): Initialize new data members
5649         got_mod_index_offset_ and tls_base_symbol_defined_.
5650         (Target_arm::Relocate::relocate_tls): New method.
5651         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5652          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5653         New methods.
5654         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5655         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5656         (Target_arm::got_mod_index_offset_,
5657         Target_arm::tls_base_symbol_defined_): New data members.
5658         (Target_arm::Scan::local, Target::Scan::global,
5659         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5660         relocations.
5661
5662 2010-02-18  Doug Kwan  <dougkwan@google.com>
5663
5664         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5665         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5666         text section as a parameter becuase some broken tools may not set
5667         the link in section header.
5668         (Target_arm::has_got_section): New method.
5669         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5670         without any mapping symbol as data only.  Remove warning.
5671         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5672         link in its section header, try to discover the link by inspecting the
5673         REL31 relocation at the beginning of the section.
5674         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5675         in error message.
5676         (Target_arm::Scan::global): Treat any reference to the symbol
5677         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5678
5679 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5680
5681         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5682         (Scan::global_reloc_may_be_function_pointer): New function.
5683         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5684         (Scan::global_reloc_may_be_function_pointer): New function.
5685         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5686         (Scan::global_reloc_may_be_function_pointer): New function.
5687         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5688         (Scan::global_reloc_may_be_function_pointer): New function.
5689         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5690         (Scan::global_reloc_may_be_function_pointer): New function.
5691         (Scan::possible_function_pointer_reloc): New function.
5692         (Target_x86_64::can_check_for_function_pointers): New function.
5693         * gc.h (gc_process_relocs): Scan relocation types to determine if
5694         function pointers were taken for targets that support it.
5695         * icf.cc (Icf::find_identical_sections): Include functions for
5696         folding in safe ICF whose pointer is not taken.
5697         * icf.h (Secn_fptr_taken_set): New typedef.
5698         (fptr_section_id_): New member.
5699         (section_has_function_pointers): New function.
5700         (set_section_has_function_pointers): New function.
5701         (check_section_for_function_pointers): New function.
5702         * options.h: Fix comment for safe ICF option.
5703         * target.h (can_check_for_function_pointers): New function.
5704         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5705         Modify icf_safe_test for X86-64.
5706         * testsuite/Makefile.in: Regenerate.
5707         * testsuite/icf_safe_so_test.cc: New file.
5708         * testsuite/icf_safe_so_test.sh: New file.
5709         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5710         (main): Change to take pointer to function kept_func_3.
5711         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5712         folding is done correctly for X86-64.
5713
5714 2010-02-12  David S. Miller  <davem@davemloft.net>
5715
5716         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5717         is_symbolless parameter.
5718         (Output_reloc<SHT_REL>::is_symbolless): New.
5719         (Output_reloc<SHT_REL>::is_symbolless_): New.
5720         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5721         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5722         (Output_reloc<SHT_RELA>::is_symbolless): New.
5723         (Output_data_reloc::add_global): Handle is_symbolless.
5724         (Output_data_reloc::add_global_relative): Likewise.
5725         (Output_data_reloc::add_local): Likewise.
5726         (Output_data_reloc::add_local_relative): Likewise.
5727         (Output_data_reloc::add_symbolless_global_addend): New.
5728         (Output_data_reloc::add_symbolless_local_addend): New.
5729         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5730         is_symbolless.
5731         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5732         instead of ->is_relative_
5733         (Output_reloc::write): Likewise.
5734         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5735         (Output_reloc::write_rel): Simplify.
5736
5737         * sparc.cc (Target_sparc::Scan::local): Use
5738         ->add_symbolless_local_addend as needed.
5739         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5740         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5741         based upon relocation offset.
5742
5743 2010-02-11  Doug Kwan  <dougkwan@google.com>
5744
5745         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5746         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5747         beginning of function.
5748         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5749         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5750         parameter is_32bit in calls to should_apply_static_reloc.
5751         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5752         (check_DATA): Add arm_abs_global.stdout.
5753         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5754         arm_abs_global.stdout): New rules.
5755         (MOSTLLYCLEANFILES): Add arm_abs_global
5756         * Makefile.in: Regenerate.
5757         * testsuite/arm_abs_global.s: New file.
5758         * testsuite/arm_abs_global.sh: Ditto.
5759         * testsuite/arm_abs_lib.s: Ditto.
5760
5761 2010-02-11  Ian Lance Taylor  <iant@google.com>
5762
5763         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5764         Read_relocs task.
5765         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5766         Allocate_commons_task first.
5767         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5768         task, rather than symtab_lock_.
5769         (Gc_process_relocs::~Gc_process_relocs): New function.
5770         (Gc_process_relocs::is_runnable): Check this_blocker_.
5771         (Gc_process_relocs::locks): Use next_blocker_ rather than
5772         blocker_.
5773         (Scan_relocs::~Scan_relocs): New function.
5774         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5775         symtab_lock_.
5776         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5777         next_blocker_.
5778         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5779         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5780         constructor accordingly.
5781         (class Gc_process_relocs): Likewise.
5782         (class Scan_relocs): Likewise.
5783         * common.h (class Allocate_commons_task): Remove symtab_lock_
5784         field, and corresponding constructor parameter.
5785         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5786         symtab_lock_.
5787         (Allocate_commons_task::locks): Likewise.
5788
5789 2010-02-11  Ian Lance Taylor  <iant@google.com>
5790
5791         * gold-threads.h (class Once): Define.
5792         (class Initialize_lock): Rewrite as child of Once.
5793         * gold-threads.cc (class Once_initialize): Define.
5794         (once_pointer_control): New static variable.
5795         (once_pointer, once_arg): New static variables.
5796         (c_run_once): New static function.
5797         (Once::Once, Once::run_once, Once::internal_run): New functions.
5798         (class Initialize_lock_once): Remove.
5799         (initialize_lock_control): Remove.
5800         (initialize_lock_pointer): Remove.
5801         (initialize_lock_once): Remove.
5802         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5803         (Initialize_lock::initialize): Rewrite.
5804         (Initialize_lock::do_run_once): New function.
5805         * archive.cc (Archive::interpret_header): Only clear name if it is
5806         not already empty.
5807         * fileread.cc: Include "gold-threads.h"
5808         (file_counts_lock): New static variable.
5809         (file_counts_initialize_lock): Likewise.
5810         (File_read::release): Only increment counts when using --stats.
5811         Use a lock around the increment.
5812         * parameters.cc (class Set_parameters_target_once): Define.
5813         (set_parameters_target_once): New static variable.
5814         (Parameters::Parameters): Move here from parameters.h.
5815         (Parameters::set_target): Rewrite.
5816         (Parameters::set_target_once): New function.
5817         (Parameters::clear_target): Move here and rewrite.
5818         * parameters.h (class Parameters): Update declarations.  Add
5819         set_parameters_target_once_ field.
5820         (Parameters::Parameters): Move to parameters.cc.
5821         (Parameters::clear_target): Likewise.
5822         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5823         task.
5824         (Start_group::~Start_group): New function.
5825         (Start_group::is_runnable): New function.
5826         (Start_group::locks, Start_group::run): New functions.
5827         (Finish_group::run): Change saw_undefined to size_t.
5828         * readsyms.h (class Start_group): Define.
5829         (class Finish_group): Change saw_undefined_ field to size_t.
5830         (Finish_group::Finish_group): Remove saw_undefined and
5831         this_blocker parameters.  Change all callers.
5832         (Finish_group::set_saw_undefined): New function.
5833         (Finish_group::set_blocker): New function.
5834         * symtab.h (class Symbol_table): Change saw_undefined to return
5835         size_t.  Change saw_undefined_ field to size_t.
5836         * target-select.cc (Set_target_once::do_run_once): New function.
5837         (Target_selector::Target_selector): Initialize set_target_once_
5838         field.  Don't initialize lock_ and initialize_lock_ fields.
5839         (Target_selector::instantiate_target): Rewrite.
5840         (Target_selector::set_target): New function.
5841         * target-select.h (class Set_target_once): Define.
5842         (class Target_selector): Update declarations.  Make
5843         Set_target_once a friend.  Remove lock_ and initialize_lock_
5844         fields.  Add set_target_once_ field.
5845
5846 2010-02-10  Ian Lance Taylor  <iant@google.com>
5847
5848         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5849         queueing any tasks.
5850         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5851         (queue_middle_tasks): Add all blockers before queueing any tasks.
5852         (queue_final_tasks): Likewise.
5853         * token.h (Task_token::add_blockers): New function.
5854         * object.h (Input_objects::number_of_relobjs): New function.
5855
5856 2010-02-10  Ian Lance Taylor  <iant@google.com>
5857
5858         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5859         shared, not if not position independent.
5860         * x86_64.cc (Relocate::relocate_tls): Likewise.
5861         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5862         (tls_pie_pic_test): New target.
5863         * testsuite/Makefile.in: Rebuild.
5864
5865         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5866         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5867         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5868         * testsuite/Makefile.in: Rebuild.
5869
5870 2010-02-09  David S. Miller  <davem@davemloft.net>
5871
5872         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5873         R_SPARC_RELATIVE using ->add_local_relative().
5874         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5875
5876         * output.h (Output_data_dynamic::add_section_size): New method
5877         that takes two Output_data objects.
5878         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5879         entry param.  Handle it in initializers.
5880         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5881         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5882         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5883         arg.
5884         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5885         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5886         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5887         for dynrel_includes_plt.
5888         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5889         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5890         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5891         before .rela.plt
5892         (Target_sparc::do_finalize_sections): Update to pass true for
5893         dynrel_includes_plt.
5894         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5895         output before .rela.plt
5896         (Target_powerpc::do_finalize_sections): Update to pass true for
5897         dynrel_includes_plt when 32-bit.
5898
5899 2010-02-08  Doug Kwan  <dougkwan@google.com>
5900
5901         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5902         method.
5903         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5904         Arm_relobj::scan_section_for_cortex_a8_stubs,
5905         Arm_relobj::do_relocation_section): Instead of calling
5906         Output_section::output_address, use faster
5907         Arm_relobj::simple_input_section_output_address.
5908
5909 2010-02-08  David S. Miller  <davem@davemloft.net>
5910
5911         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5912         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5913         relocation helper function.
5914
5915         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5916         just like R_SPARC_GOT{10,13,22}.
5917         (Target_sparc::Scan::local): Likewise.
5918         (Target_sparc::Relocate:relocate): Likewise.
5919
5920 2010-02-06  Ian Lance Taylor  <iant@google.com>
5921
5922         * configure.ac: Rewrite targetobjs duplicate removal code to use
5923         only shell constructs.
5924         * configure: Rebuild.
5925
5926 2010-02-05  Doug Kwan  <dougkwan@google.com>
5927
5928         PR 11247
5929         * arm.cc (Arm_relobj::section_is_scannable): New method.
5930         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5931         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5932
5933 2010-02-04  Doug Kwan  <dougkwan@google.com>
5934
5935         PR 11247
5936         * arm-reloc-property.cc (cstdio): Include.
5937         * configure.ac (targetobjs): Remove duplicates.
5938         * configure: Regenerate.
5939         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5940         big and little endian version for a given address size.
5941
5942 2010-02-03  Doug Kwan  <dougkwan@google.com>
5943
5944         * arm-reloc-property.cc
5945         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5946         definition.
5947         * arm-reloc-property.h
5948         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5949         New method definition.
5950         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5951         declaration.
5952         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5953         overflow to N.
5954         (GOT_PREL): Change implemented to Y.
5955         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5956         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5957         (Arm_relocate_functions::movw_abs_nc): Remove method.
5958         (Arm_relocate_functions::movt_abs): Ditto.
5959         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5960         (Arm_relocate_functions::thm_movt_abs): Ditto.
5961         (Arm_relocate_functions::movw_rel_nc): Ditto.
5962         (Arm_relocate_functions::movw_rel): Ditto.
5963         (Arm_relocate_functions::movt_rel): Ditto.
5964         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5965         (Arm_relocate_functions:thm_movw_rel): Ditto.
5966         (Arm_relocate_functions:thm_movt_rel): Ditto.
5967         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5968         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5969         New method definitions.
5970         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5971         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5972         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5973         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5974         (Target_arm::Relocate::relocate): Check for non-static or
5975         unimplemented relocation code and exit early.  Change calls to
5976         Target_arm::reloc_uses_thumb_bit and
5977         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5978         instead.  Refactor code to handle similar relocations to increase
5979         code sharing.  Remove check for unsupported relocation code in switch
5980         statement.
5981         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5982         relocation property table to find out size.  Change error message to
5983         print out the name of a relocation code instead of the numeric value.
5984         (Target_arm::scan_reloc_for_stub): Use relocation property table
5985         instead of calling Target_arm::reloc_uses_thumb_bit().
5986
5987 2010-02-02  Doug Kwan  <dougkwan@google.com>
5988
5989         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5990         types of relaxed input section.
5991
5992 2010-02-02  Doug Kwan  <dougkwan@google.com>
5993
5994         * Makefile.am (HFILES): Add arm-reloc-property.h.
5995         (DEFFILES): New.
5996         (TARGETSOURCES): Add arm-reloc-property.cc
5997         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5998         (libgold_a_SOURCES): $(DEFFILES)
5999         * Makefile.in: Regenerate.
6000         * arm-reloc-property.cc: New file.
6001         * arm-reloc-property.h: New file.
6002         * arm-reloc.def: New file.
6003         * arm.cc: Update comments.
6004         (arm-reloc-property.h): New included header.
6005         (arm_reloc_property_table): New global variable.
6006         (Target_arm::do_select_as_default_target): New method definition.
6007         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6008         arm-reloc-property to targ_extra_obj.
6009         * parameters.cc (set_parameters_target): Call
6010         Target::select_as_default_target().
6011         * target.h (Target::select_as_default_target): New method definition.
6012         (Target::do_select_as_default_target): Same.
6013
6014 2010-02-01  Doug Kwan  <dougkwan@google.com>
6015
6016         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6017         first_output_text_section_.
6018         (Arm_exidx_fixup::first_output_text_section): New method definition.
6019         (Arm_exidx_fixup::first_output_text_section_): New data member.
6020         (Arm_exidx_fixup::process_exidx_section): Record the first text
6021         output section seen.
6022         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6023         and entsize in output section header.
6024
6025 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6026
6027         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6028         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6029         (Arm_relocate_functions::thm_alu11): New Method.
6030         (Arm_relocate_functions::thm_pc8): New Method.
6031         (Arm_relocate_functions::thm_pc12): New Method.
6032         (Target_arm::Scan::local): Handle the relocations.
6033         (Target_arm::Scan::global): Likewise.
6034         (Target_arm::Relocate::relocate): Likewise.
6035         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6036
6037 2010-01-29  Doug Kwan  <dougkwan@google.com>
6038
6039         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6040         of relocation types as ld.
6041
6042 2010-01-29  Doug Kwan  <dougkwan@google.com>
6043
6044         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6045         to public.
6046         (Arm_relocate_functions::thumb_branch_common): Ditto.
6047         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6048         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6049         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6050         Arm_relocate_functions::jump24): Remove.
6051         (Target_arm::Relocate::relocate): Adjust code to call
6052         Arm_relocation_functions::arm_branch_common and
6053         Arm_relocation_functions::thumb_branch_common instead of their removed
6054         wrappers.  Merge switch-cases together to reduce source code size.
6055
6056 2010-01-29  Doug Kwan  <dougkwan@google.com>
6057
6058         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6059         output_local_symbol_count_needs_update_.
6060         (Arm_relobj::output_local_symbol_count_needs_update,
6061          Arm_relobj::set_output_local_symbol_count_needs_update,
6062          Arm_relobj::update_output_local_symbol_count): New methods.
6063         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6064         member.
6065         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6066         of pointed function as in a R_ARM_PREL31 relocation.
6067         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6068         for output local symbol count updating.
6069         (Target_arm::do_relax): Update output local symbol counts in objects
6070         if necessary.
6071         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6072
6073 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6074
6075         * arm.cc: Added support for the ARM relocations:
6076         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6077         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6078         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6079         movw_prel_nc).
6080         (Arm_relocate_functions::movw_rel): New method.
6081         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6082         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6083         thm_movw_prel_nc).
6084         (Arm_relocate_functions::thm_movw_rel): New method.
6085         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6086         thm_movt_prel).
6087         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6088         relocations.
6089         (Target_arm::Scan::global): Likewise.
6090         (Target_arm::Relocate::relocate): Likewise.
6091         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6092         Likewise.
6093
6094 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6095
6096         * arm.cc: Added support for ARM group relocations.
6097         (Target_arm::reloc_needs_sym_origin): New method.
6098         (Arm_relocate_functions::calc_grp_kn): New method.
6099         (Arm_relocate_functions::calc_grp_residual): New method.
6100         (Arm_relocate_functions::calc_grp_gn): New method.
6101         (Arm_relocate_functions::arm_grp_alu): New Method.
6102         (Arm_relocate_functions::arm_grp_ldr): New Method.
6103         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6104         (Arm_relocate_functions::arm_grp_ldc): New Method.
6105         (Target_arm::Scan::local): Handle the ARM group relocations.
6106         (Target_arm::Scan::global): Likewise.
6107         (Target_arm::Relocate::relocate): Likewise.
6108         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6109         Likewise.
6110
6111 2010-01-26  Doug Kwan  <dougkwan@google.com>
6112
6113         * arm.cc (set): Include.
6114         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6115         pointer type.
6116         (Arm_output_section::Text_section_list): New type.
6117         (Arm_output_section::append_text_sections_to_list): New method.
6118         (Arm_output_section::fix_exidx_coverage): Ditto.
6119         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6120         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6121         Relobj::set_section_offset() instead of
6122         Sized_relobj::invalidate_section_offset().
6123         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6124         parameter for section headers. Ignore relocation sections for
6125         unallocated sections and EXIDX sections.
6126         (Target_arm::fix_exidx_coverage): New method.
6127         (Target_arm::output_section_address_less_than): New type.
6128         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6129         linked text section instead of the EXIDX section.
6130         (Arm_output_section::create_stub_group): Add an assertion to check
6131         that this is not an EXIDX output section.
6132         (Arm_output_section::append_text_sections_to_list): New method.
6133         (Arm_output_section::fix_exidx_coverage): Ditto.
6134         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6135         Arm_relobj::section_needs_reloc_stub_scanning.
6136         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6137         first pass.
6138         (Target_arm::fix_exidx_coverage): New method.
6139         * object.h (Relobj::set_output_section): New method.
6140         (Sized_relobj::invalidate_section_offset): Remove method.
6141         (Sized_relobj::do_invalidate_section_offset): Remove method.
6142         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6143
6144 2010-01-25  Doug Kwan  <dougkwan@google.com>
6145
6146         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6147         Fix warning due to signed and unsigned comparison on a 32-bit host.
6148
6149 2010-01-22  Doug Kwan  <dougkwan@google.com>
6150
6151         * arm.cc (Target_arm::do_relax): Record an output section for section
6152         offset adjustment it contains any stub table that has changed.
6153         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6154         offsets in an output section if necessary.
6155         * output.cc (Output_section::Output_section): Initialize
6156         section_offsets_need_adjustments_.
6157         (Output_section::add_input_section_for_script): Renamed to
6158         Output_section::add_simple_input_section.
6159         (Output_section::save_states): Add a comment.
6160         (Output_section::discard_states): New method defintion.
6161         (Output_section::adjust_section_offsets): Same.
6162         * output.h (Output_section::add_input_section_for_script): Renamed to
6163         Output_section::add_simple_input_section.
6164         (Output_section::discard_states): New method declaration.
6165         (Output_section::adjust_section_offsets): Same.
6166         (Output_section::section_offsets_need_adjustment,
6167         Output_section::set_section_offsets_need_adjustment): New method
6168         definitions.
6169         (Output_section::section_offsets_need_adjustment_): New data member.
6170         * script-sections.cc
6171         (Output_section_element_input::set_section_address): Adjust code for
6172         renaming of Output_section::add_input_section_for_script.
6173         (Orphan_output_section::set_section_address): Same.
6174
6175 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6176
6177         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6178         Fix_v4bx enum values .
6179         * gold/options.h (General_options): New option definitions.
6180         (General_options::fix_v4bx): New method.
6181         (General_options::Fix_v4bx): New enum.
6182         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6183         (General_options::parse_fix_v4bx_interworking): New method.
6184
6185 2010-01-22  Doug Kwan  <dougkwan@google.com>
6186
6187         * arm.cc (Arm_exidx_fixup): New class.
6188
6189 2010-01-21  Doug Kwan  <dougkwan@google.com>
6190
6191         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6192         classes.
6193         (Arm_exidx_section_offset_map): New type.
6194
6195 2010-01-21  Doug Kwan  <dougkwan@google.com>
6196
6197         * arm.cc (Arm_exidx_input_section): New class.
6198         (Arm_relobj::exidx_input_section_by_link,
6199         Arm_relobj::exidx_input_section_by_shndx,
6200         Arm_relobj::make_exidx_input_section): New methods.
6201         (read_arm_attributes_section): Remove.
6202         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6203         information about them.
6204         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6205         to here.
6206
6207 2010-01-20  Doug Kwan  <dougkwan@google.com>
6208
6209         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6210         Input_section_specifier to Section_id.
6211         (Target_arm::new_arm_input_section: Adjust code for change of key
6212         type.
6213         (Target_arm::find_arm_input_section): Ditto.
6214         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6215         (Section_id): Remove.
6216         (Garbage_collection::Section_id_hash): Remove.
6217         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6218         (Section_id): Remove.
6219         (Icf::Section_id_hash): Remove.
6220         * object.h (Section_id, Const_section_id, Section_id_hash,
6221         Const_section_id_hash): New type definitions.
6222         * output.cc (Output_section::add_relaxed_input_section): Change to
6223         use Const_section_id instead of Input_section_specifier as key type.
6224         (Output_section::add_merge_input_section): Ditto.
6225         (Output_section::build_relaxation_map): Change to use Section_id
6226         instead of Input_section_specifier as key type.
6227         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6228         Ditto.
6229         (Output_section::convert_input_sections_to_relaxed_sections): Change
6230         to use Const_section_id instead of Input_section_specifier as key type.
6231         (Output_section::find_merge_section): Ditto.
6232         (Output_section::find_relaxed_input_section): Ditto.
6233         * output.h (Input_section_specifier): Remove class.
6234         (Output_section::Output_section_data_by_input_section_map): Change
6235         key type to Const_section_id.
6236         (Output_section::Output_relaxed_input_section_by_input_section_map):
6237         Ditto.
6238         (Output_section::Relaxation_map): Change key type to Section_id.
6239
6240 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6241
6242         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6243         (class Arm_v4bx_stub): New class.
6244         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6245         (Stub_factory::make_arm_v4bx_stub): New method.
6246         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6247         (Stub_table::empty): Handle v4bx stubs.
6248         (Stub_table::add_arm_v4bx_stub): New method.
6249         (Stub_table::find_arm_v4bx_stub): New method.
6250         (Arm_relocate_functions::v4bx): New method.
6251         (Target_arm::fix_v4bx): New method.
6252         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6253         (Stub_table::relocate_stubs): Likewise.
6254         (Stub_table::do_write): Likewise.
6255         (Stub_table::update_data_size_and_addralign): Likewise.
6256         (Stub_table::finalize_stubs):  Likewise.
6257         (Target_arm::Scan::local): Likewise.
6258         (Target_arm::Scan::global): Likewise.
6259         (Target_arm::do_finalize_sections): Likewise.
6260         (Target_arm::Relocate::relocate): Likewise.
6261         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6262         Likewise.
6263         (Target_arm::scan_reloc_for_stub): Likewise.
6264         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6265
6266 2010-01-19  Ian Lance Taylor  <iant@google.com>
6267
6268         * output.cc (Output_section_headers::do_sized_write): Write large
6269         segment count to sh_info field.
6270         (Output_file_header::do_sized_write): For large segment count,
6271         write PN_XNUM to e_phnum field.
6272
6273 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6274
6275         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6276         (Arm_relocate_functions::thm_jump8): New function.
6277         (Arm_relocate_functions::thm_jump11): New function.
6278         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6279         R_ARM_THM_JUMP11.
6280         (Target_arm::Scan::global): Likewise.
6281         (Target_arm::Relocate::relocate): Likewise.
6282         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6283         Likewise.
6284
6285 2010-01-14  Doug Kwan  <dougkwan@google.com>
6286
6287         * arm.cc (map, utility): Include headers.
6288         (Target_arm::apply_cortex_a8_workaround): New method.
6289         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6290         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6291         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6292         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6293         the --[no-]fix-cortex-a8 command line options.
6294         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6295         (Target_arm::relocate_stub): Use addend in instruction template.
6296         * options.h (DEFINE_bool): Set the user-set flag.
6297         (General_options): Add --[no-]-fix-cortex options.
6298         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6299         : Update fast look-up map after conversion.
6300
6301 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6302
6303         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6304         in the first pass of do_layout.
6305
6306 2010-01-13  Doug Kwan  <dougkwan@google.com>
6307
6308         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6309         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6310         apparent compiler problem of not folding static constant integral
6311         data members of elfcpp::Elf_sizes<32>.
6312
6313 2010-01-13  Doug Kwan  <dougkwan@google.com>
6314
6315         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6316         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6317         Arm_relobj::scan_section_for_cortex_a8_erratum,
6318         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6319         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6320         sections to scan for relocation stubs into a new method
6321         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6322         relocation and Cortex-A8 stub scanning.
6323         (Target_arm::do_relax): Force stubs to be after stubbed sections
6324         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6325         the beginning of a new relaxation pass.  Update a comment.
6326         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6327
6328 2010-01-12  Ian Lance Taylor  <iant@google.com>
6329
6330         * target-reloc.h (visibility_error): New inline function.
6331         (relocate_section): Call visibility_error.
6332         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6333         (MOSTLYCLEANFILES): Likewise.
6334         (protected_4_pic.o, protected_3.err): New targets.
6335         * testsuite/protected_4.cc: New file.
6336
6337 2010-01-12  Doug Kwan  <dougkwan@google.com>
6338
6339         * arm.cc (Cortex_a8_reloc): New class.
6340         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6341         and cortex_a8_relocs_info_.
6342         (Target_arm::fix_cortex_a8): New method definition.
6343         (Target_arm::Cortex_a8_relocs_info): New type.
6344         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6345         New data member declarations.
6346         (Target_arm::scan_reloc_for_stub): Record information about
6347         relocations for THUMB branches that might be exempted from the
6348         Cortex-A8 workaround.
6349         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6350         at the beginning of a relaxation pass.
6351
6352 2010-01-12  Doug Kwan  <dougkwan@google.com>
6353
6354         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6355         (Arm_relobj::Mapping_symbol_position,
6356          Arm_reloj::Mapping_symbol_position_less,
6357          Arm_relobj::Mapping_symbols_info): New types.
6358         (Target_arm::is_mapping_symbol_name): New method definition.
6359         (Arm_relobj::do_count_local_symbols): Save information about mapping
6360         symbols.
6361
6362 2010-01-11  Doug Kwan  <dougkwan@google.com>
6363
6364         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6365         Arm_relocate_functions::thumb32_branch_upper,
6366         Arm_relocate_functions::thumb32_branch_lower,
6367         Arm_relocate_functions::thumb32_cond_branch_offset,
6368         Arm_relocate_functions::thumb32_cond_branch_upper,
6369         Arm_relocate_functions::thumb32_cond_branch_lower,
6370         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6371         branch offset encoding.
6372         (Arm_relocate_functions::thumb_branch_common): Use new branch
6373         offset encoding methods to avoid code duplication.
6374         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6375         (Stub_addend_reader::operator()): Use new branch encoding method
6376         to avoid code duplication.
6377
6378 2010-01-11  Doug Kwan  <dougkwan@google.com>
6379
6380         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6381         (Target_arm::do_finalize_sections): Define special EXIDX section
6382         symbols only if referenced.
6383         * gc.h (Garbage_collection::add_reference): New method.
6384         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6385         code duplication.
6386
6387 2010-01-11  Ian Lance Taylor  <iant@google.com>
6388
6389         * script.cc (Version_script_info::build_expression_list_lookup):
6390         Change complaing about duplicate wildcard match from error to
6391         warning.
6392
6393         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6394         of 2009-12-30.
6395         (Version_script_info::Version_script_info): Initialize globs_,
6396         default_version_, default_is_global_, and exact_.  Don't
6397         initialize globals_ or locals_.
6398         (Version_script_info::build_lookup_tables): Build local symbols
6399         first.
6400         (Version_script_info::unquote): New function.
6401         (Version_script_info::add_exact_match): New function.
6402         (Version_script_info::build_expression_list_lookup): Remove lookup
6403         parameter.  Add is_global parameter.  Change all callers.  Handle
6404         wildcard pattern specially.  Unquote pattern.  Call
6405         add_exact_match.
6406         (Version_script_info::get_name_to_match): New function.
6407         (Version_script_info::get_symbol_version): New function.
6408         (Version_script_info::get_symbol_version_helper): Remove.
6409         (Version_script_info::check_unmatched_names): Call unquote.
6410         * script.h (class Version_script_info): Change get_symbol_version
6411         to be non-inline and add is_global parameter; change all callers.
6412         Rewrite symbol_is_local.  Update declarations.  Define struct
6413         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6414         Remove globals_ and locals_ members.  Add exact_, globs_,
6415         default_version_, is_global_.
6416         (Version_script_info::Glob): Remove pattern, add expression and
6417         is_global.  Update constructor.  Change all callers.
6418         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6419         default version.
6420         (Versions::symbol_section_contents): If a symbol is undefined, or
6421         defined in a dynamic object, set the version index to
6422         VER_NDX_LOCAL.
6423         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6424         symbol_is_local.
6425         (Symbol_table::add_from_pluginobj): Likewise.
6426         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6427
6428 2010-01-11  Doug Kwan  <dougkwan@google.com>
6429
6430         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6431         (incremental_dump_LDADD): Add linking option for libintl.
6432         * Makefile.in: Regenerate.
6433
6434 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6435
6436         PR gold/11144
6437         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6438         instead of -Ds.
6439         * testsuite/Makefile.in: Regenerated.
6440
6441 2010-01-10  Doug Kwan  <dougkwan@google.com>
6442
6443         * options.h (DEFINE_var): Use parentheses around argument varname__
6444         in macro body to avoid any unintended subsequent substitutions.
6445
6446 2010-01-10  Ian Lance Taylor  <iant@google.com>
6447
6448         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6449         candidates before doing symbol resolution.
6450
6451         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6452         ODR candidates if only one is weak.
6453
6454 2010-01-08  Ian Lance Taylor  <iant@google.com>
6455
6456         * script.cc (Version_script_info::build_expression_list_lookup):
6457         Don't warn about ambiguous version, just record the ambiguity.
6458         (Version_script_info::get_symbol_version_helper): Give error if
6459         version is ambiguous.
6460
6461 2010-01-08  Doug Kwan  <dougkwan@google.com>
6462
6463         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6464           prev_data_size_ and prev_addralign_.  Remove initializer for
6465           deleted data member has_been_changed_.
6466           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6467           to determine if the table is empty.
6468           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6469           Remove.
6470           (Stub_table::add_reloc_stub): Define method in class definition
6471           instead of just declaring it there.
6472           (Stub_table::add_cortex_a8_stub): New method definition.
6473           (Stub_table::update_data_size_and_addralign): Ditto.
6474           (Stub_table::finalize_stubs): Ditto.
6475           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6476           (Stub_table::do_addralign_): Return address alignment in the
6477           (Stub_table::do_reset_address_and_file_offset): Define method in
6478           class definition instead of declaring it there.  Set current data
6479           size to be the data size of the previous pass.
6480           (Stub_table::set_final_data_size): Use current data size as the
6481           final data size.
6482           (Stub_table::relocate_stub): Change parameter type of stub from
6483           Reloc_stub pointer to Stub pointer.
6484           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6485           (Stub_table::Cortex_a8_stub_list): New typedef.
6486           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6487            Stub_table::prev_addralign_): New data member.
6488           (Arm_relobj::Arm_relobj): Initialize data member
6489           section_has_cortex_a8_workaround_.
6490           (Arm_relobj::section_has_cortex_a8_workaround,
6491            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6492            definitions.
6493           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6494           declarations.
6495           (Target_arm::relocate_stub): Change parameter type of stub from
6496           Reloc_stub pointer to Stub pointer.
6497           (Insn_template::size, Insn_template::alignment): Handle
6498           THUMB16_SPECIAL_TYPE.
6499           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6500            Stub_table::update_data_size_and_addralign,
6501            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6502           definitions.
6503           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6504           (Stub_table::do_write): Ditto.
6505           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6506
6507 2010-01-08  Ian Lance Taylor  <iant@google.com>
6508
6509         PR 11108
6510         * symtab.h (class Symbol): Remove fields is_target_special_ and
6511         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6512         (Symbol::is_defined_in_discarded_section): New function.
6513         (Symbol::set_is_defined_in_discarded_section): New function.
6514         (Symbol::has_plt_offset): Rewrite.
6515         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6516         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6517         Don't initialize is_target_special_ or has_plt_offset_.
6518         Initialize is_defined_in_discarded_section_.
6519         (Symbol_table::add_from_relobj): If appropriate, set
6520         is_defined_in_discarded_section.
6521         * resolve.cc (Symbol::override_base_with_special): Don't test
6522         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6523         * target-reloc.h (relocate_section): Do special handling for
6524         symbols defined in discarded sections for global symbols as well
6525         as local symbols.
6526
6527 2010-01-08  Ian Lance Taylor  <iant@google.com>
6528
6529         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6530         the SHT_SYMTAB case.
6531
6532 2010-01-08  Ian Lance Taylor  <iant@google.com>
6533
6534         * object.cc (Sized_relobj::do_layout): Don't get confused if
6535         layout_eh_frame returns NULL.
6536
6537 2010-01-08  Ian Lance Taylor  <iant@google.com>
6538
6539         PR 11084
6540         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6541         dynamic symbol table, use the normal symbol table.
6542         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6543         symbol table.
6544
6545 2010-01-08  Ian Lance Taylor  <iant@google.com>
6546
6547         PR 11072
6548         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6549         sections.
6550
6551 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6552
6553         * version.cc (print_version): Change to "Copyright 2010".
6554
6555 2010-01-08  Ian Lance Taylor  <iant@google.com>
6556
6557         PR 10287
6558         PR 11063
6559         * i386.cc (class Target_i386): Change return type of plt_section
6560         to be non-const.
6561         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6562         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6563         tls_desc_rel_ field.
6564         (Output_data_plt_i386::rel_tls_desc): New function.
6565         (Target_i386::rel_tls_desc_section): New function.
6566         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6567         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6568         R_386_TLS_DESC reloc in rel_tls_desc_section.
6569         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6570         Define struct Tlsdesc_info.
6571         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6572         (Target_x86_64::do_reloc_symbol_index): New function.
6573         (Target_x86_64::add_tlsdesc_info): New function.
6574         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6575         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6576         tlsdesc_rel_ field.
6577         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6578         all callers.
6579         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6580         (Target_x86_64::rela_tlsdesc_section): New function.
6581         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6582         handling.
6583         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6584         (Target_x86_64::do_reloc_addend): New function.
6585         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6586         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6587         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6588         (Output_reloc::type): New function.
6589         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6590         (Output_reloc::is_target_specific): New function.
6591         (Output_reloc::target_arg): New function.
6592         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6593         absolute relocs and target specific relocs.
6594         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6595         add_target_specific.
6596         (class Output_data_reloc) [SHT_RELA]: Likewise.
6597         * output.cc (Output_reloc::Output_reloc): Add four new versions
6598         for absolute relocs and target specific relocs.
6599         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6600         (Output_reloc::get_symbol_index): Likewise.
6601         (Output_reloc::local_section_offset): Check that local_sym_index_
6602         is not TARGET_CODE or 0.
6603         (Output_reloc::symbol_value): Likewise.
6604         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6605         reloc.
6606         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6607         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6608         functions.
6609         * layout.cc (add_target_dynamic_tags): Use output section for
6610         DT_PLTRELSZ and DT_JMPREL.
6611
6612 2010-01-07  Ian Lance Taylor  <iant@google.com>
6613
6614         PR 11061
6615         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6616         function.
6617         (class Output_data_reloc_generic): Define.
6618         (class Output_data_reloc_base): Change base class to
6619         Output_data_reloc_generic.  Change add() method to call
6620         bump_relative_reloc_count for a relative reloc.  Remove
6621         sort_relocs_ field.
6622         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6623         to sort_relocs().
6624         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6625         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6626         appropriate.
6627         * layout.h (class Layout): Update declaration.
6628
6629 2010-01-07  Ian Lance Taylor  <iant@google.com>
6630
6631         * output.h (class Output_data): Add const version of
6632         output_section and do_output_section.
6633         (class Output_section_data): Add const version of
6634         do_output_section.
6635         (class Output_section): Likewise.
6636         * layout.cc (Layout::add_target_dynamic_tags): New function.
6637         * layout.h (class Layout): Update declarations.
6638         * arm.cc (Target_arm::do_finalize_sections): Use
6639         add_target_dynamic_tags.
6640         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6641         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6642         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6643         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6644
6645 2010-01-07  Ian Lance Taylor  <iant@google.com>
6646
6647         PR 11042
6648         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6649         object as needed.
6650
6651 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6652             Ian Lance Taylor  <iant@google.com>
6653
6654         PR 11019
6655         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6656         Xindex::read_symtab_xindex.
6657
6658 2010-01-07  Doug Kwan  <dougkwan@google.com>
6659
6660         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6661         (Insn_template::thumb16_bcond_insn): New method declaration.
6662         (Insn_template): Fix spelling.
6663         (Stub::thumb16_special): New method declaration.
6664         (Stub::do_write): Define virtual method which was previously pure
6665         virtual.
6666         (Stub::do_thumb16_special): New method declaration.
6667         (Stub::do_fixed_endian_write): New template member.
6668         (Reloc_stub::do_write): Remove.
6669         (Reloc_stub::do_fixed_endian_write): Remove.
6670         (Cortex_a8_stub): New class definition.
6671         (Stub_factory::make_cortex_a8_stub): New method definition.
6672         (Stub_factory::Stub_factory): Add missing static storage class
6673         qualifier for elf32_arm_stub_a8_veneer_blx.
6674
6675 2010-01-07  Ian Lance Taylor  <iant@google.com>
6676
6677         PR 10980
6678         * options.h (class General_options): Add --warn-unresolved-symbols
6679         and --error-unresolved-symbols.
6680         * errors.cc (Errors::undefined_symbol): Implement
6681         --warn-unresolved-symbols.
6682
6683         * options.h (class General_options): Add -z text and -z textoff.
6684         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6685
6686 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6687
6688         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6689         (Garbage_collection::cident_sections): New function.
6690         (Garbage_collection::add_cident_section): New function.
6691         (Garbage_collection::cident_sections_): New member.
6692         (gc_process_relocs): Add references to sections whose names are C
6693         identifiers.
6694         * gold.h (cident_section_start_prefix): New constant.
6695         (cident_section_stop_prefix): New constant.
6696         (is_cident): New function.
6697         * layout.cc (Layout::define_section_symbols): Replace string constants
6698         with the newly defined constants.
6699         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6700         C identifiers.
6701         * testsuite/Makefile.am: Add gc_orphan_section_test.
6702         * testsuite/Makefile.in: Regenerate.
6703         * testsuite/gc_orphan_section_test.cc: New file.
6704         * testsuite/gc_orphan_section_test.sh: New file.
6705
6706 2010-01-06  Ian Lance Taylor  <iant@google.com>
6707
6708         PR 10980
6709         * options.h (class General_options): Add --warn-shared-textrel.
6710         * layout.cc (Layout::finish_dynamic_section): Implement
6711         --warn-shared-textrel.
6712
6713         PR 10980
6714         * options.h (class General_options): Add --warn-multiple-gp.
6715
6716 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6717
6718         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6719         $(THREADSLIB) and $(LIBDL).
6720         * Makefile.in: Rebuild.
6721
6722 2010-01-06  Ian Lance Taylor  <iant@google.com>
6723
6724         PR 10980
6725         * options.cc (General_options::parse_section_start): New function.
6726         (General_options::section_start): New function.
6727         (General_options::General_options): Initialize all members.
6728         * options.h: Include <map>
6729         (class General_options): Add --section-start.  Add section_starts_
6730         member.
6731         * layout.cc (Layout::attach_allocated_section_to_segment): If
6732         --section-start was used, set the address of the segment.  Remove
6733         local sort_sections.
6734         (Layout::relaxation_loop_body): If the address of the load segment
6735         has been set by --section-start, don't use it.
6736         * output.h (Output_segment::update_flags_for_output_section): New
6737         function.
6738         * output.cc (Output_segment::add_output_section): Call
6739         update_flags_for_output_section.
6740
6741 2010-01-05  Ian Lance Taylor  <iant@google.com>
6742
6743         PR 10980
6744         * options.h (class General_options): Add --undefined-version.
6745         * script.cc (struct Version_expression): Add was_matched_by_symbol
6746         field.
6747         (Version_script_info::matched_symbol): New function.
6748         (Version_script_info::get_symbol_version_helper): Call
6749         matched_symbol.
6750         (Version_script_info::check_unmatched_names): New function.
6751         * script.h (class Version_script_info): Update declarations.
6752         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6753
6754         * options.h (class General_options): Use DEFINE_bool_alias for
6755         allow_multiple_definition.
6756         * resolve.cc (Symbol_table::should_override): Don't test
6757         allow_multiple_definition.
6758
6759         PR 10980
6760         * options.h (class General_options): Add --cref.
6761         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6762         until after printing cref table.
6763         * cref.cc: Include "symtab.h".
6764         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6765         (Cref_table_compare::operator()): New function.
6766         (Cref_inputs::gather_cref): New function.
6767         (filecol): New static const.
6768         (Cref_inputs::print_cref): New function.
6769         (Cref::print_cref): New function.
6770         * cref.h: Include <cstdio>.
6771         (class Cref): Update declarations.
6772         * mapfile.h (Mapfile::file): New function.
6773         * object.h (class Object): Define Symbols.  Declare virtual
6774         do_get_global_symbols.
6775         (Object::get_global_symbols): New function.
6776         * object.cc (Input_objects::add_object): Pass object to cref_ if
6777         --cref.
6778         (Input_objects::archive_start): Likewise.
6779         (Input_objects::archive_stop): Likewise.
6780         (Input_objects::print_cref): New function.
6781         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6782         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6783         --cref.
6784         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6785         function.
6786         * plugin.h (class Sized_pluginobj): Update declarations.
6787
6788 2010-01-05  Ian Lance Taylor  <iant@google.com>
6789
6790         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6791         to is_default_version.  Rename insdef to insdefault.
6792         (Symbol_table::add_from_relobj): Rename def to is_default_version
6793         and local to is_forced_local.
6794         (Symbol_table::add_from_pluginobj): Likewise.
6795         (Symbol_table::add_from_dynobj): Likewise.
6796         (Symbol_table::define_special_symbol): Rename insdef to
6797         insdefault.
6798
6799 2010-01-04  Ian Lance Taylor  <iant@google.com>
6800
6801         PR 10980
6802         * options.h (class General_options): Add
6803         --allow-multiple-definition and -z muldefs.
6804         * resolve.cc (Symbol_table::should_override): Don't warn about a
6805         multiple symbol definition if --allow-multiple-definition or -z
6806         muldefs.
6807
6808         PR 10980
6809         * options.h (class General_options): Add --add-needed and
6810         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6811         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6812         error if --copy-dt-needed-entries aka --add-needed is used and
6813         would cause a change in behaviour.
6814
6815         PR 10980
6816         * options.h (class General_options): Add -G as a short version of
6817         --shared.  Add no-op options -assert, -g, and -i.
6818
6819 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6820
6821         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6822         check for .text or .gnu.linkonce.t sections.
6823         * icf.cc (Icf::find_identical_sections): Ditto.
6824         Change the detection for mangled function name within the section
6825         name.
6826         * icf.h (is_section_foldable_candidate): New function.
6827
6828 2009-12-30  Ian Lance Taylor  <iant@google.com>
6829
6830         PR 10980
6831         * options.h (class General_options): Permit two dashes with
6832         --retain-symbols-file.
6833
6834 2009-12-30  Ian Lance Taylor  <iant@google.com>
6835
6836         PR 10979
6837         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6838         don't put the file header and segment headers in the text
6839         segment.
6840
6841         PR 10979
6842         * common.cc (Sort_commons::operator()): Stabilize sort when both
6843         entries are NULL.
6844         (Symbol_table::do_allocate_commons_list): When allocating common
6845         symbols, skip a symbol which is no longer common.
6846         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6847         an object before checking its type.
6848         * testsuite/common_test_2.c: New file.
6849         * testsuite/common_test_3.c: New file.
6850         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6851         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6852         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6853         (common_test_2_pic.o, common_test_2.so): New targets.
6854         (common_test_3_pic.o, common_test_3.so): New targets.
6855         * testsuite/Makefile.in: Rebuild.
6856
6857         PR 10979
6858         * script.cc (read_input_script): If we see a new SECTIONS clause,
6859         and we have added an input section, give an error.
6860         * layout.h (class Layout): Add have_added_input_section function.
6861         Add have_added_input_section_ field.
6862         * layout.cc (Layout::Layout): Initialize
6863         have_added_input_section_.
6864         (Layout::layout): Set have_added_input_section_.
6865         (Layout::layout_eh_frame): Likewise.
6866
6867 2009-12-30  Ian Lance Taylor  <iant@google.com>
6868
6869         PR 10931
6870         * options.h (class General_options): Add --sort-common option.
6871         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6872         * common.cc (Sort_common): Add sort_order parameter to
6873         constructor.  Add sort_order_ field.
6874         (Sort_commons::operator): Check sort_order_.
6875         (Symbol_table::allocate_commons): Determine the sort order.
6876         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6877         Change all callers.
6878         (Symbol_table::do_allocate_commons_list): Likewise.
6879
6880 2009-12-30  Ian Lance Taylor  <iant@google.com>
6881
6882         PR 10916
6883         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6884         symbols from this object, don't change the visibility of an
6885         undefined symbol.
6886         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6887
6888 2009-12-30  Ian Lance Taylor  <iant@google.com>
6889
6890         PR 10861
6891         * script.h (class Version_script_info): Define Language enum.
6892         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6893         new fields globals_, locals_, and is_finalized_.
6894         * script.cc: Various formatting fixes.
6895         (class Parser_closure): Change language_stack_ from a vector of
6896         std::string to one of Version_script_info::Language.  Adjust all
6897         uses accordingly.
6898         (class Lazy_demangler): Remove.
6899         (struct Version_expression): Change language from std::string to
6900         Version_script_info::Language.
6901         (Version_script_info::Version_script_info): New function.
6902         (Version_script_info::~Version_script_info): Don't call clear.
6903         (Version_script_info::finalize): New function.
6904         (Version_script_info::build_lookup_tables): New function.
6905         (Version_script_info::build_expression_list_lookup): New
6906         function.
6907         (Version_script_info::get_symbol_version_helper): Rewrite to use
6908         lookup tables.
6909         (Version_script_info::print_expression_list): Adjust to use
6910         Version_script_info::Language.
6911         (script_push_lex_into_version_mode): Check that the version script
6912         has not been finalized.
6913         (version_script_push_lang): Change language string to
6914         Version_script_info::Language.
6915         * options.cc (Command_line::version_script): New function.
6916         * options.h (class General_options): Add finalize_dynamic_list
6917         function.  Change version_script from declaration to definition.
6918         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6919         * testsuite/version_script.map: Remove duplicate def of foo.
6920         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6921         version_script.map.
6922         * testsuite/Makefile.in: Rebuild.
6923
6924 2009-12-30  Ian Lance Taylor  <iant@google.com>
6925
6926         PR 10843
6927         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6928         if the input symbol index is 0, make the output symbol index 0.
6929
6930 2009-12-30  Ian Lance Taylor  <iant@google.com>
6931
6932         PR 10670
6933         * options.h (class General_options): Add -x/--discard-all.
6934         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6935         --discard-all.  If the local symbol needs a dynamic entry, check
6936         that before handling --discard-locals.
6937
6938 2009-12-30  Ian Lance Taylor  <iant@google.com>
6939
6940         PR 10450
6941         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6942         flags to PF_R.
6943         (Output_segment::add_output_section): Don't change the flags if
6944         the type is PT_TLS.
6945
6946         PR 10450
6947         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6948         GNU hash table if they need a dynamic value.  Otherwise, don't add
6949         them if they are defined in a dynamic object or are forced local.
6950
6951 2009-12-29  Ian Lance Taylor  <iant@google.com>
6952
6953         PR 10450
6954         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6955         .gnu.hash table for a 32-bit target.
6956
6957         PR 10450
6958         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6959         regular and a dynamic object only needs a dynamic symbol table
6960         entry if it is externally visible.
6961
6962         PR 10450
6963         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6964         constructor.  Add global_offset_table_ field.
6965         (Target_i386::got_section): Set global_offset_table_.
6966         (Target_i386::do_finalize_sections): Set global_offset_table_
6967         size.
6968         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6969         in constructor.  Add global_offset_table_ field.
6970         (Target_x86_64::got_section): Set global_offset_table_.
6971         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6972         size.
6973
6974         * layout.cc (Layout::Layout): Initialize increase_relro_.
6975         (Layout::get_output_section): Add is_relro, is_last_relro, and
6976         is_first_non_relro parameters.  Change all callers.
6977         (Layout::choose_output_section): Likewise.
6978         (Layout::add_output_section_data): Likewise.
6979         (Layout::make_output_section): Likewise.
6980         (Layout::set_segment_offsets): Clear increase_relro when using a
6981         linker script.
6982         * layout.h (class Layout): Add increase_relro method.  Add
6983         increase_relro_ field.  Update declarations.
6984         * output.cc (Output_section::Output_section): Initialize
6985         is_last_relro_ and is_first_non_relro_.
6986         (Output_segment::add_output_section): Group relro sections is
6987         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6988         (Output_segment::maximum_alignment): Remove relro handling.
6989         (Output_segment::set_section_addresses): Add increase_relro
6990         parameter.  Change all callers.  Add initial alignment to align
6991         relro sections on separate page.  Remove old relro handling.
6992         (Output_segment::set_section_list_addresses): Remove in_relro
6993         parameter.  Change all callers.
6994         (Output_segment::set_offset): Add increase parameter.  Change all
6995         callers.  Remove old relro handling.
6996         * output.h (class Output_section): Add new methods: is_last_relro,
6997         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6998         Add is_last_relro_ and is_first_non_relro_ fields.
6999         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7000         Create separate .got.plt section.  Call increase_relro.
7001         * x86_64.cc (Target_x86_64::got_section): Likewise.
7002         * testsuite/relro_script_test.t: Add .got.plt.
7003
7004         PR 10450
7005         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7006         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7007         (Layout::finalize): Call set_dynamic_symbol_size.
7008         (Layout::set_dynamic_symbol_size): New function.
7009         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7010         set_dynamic_symbol_size.
7011
7012         PR 10450
7013         * output.h (class Output_section): Add is_entsize_zero_ field.
7014         * output.cc (Output_section::Output_section): Initialize
7015         is_entsize_zero_.
7016         (Output_section::set_entsize): If two different entsizes are
7017         requested, force it to zero.
7018         (Output_section::add_input_section): Set flags for .debug_str
7019         before updating section flags.  Set entsize.
7020         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7021         and SHF_STRING if all input sections have those flags.
7022
7023 2009-12-29   Rafael Espindola  <espindola@google.com>
7024
7025         * main.cc (main): Fix the sys time reporting.
7026         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7027         reporting.
7028
7029 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7030
7031         * options.cc (General_options::parse_version): Allow -v to exit
7032         without an error if there is nothing to link.
7033
7034 2009-12-29  Ian Lance Taylor  <iant@google.com>
7035
7036         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7037         using a version of gcc before 4.1.
7038         * configure: Rebuild.
7039
7040 2009-12-28  Chris Demetriou  <cgd@google.com>
7041
7042         * attributes.cc (Output_attributes_section_data::do_write): Use
7043         std::vector::front rather than std::vector::data.
7044
7045 2009-12-28  Ian Lance Taylor  <iant@google.com>
7046
7047         * symtab.h (class Symbol_table): Add enum Defined.
7048         * resolve.cc (Symbol_table::should_override): Add defined
7049         parameter.  Change all callers.  Test whether object is NULL
7050         before calling a method on it.
7051         (Symbol_table::report_resolve_problem): Add defined parameter.
7052         Change all callers.
7053         (Symbol_table::should_override_with_special): Likewise.
7054         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7055         parameter.  Change all callers.
7056         (Symbol_table::do_define_in_output_data): Likewise.
7057         (Symbol_table::define_in_output_segment): Likewise.
7058         (Symbol_table::do_define_in_output_segment): Likewise.
7059         (Symbol_table::define_as_constant): Likewise.
7060         (Symbol_table::do_define_as_constant): Likewise.
7061         * script.h (class Symbol_assignment): Add is_defsym parameter to
7062         constructor; change all callers.
7063         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7064         parameter.  Change all callers.  Add is_defsym_ field.
7065         (class Parser_closure): Add parsing_defsym parameter to
7066         constructor; change all callers.  Add parsing_defsym accessor
7067         function.  Add parsing_defsym_ field.
7068
7069 2009-12-28  Ian Lance Taylor  <iant@google.com>
7070
7071         * gold.cc (queue_middle_tasks): Fix formatting.
7072         * object.cc (Relobj::is_section_name_included): Likewise.
7073
7074 2009-12-23  Ian Lance Taylor  <iant@google.com>
7075
7076         * i386.cc (Target_i386::do_calls_non_split): Recognize
7077         -fsplit-stack prologue for a function with a static chain.
7078         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7079         -fsplit-stack prologue when using %r11.
7080
7081 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7082
7083         * options.cc (General_options::parse_version): Make -v continue and do
7084         the link like GNU ld does.
7085
7086 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7087
7088         * Makefile.am (CCFILES): Add timer.cc.
7089         (HFILES): Add timer.h.
7090         * configure.ac: Check for sysconf and times.
7091         * main.cc: include timer.h.
7092         (main): Use Timer instead of get_run_time.
7093         * timer.cc: New.
7094         * timer.h: New.
7095         * workqueue.cc: include timer.h.
7096         (Workqueue::find_and_run_task):
7097         Report user, sys and wall time.
7098         * Makefile.in: Regenerate.
7099         * config.in: Regenerate.
7100         * configure: Regenerate.
7101
7102 2009-12-16  Doug Kwan  <dougkwan@google.com>
7103
7104         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7105         sections.
7106         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7107         relaxed input sections.
7108         * output.cc (Output_section::find_relaxed_input_section): Change
7109         return type to Output_relaxed_input_section pointer.  Adjust code
7110         for new type of relaxed_input_section_map_.
7111         * output.h (Output_section::find_relaxed_input_section): Change
7112         return type to Output_relaxed_input_section pointer.
7113         (Output_section::Output_relaxed_input_section_by_input_section_map):
7114         New type.
7115         (Output_section::relaxed_input_section_map_): Change type to
7116         Output_section::Output_relaxed_input_section_by_input_section_map.
7117         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7118         input section.
7119
7120 2009-12-15  Ian Lance Taylor  <iant@google.com>
7121
7122         * layout.cc (Layout::create_shstrtab): Only write out after input
7123         sections if we are compressing debug sections.
7124
7125 2009-12-15  Ian Lance Taylor  <iant@google.com>
7126
7127         * archive.cc (Archive::add_symbols): Only look up a symbol without
7128         a version if there is, in fact, a version.
7129
7130 2009-12-14  Ian Lance Taylor  <iant@google.com>
7131
7132         Revert -Wshadow changes, all changes from:
7133         2009-12-11  Doug Kwan  <dougkwan@google.com>
7134         2009-12-11  Nick Clifton  <nickc@redhat.com>
7135         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7136
7137 2009-12-11  Doug Kwan  <dougkwan@google.com>
7138
7139         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7140         due to -Wshadow.
7141         * attributes.cc (Object_attribute::size): Ditto.
7142         (Attributes_section_data::size): Ditto.
7143         (Attributes_section_data::Attributes_section_data): Ditto.
7144         (Output_attributes_section_data::do_write): Ditto.
7145         * attributes.h (Object_attribute::set_type): Ditto.
7146         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7147
7148 2009-12-11  Nick Clifton  <nickc@redhat.com>
7149
7150         * archive.cc: Fix shadowed variable warnings.
7151         * arm.cc: Likewise.
7152         * compressed_output.cc: Likewise.
7153         * compressed_output.h: Likewise.
7154         * configure: Likewise.
7155         * dwarf_reader.cc: Likewise.
7156         * dynobj.cc: Likewise.
7157         * dynobj.h: Likewise.
7158         * ehframe.cc: Likewise.
7159         * ehframe.h: Likewise.
7160         * errors.cc: Likewise.
7161         * expression.cc: Likewise.
7162         * fileread.cc: Likewise.
7163         * fileread.h: Likewise.
7164         * freebsd.h: Likewise.
7165         * i386.cc: Likewise.
7166         * icf.cc: Likewise.
7167         * incremental.h: Likewise.
7168         * layout.cc: Likewise.
7169         * layout.h: Likewise.
7170         * mapfile.cc: Likewise.
7171         * merge.cc: Likewise.
7172         * merge.h: Likewise.
7173         * object.cc: Likewise.
7174         * object.h: Likewise.
7175         * options.h: Likewise.
7176         * output.cc: Likewise.
7177         * output.h: Likewise.
7178         * parameters.cc: Likewise.
7179         * plugin.cc: Likewise.
7180         * powerpc.cc: Likewise.
7181         * reduced_debug_output.cc: Likewise.
7182         * reduced_debug_output.h: Likewise.
7183         * reloc.cc: Likewise.
7184         * reloc.h: Likewise.
7185         * resolve.cc: Likewise.
7186         * script-sections.cc: Likewise.
7187         * script.cc: Likewise.
7188         * script.h: Likewise.
7189         * sparc.cc: Likewise.
7190         * symtab.cc: Likewise.
7191         * symtab.h: Likewise.
7192         * target-select.cc: Likewise.
7193         * target-select.h: Likewise.
7194         * token.h: Likewise.
7195         * workqueue.cc: Likewise.
7196         * workqueue.h: Likewise.
7197         * x86_64.cc: Likewise.
7198
7199 2009-12-10  Doug Kwan  <dougkwan@google.com>
7200
7201         * arm.cc (attributes.h): New include.
7202         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7203         (Arm_relobj::~Arm_relobj): Delete object pointed by
7204         attributes_section_data_.
7205         (Arm_relobj::attributes_section_data): New method definition.
7206         (Arm_relobj::attributes_section_data_): New data member declaration.
7207         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7208         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7209         attributes_section_data_.
7210         (Arm_dynobj::attributes_section_data): New method definition.
7211         (Arm_dynobj::attributes_section_data_): New data member declaration.
7212         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7213         initialization value of may_use_blx_ to false.
7214         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7215         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7216         object attributes to compute results instead of hard-coding.
7217         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7218         Target_arm::get_secondary_compatible_arch,
7219         Target_arm::set_secondary_compatible_arch
7220         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7221         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7222         New method declarations.
7223         (Target_arm::get_aeabi_object_attribute): New method definition.
7224         (Target_arm::attributes_section_data_): New data member declaration.
7225         (read_arm_attributes_section): New template definition.
7226         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7227         (Arm_dynobj::do_read_symbols): Ditto.
7228         (Target_arm::do_finalize_sections): Merge attributes sections from
7229         input.  Check for BLX use after attributes section merging.
7230         Fix __exidx_start and __exidx_end visibility.  Create an
7231         .ARM.attributes section if necessary.
7232         (Target_arm::get_secondary_compatible_arch,
7233         Target_arm::set_secondary_compatible_arch,
7234         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7235         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7236         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7237         New method definitions.
7238
7239 2009-12-09  Ian Lance Taylor  <iant@google.com>
7240
7241         * plugin.cc (Plugin::load): Don't cast from void* to a function
7242         pointer.
7243
7244 2009-12-09  Ian Lance Taylor  <iant@google.com>
7245
7246         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7247         information fields.
7248
7249 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7250
7251         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7252         Replace two_file_shared_1.so with two_file_shared_2.so.
7253         * testsuite/Makefile.in: Regenerated.
7254
7255 2009-12-08  Doug Kwan  <dougkwan@google.com>
7256
7257         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7258         (HFILES): Add attributes.h and int_encoding.h.
7259         * Makefile.in: Regenerate.
7260         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7261         function definitions to int_encoding.cc
7262         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7263         prototypes to int_encoding.h
7264         * reduced_debug_output.cc (int_encoding.h): New include.
7265         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7266         function definitions to int_encoding.cc
7267         (insert_into_vector, read_from_pointer): Move template definitions to
7268         int_encoding.h
7269         * attributes.cc: New file.
7270         * attributes.h: New file.
7271         * int_encoding.cc: New file.
7272         * int_encoding.h: New file.
7273
7274 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7275
7276         PR gold/11055
7277         * incremental-dump.cc (dump_incremental_inputs): New.
7278         (main): Use dump_incremental_inputs.
7279
7280 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7281
7282         PR gold/10893
7283         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7284         checking elfcpp::STT_FUNC.
7285         (Target_i386::Relocate::relocate): Likewise.
7286         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7287
7288         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7289         symbols from shared libraries into normal FUNC symbols.
7290
7291         * symtab.h (Symbol): Add is_func and use it.
7292
7293 2009-12-05  Doug Kwan  <dougkwan@google.com>
7294
7295         * arm.cc (Target_arm::arm_info): Initialize new fields
7296         attributes_section and attributes_vendor.
7297         * i386.cc (Target_i386::i386_info): Same.
7298         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7299         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7300         fields attributes_section and attributes_vendor.
7301         * sparc.cc (Target_sparc::sparc_info): Same.
7302         * target.h (Target::attributes_section, Target::attributes_vendor,
7303         Target::is_attributes_section, Target::attribute_arg_type,
7304         Target::attributes_order): New method definitions.
7305         (Target::Target_info::attributes_section,
7306         Target::Target_info::attributes_vendor): New fields.
7307         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7308         virtual method definitions.
7309         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7310         attributes_section and attributes_vendor.
7311         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7312
7313 2009-12-05  Doug Kwan  <dougkwan@google.com>
7314
7315         * arm.cc: Update comments about interworking and stub generation.
7316         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7317         considered as non-PIC.
7318         (Arm_relocate_functions::base_abs): Fix formatting.
7319         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7320         of function to use GOT entry address instead of offset.
7321         (Target_arm::Scan::global): Issue an error if a symbol would need a
7322         PLT does not get one because it is untyped.  Remove code to create
7323         dynamic symbols for relative branches.
7324         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7325         takes unsigned integer instead of boolean.
7326
7327 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7328
7329         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7330         (two_file_test_LDADD): Likewise.
7331         (common_test_1_LDADD): Likewise.
7332         (exception_test_LDADD) Likewise.
7333         (weak_test_LDADD): Likewise.
7334         (many_sections_test_LDADD): Likewise.
7335         (initpri1_LDADD): Likewise.
7336         (script_test_1_LDADD): Likewise.
7337         (script_test_2_LDADD): Likewise.
7338         (justsyms_LDADD): Likewise.
7339         (binary_test_LDADD): Likewise.
7340         (large_LDADD): Likewise.
7341         * testsuite/Makefile.in: Regenerated.
7342
7343 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7344
7345         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7346         (Symbol_table::override_with_special): Likewise.
7347         (Symbol_table::add_from_object): Likewise.
7348
7349 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7350
7351         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7352         Don't set the data_offset twice.
7353
7354 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7355
7356         * testsuite/Makefile.in: Regenerate.
7357
7358 2009-12-03  Doug Kwan  <dougkwan@google.com>
7359
7360         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7361         (Target_arm::do_finalize_sections): Add parameter for symbol table
7362         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7363         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7364         parameter for symbol table pointer.
7365         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7366         an additional parameter for a pointer to symbol table.
7367         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7368         parameter for a symbol table pointer.
7369         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7370         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7371         Ditto.
7372         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7373         parameter for a symbol table pointer.
7374
7375 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7376
7377         * incremental.cc (Incremental_inputs_header)
7378         (Incremental_inputs_header_write, Incremental_inputs_entry)
7379         (Incremental_inputs_entry_write): Move ...
7380         * incremental.h (Incremental_inputs_header)
7381         (Incremental_inputs_header_write, Incremental_inputs_entry)
7382         (Incremental_inputs_entry_write): here.
7383
7384 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7385
7386         * incremental.cc (make_sized_incremental_binary): Set the target.
7387         Error if it is incompatible.
7388         * output.h (Output_file): Add filename method.
7389
7390 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7391
7392         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7393         from the get_* methods.
7394
7395 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7396
7397         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7398         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7399         Write 0 for the data_offset of scripts.
7400
7401 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7402
7403         * testsuite/Makefile.am: Add the incremental_test.sh test.
7404         * testsuite/incremental_test.sh: New.
7405         * testsuite/incremental_test_1.c: New.
7406         * testsuite/incremental_test_2.c: New.
7407
7408 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7409
7410        * incremental-dump.cc (main): Fix typos.
7411
7412 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7413
7414         PR gold/11025
7415         * incremental-dump.cc (main): Use llu to print 64 bit values.
7416
7417 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7418             H.J. Lu  <hongjiu.lu@intel.com>
7419
7420         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7421         $(LIBDL).
7422         (incremental_dump_LDADD): Likewise.
7423         * Makefile.in: Regenerated.
7424
7425 2009-11-25  Doug Kwan  <dougkwan@google.com>
7426
7427         Revert:
7428
7429         2009-11-25  Doug Kwan  <dougkwan@google.com>
7430
7431                 * arm.cc (Target_arm::Target_arm): Move method definition
7432                 outside of class definition.  Add code to handle
7433                 --target1-rel, --target1-abs and --target2= options.
7434                 (Target_arm::get_reloc_reloc_type): Change method to be
7435                 non-static and const.
7436                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7437                 New data member declaration.
7438                 (Target_arm::Scan::local, Target_arm::Scan::global,
7439                 Target_arm::Relocate::relocate,
7440                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7441                 Adjust call to Target_arm::get_real_reloc_type.
7442                 (Target_arm::get_real_reloc_type): Use command line options
7443                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7444                 * options.h (--target1-rel, --target1-abs, --target2): New
7445                 ARM-only options.
7446
7447 2009-11-25  Doug Kwan  <dougkwan@google.com>
7448
7449         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7450         class definition.  Add code to handle --target1-rel, --target1-abs
7451         and --target2= options.
7452         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7453         and const.
7454         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7455         member declaration.
7456         (Target_arm::Scan::local, Target_arm::Scan::global,
7457         Target_arm::Relocate::relocate,
7458         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7459         call to Target_arm::get_real_reloc_type.
7460         (Target_arm::get_real_reloc_type): Use command line options to
7461         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7462         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7463         options.
7464
7465 2009-11-25  Doug Kwan  <dougkwan@google.com>
7466
7467         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7468         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7469         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7470         formatting.
7471         (Arm_relocate_functions::thm_call): Replace body with a call to
7472         Arm_relocate_functions::thumb_branch_common.
7473         (Arm_relocate_functions::thm_jump24,
7474         Arm_relocate_functions::thm_xpc22): New method definitions.
7475         (Arm_relocate_functions::thumb_branch_common): New method definition.
7476         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7477         operator.
7478         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7479         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7480
7481 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7482
7483         * Makefile.am: Build incremental-dump
7484         * Makefile.in: Regenerate.
7485         * incremental-dump.cc: New.
7486         * incremental.cc (Incremental_inputs_header_data,
7487         Incremental_inputs_entry_data): Move to incremental.h
7488         * incremental.h: (Incremental_inputs_header_data,
7489         Incremental_inputs_entry_data): Move from incremental.cc
7490
7491 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7492
7493         * incremental.cc (Incremental_inputs_header,
7494         Incremental_inputs_header_write, Incremental_inputs_entry,
7495         Incremental_inputs_entry_write): Add a typedef with the data type.
7496
7497 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7498
7499         * incremental.cc (Incremental_inputs_header,
7500         Incremental_inputs_header_write, Incremental_inputs_entry,
7501         Incremental_inputs_entry_write): Update comment about which
7502         type has the filed descriptions.
7503
7504 2009-11-15  Doug Kwan  <dougkwan@google.com>
7505
7506         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7507         (Arm_relocate_functions::arm_branch_common): Change method defintion
7508         in class definition to a method declaration and update list of formal
7509         parameters.
7510         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7511         Arm_relocation_functions::jump24): Adjust call to
7512         Arm_relocate_functions::arm_branch_common.  Update list of formal
7513         parameters.
7514         (Arm_relocate_functions::xpc25): New method definition.
7515         (Arm_relocate_functions::arm_branch_common): Move method defintion
7516         out from class definition.  Use stubs for mode-switching and extending
7517         branch ranges.
7518         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7519         specially.  Change code to enable use of stubs in ARM branches.
7520
7521 2009-11-10  Doug Kwan  <dougkwan@google.com>
7522
7523         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7524         in method declaration.
7525         (Target_arm::relocate_stub): New method declaration.
7526         (Target_arm::default_target): Change to return a pointer instead of
7527         a const reference.
7528         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7529         Target_arm::default_target.
7530         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7531         method definition.
7532         (Target_arm::relocate_section): Adjust view.
7533         (Target_arm::relocate_stub): New method definition.
7534
7535 2009-11-10  Doug Kwan  <dougkwan@google.com>
7536
7537         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7538         a format warning.
7539         * incremental.cc (open_incremental_binary): Initialized local
7540         variables to avoid warnings.
7541         * object.cc (make_elf_object): Ditto.
7542         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7543         a format warning.
7544
7545 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7546
7547         PR gold/10930
7548         * testsuite/plugin_test.c: Include "config.h".
7549
7550 2009-11-09  Doug Kwan  <dougkwan@google.com>
7551
7552         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7553         (arm_symbol_value): Remove.
7554         (Arm_relocate_functions::arm_branch_common,
7555         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7556         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7557         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7558         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7559         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7560         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7561         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7562         Arm_relocate_functions::thm_mobw_abs_nc,
7563         Arm_relocate_functions::thm_mov_abs,
7564         Arm_relocate_functions::movw_prel_nc,
7565         Arm_relocate_functions::thm_movt_abs,
7566         Arm_relocate_functions::movt_prel,
7567         Arm_relocate_functions::thm_movw_prel_nc,
7568         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7569         (Target_arm::Relocate::relocate): Only decompose address into two
7570         parts if relocation type uses the thumb-bit and pass the actual
7571         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7572         calls to methods in Arm_relocate_functions for this change.
7573
7574 2009-11-08  Ian Lance Taylor  <iant@google.com>
7575
7576         PR 10925
7577         * reloc.cc: Instantiate
7578         Sized_relobj::initialize_input_to_output_maps and
7579         Sized_relobj:free_input_to_output_maps.
7580
7581 2009-11-06  Ian Lance Taylor  <iant@google.com>
7582
7583         PR 10876
7584         * defstd.cc (in_segment): Set only_if_ref true for "end".
7585
7586 2009-11-06  Doug Kwan  <dougkwan@google.com>
7587
7588         * arm.cc (class Reloc_stub): Correct a comment.
7589         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7590         (Target_arm::scan_section_for_stubs): New method declaration.
7591         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7592         Change methods from private to protected.
7593         (Target_arm::do_may_relax): New method definition.
7594         (Target_arm::do_relax, Target_arm::group_sections,
7595         Target_arm::scan_reloc_for_stub,
7596         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7597         (Target_arm::arm_input_section_map_): New data member declaration.
7598         (Target_arm::scan_reloc_for_stub,
7599         Target_arm::scan_reloc_section_for_stubs,
7600         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7601         Target_arm::do_relax): New method definitions.
7602
7603 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7604
7605         * configure.ac: Check for (struct stat)::st_mtim
7606         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7607         * config.in: Regenerate.
7608         * configure: Regenerate.
7609
7610 2009-11-05  Ian Lance Taylor  <iant@google.com>
7611
7612         PR 10910
7613         * output.cc (Output_segment::add_output_section): Add missing
7614         return statement.
7615
7616 2009-11-04  Ian Lance Taylor  <iant@google.com>
7617
7618         PR 10880
7619         * object.h (class Object): Add is_needed and set_is_needed
7620         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7621         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7622         defined in a dynamic object and referenced by a regular object,
7623         set is_needed for the dynamic object.
7624         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7625         if the file is marked with as_needed and it is not needed.
7626
7627 2009-11-04  Ian Lance Taylor  <iant@google.com>
7628
7629         PR 10887
7630         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7631         tags if data is discarded by linker script.
7632         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7633         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7634         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7635         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7636
7637 2009-11-04  Ian Lance Taylor  <iant@google.com>
7638
7639         * layout.cc (Layout::get_output_section): Add is_interp and
7640         is_dynamic_linker_section parameters.  Change all callers.
7641         (Layout::choose_output_section): Likewise.
7642         (Layout::make_output_section): Likewise.
7643         (Layout::add_output_section_data): Add is_dynamic_linker_section
7644         parameter.  Change all callers.
7645         * layout.h (class Layout): Update declarations.
7646         * output.h (class Output_section): Add is_interp, set_is_interp,
7647         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7648         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7649         generate_code_fills_at_write_ to a bitfield.
7650         * output.cc (Output_section::Output_sections): Initialize new
7651         fields.
7652         (Output_segment::add_output_section): Add do_sort parameter.
7653         Change all callers.
7654
7655 2009-11-03  Ian Lance Taylor  <iant@google.com>
7656
7657         PR 10860
7658         * options.h (class General_options): Add --warn-common.
7659         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7660         merging two common symbols.
7661         (Symbol_table::should_override): Handle --warn-common when merging
7662         a common symbol with a defined symbol.  Use report_resolve_problem
7663         for multiple definitions.
7664         (Symbol_table::report_resolve_problem): New function.
7665         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7666
7667 2009-11-03  Doug Kwan  <dougkwan@google.com>
7668
7669         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7670         stub_factory_.
7671         (Target_arm::stub_factory): New method definition.
7672         (Target_arm::new_arm_input_section,
7673         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7674         Target_arm::reloc_uses_thumb_bit): New method declarations.
7675         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7676         New type definitions.
7677         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7678         member declarations.
7679         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7680         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7681         New method definitions.
7682
7683 2009-11-03  Ian Lance Taylor  <iant@google.com>
7684
7685         * options.h (class General_options): Add --warn_constructors.
7686
7687 2009-11-03  Ian Lance Taylor  <iant@google.com>
7688
7689         PR 10893
7690         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7691         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7692
7693 2009-11-03  Ian Lance Taylor  <iant@google.com>
7694
7695         PR 10895
7696         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7697         --msgid-bugs-address.
7698         (install-pdf): New target.
7699         (install-data_yes): Look up one directory to find mkinstalldirs.
7700
7701 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7702
7703         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7704         tree.
7705
7706 2009-10-30  Doug Kwan  <dougkwan@google.com>
7707
7708         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7709
7710 2009-10-30  Doug Kwan  <dougkwan@google.com>
7711
7712         * arm.cc (Stub_addend_reader): New struct template definition
7713         and partial specializations.
7714         (Stub_addend_reader::operator()): New method definition for a
7715         partially specialized template.
7716
7717 2009-10-30  Doug Kwan  <dougkwan@google.com>
7718
7719         * arm.cc (Arm_relobj::processor_specific_flags): New method
7720         definition.
7721         (Arm_relobj::do_read_symbols): New method declaration.
7722         (Arm_relobj::processor_specific_flags_): New data member declaration.
7723         (Arm_dynobj): New class definition.
7724         (Target_arm::do_finalize_sections): Add input_objects parameter.
7725         (Target_arm::do_adjust_elf_header): New method declaration.
7726         (Target_arm::are_eabi_versions_compatible,
7727         (Target_arm::merge_processor_specific_flags): New method declaration.
7728         (Target_arm::do_make_elf_object): New overloaded method definitions
7729         and declaration.
7730         (Arm_relobj::do_read_symbols): New method definition.
7731         (Arm_dynobj::do_read_symbols): Ditto.
7732         (Target_arm::do_finalize_sections): Add input_objects parameters.
7733         Merge processor-specific flags from all input objects.
7734         (Target_arm::are_eabi_versions_compatible,
7735         Target_arm::merge_processor_specific_flags,
7736         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7737         New method definitions.
7738         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7739         Input_objects pointer type parameter.
7740         * layout.cc (Layout::finalize): Pass input objects to target's.
7741         finalize_sections function.
7742         * output.cc (Output_file_header::do_sized_write): Set ELF file
7743         header's processor-specific flags.
7744         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7745         Input_objects pointer type parameter.
7746         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7747         * target.h (Input_objects): New forward class declaration.
7748         (Target::processor_specific_flags,
7749         Target::are_processor_specific_flags_sect): New method definitions.
7750         (Target::finalize_sections): Add input_objects parameter.
7751         (Target::Target): Initialize processor_specific_flags_ and
7752         are_processor_specific_flags_set_.
7753         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7754         parameter.
7755         (Target::set_processor_specific_flags): New method definition.
7756         (Target::processor_specific_flags_,
7757         Target::are_processor_specific_flags_set_): New data member
7758         declarations.
7759         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7760         Input_objects pointer type parameter.
7761
7762 2009-10-30  Doug Kwan  <dougkwan@google.com>
7763
7764         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7765
7766 2009-10-28  Ian Lance Taylor  <iant@google.com>
7767
7768         * object.h (class Relobj): Drop options parameter from
7769         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7770         do_scan_relocs, do_relocate.  Change all callers.
7771         (class Sized_relobj): Drop options parameters from
7772         do_gc_process_relocs, do_scan_relocs, do_relocate,
7773         do_relocate_sections, relocate_sections, emit_relocs_scan,
7774         emit_relocs_scan_reltype.  Change all callers.
7775         (struct Relocate_info): Remove options field and all references to
7776         it.
7777         * reloc.h (class Read_relocs): Remove options constructor
7778         parameter and options_ field.  Change all callers.
7779         (class Gc_process_relocs, class Scan_relocs): Likewise.
7780         (class Relocate_task): Likewise.
7781         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7782         all callers.
7783         (scan_relocatable_relocs): Likewise.
7784         * target.h (class Sized_target): Remove options parameter from
7785         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7786         all callers.
7787         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7788         callers.
7789         * arm.cc: Update functions to remove options parameters.
7790         * i386.cc: Likewise.
7791         * powerpc.cc: Likewise.
7792         * sparc.cc: Likewise.
7793         * x86_64.cc: Likewise.
7794         * testsuite/testfile.cc: Likewise.
7795
7796 2009-10-28  Doug Kwan  <dougkwan@google.com>
7797
7798         * arm.cc (Arm_relobj): New class definition.
7799         (Arm_relobj::scan_sections_for_stubs,
7800         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7801         New method definitions.
7802
7803 2009-10-28  Cary Coutant  <ccoutant@google.com>
7804
7805         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7806         (Plugin::cleanup_done_): New member.
7807         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7808         (Plugin_manager::cleanup_done_): Remove.
7809         (Plugin_manager::add_input_file): Edit error message.
7810         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7811         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7812
7813 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7814
7815         * fileread.cc: (File_read::View::~View): Use the new
7816         data_ownership_ filed.
7817         (File_read::~File_read): Dispose the new whole_file_view_.
7818         (File_read::open): Mmap the whole file if needed.
7819         (File_read::open): Use whole_file_view_ instead of contents_.
7820         (File_read::find_view): Use whole_file_view_ if applicable.
7821         (File_read::do_read): Use whole_file_view_ instead of contents_.
7822         (File_read::make_view): Use whole_file_view_ instead of contents_,
7823         update File_read::View::View call.
7824         (File_read::find_or_make_view): Update File_read::View::View
7825         call.
7826         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7827         remove contents_
7828         (File_read::View::Data_ownership): New enum.
7829         (File_read::View::View): Replace bool mapped_ with Data_ownership
7830         argument.
7831         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7832         (File_read::View::data_ownership_): New field.
7833         (File_read::contents_): Remove (replaced by whole_file_view_).
7834         (File_read::whole_file_view_): New field.
7835         * options.h (class General_options): Add --keep-files-mapped.
7836
7837 2009-10-27  Cary Coutant  <ccoutant@google.com>
7838
7839         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7840         * testsuite/Makefile.am (plugin_test_5): New test case.
7841         * testsuite/Makefile.in: Regenerate.
7842
7843 2009-10-25  Doug Kwan  <dougkwan@google.com>
7844
7845         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7846         from private to protected to allow access by child class.
7847         (Sized_relobj::do_relocate_sections): New method declaration.
7848         (Sized_relobj::relocate_sections): Virtualize.
7849         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7850         Sized_relobj::relocate_sections.  Instantiate template explicitly
7851         for different target sizes and endianity.
7852
7853 2009-10-24  Doug Kwan  <dougkwan@google.com>
7854
7855         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7856         (Arm_input_section::as_arm_input_section): New method.
7857         (Arm_output_section): New class definition.
7858         (Arm_output_section::create_stub_group,
7859         Arm_output_section::group_sections): New method definitions.
7860
7861 2009-10-22  Doug Kwan  <dougkwan@google.com>
7862
7863         * arm.cc (Arm_input_section): New class definition.
7864         (Arm_input_section::init, Arm_input_section:do_write,
7865         Arm_input_section::set_final_data_size,
7866         Arm_input_section::do_reset_address_and_file_offset): New method
7867         definitions.
7868
7869 2009-10-21  Doug Kwan  <dougkwan@google.com>
7870
7871         * arm.cc (Stub_table, Arm_input_section): New forward class
7872         declarations.
7873         (Stub_table): New class defintion.
7874         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7875         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7876         New method definition.
7877
7878 2009-10-21  Doug Kwan  <dougkwan@google.com>
7879
7880         * arm.cc: Update copyright comments.
7881         (Target_arm): New forward class template declaration.
7882         (Arm_address): New type.
7883         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7884         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7885         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7886         constants.
7887         (Insn_template): Same.
7888         (DEF_STUBS): New macro.
7889         (Stub_type): New enum type.
7890         (Stub_template): New class definition.
7891         (Stub): Same.
7892         (Reloc_stub): Same.
7893         (Stub_factory): Same.
7894         (Target_arm::Target_arm): Initialize may_use_blx_ and
7895         should_force_pic_veneer_.
7896         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7897         Target_arm::should_force_pic_veneer,
7898         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7899         Target_arm::using_thumb_only, Target_arm:;default_target): New
7900         method defintions.
7901         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7902         New data member declarations.
7903         (Insn_template::size, Insn_template::alignment): New method defintions.
7904         (Stub_template::Stub_template): New method definition.
7905         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7906         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7907         (Stub_factory::Stub_factory): New method definition.
7908         * gold.h (string_hash): New template.
7909         * output.h (Input_section_specifier::hash_value): Use
7910         gold::string_hash.
7911         (Input_section_specifier::string_hash): Remove.
7912         * stringpool.cc (Stringpool_template::string_hash): Use
7913         gold::string_hash.
7914
7915 2009-10-20  Doug Kwan  <dougkwan@google.com>
7916
7917         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7918         symbols of relaxed input sections.
7919         * output.h (Output_section::find_relaxed_input_section): Make
7920         method public.
7921
7922 2009-10-16  Doug Kwan  <dougkwan@google.com>
7923
7924         * dynobj.cc (Versions::Versions): Initialize version_script_.
7925         Only insert base version symbol definition for a shared object
7926         if version script defines any version versions.
7927         (Versions::define_base_version): New method definition.
7928         (Versions::add_def): Check that base version is not needed.
7929         (Versions::add_need): Define base version lazily.
7930         * dynobj.h (Versions::define_base_version): New method declaration.
7931         (Versions::needs_base_version_): New data member declaration.
7932         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7933         (check_DATA): Add no_version_test.stdout.
7934         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7935         New make rules.
7936         * testsuite/Makefile.in: Regenerate.
7937         * testsuite/no_version_test.c: New file.
7938         * testsuite/no_version_test.sh: Ditto.
7939
7940 2009-10-16  Doug Kwan  <dougkwan@google.com>
7941
7942         * expression.cc (class Segment_start_expression): New class definition.
7943         (Segment_start_expression::value): New method definition.
7944         (script_exp_function_segment_start): Return a new
7945         Segment_start_expression.
7946         * gold/script-c.h (script_saw_segment_start_expression): New function
7947         prototype.
7948         * script-sections.cc (Script_sections::Script_sections): Initialize
7949         SAW_SEGMENT_START_EXPRESSION_ to false.
7950         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7951         and -Tbbs options to specify section addresses if given in
7952         command line and no SEGMENT_START expression is seen in a script.
7953         * script-sections.h (Script_sections::saw_segment_start_expression,
7954         Script_sections::set_saw_segment_start_expression): New method
7955         definition.
7956         (Script_sections::saw_segment_start_expression_): New data member
7957         declaration.
7958         * script.cc (script_saw_segment_start_expression): New function.
7959         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7960         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7961         script_test_7.sh and script_test_8.sh.
7962         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7963         script_test_8.stdout.
7964         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7965         (script_test_6, script_test_6.stdout, script_test_7,
7966         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7967         * Makefile.in: Regenerate.
7968         * testsuite/script_test_6.sh: New file.
7969         * testsuite/script_test_6.t: Same.
7970         * testsuite/script_test_7.sh: Same.
7971         * testsuite/script_test_7.t: Same.
7972         * testsuite/script_test_8.sh: Same.
7973
7974 2009-10-16  Doug Kwan  <dougkwan@google.com>
7975
7976         * output.cc (Output_segment::set_section_list_address): Cast
7977         expressions to unsigned long long type to avoid format warnings.
7978
7979 2009-10-15  Ian Lance Taylor  <iant@google.com>
7980
7981         * script.cc (Script_options::add_symbol_assignment): Always add a
7982         dot assignment to script_sections_.
7983         * script-sections.cc (Script_sections::add_dot_assignment):
7984         Initialize if necessary.
7985
7986         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7987         program headers with no load segment if there is a linker script.
7988
7989         * layout.cc (Layout::set_segment_offsets): Align the file offset
7990         to the segment aligment for -N or -n with no load segment.
7991         * output.cc (Output_segment::add_output_section): Don't crash if
7992         the first section is a TLS section.
7993         (Output_segment::set_section_list_addresses): Print an error
7994         message if the address moves backward in a linker script.
7995         * script-sections.cc
7996         (Output_section_element_input::set_section_addresses): Don't
7997         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7998         (Orphan_output_section::set_section_addresses): Likewise.
7999
8000 2009-10-15  Doug Kwan  <dougkwan@google.com>
8001
8002         * layout.cc (Layout::finish_dynamic_section): Generate tags
8003         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8004         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8005         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8006
8007 2009-10-14  Ian Lance Taylor  <iant@google.com>
8008
8009         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8010         fields.
8011         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8012         data_shdr fields of relinfo.
8013         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8014         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8015         R_386_TLS_LDO_32, adjust based on section flags.
8016         (Target_i386::Relocate::fix_up_ldo): Remove.
8017
8018 2009-10-13  Ian Lance Taylor  <iant@google.com>
8019
8020         Add support for -pie.
8021         * options.h (class General_options): Add -pie and
8022         --pic-executable.
8023         (General_options::output_is_position_independent): Test -pie.
8024         (General_options::output_is_executable): Return true if not shared
8025         and not relocatable.
8026         (General_options::output_is_pie): Remove.
8027         * options.cc (General_options::finalize): Reject incompatible uses
8028         of -pie.
8029         * gold.cc (queue_middle_tasks): A -pie link is not static.
8030         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8031         * symtab.cc (Symbol::final_value_is_known): Return false if
8032         output_is_position_independent.
8033         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8034         output_is_position_independent.
8035         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8036         output_is_position_independent.
8037         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8038         output_is_position_independent.
8039         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8040         two_file_pie_test.
8041         (basic_pie_test.o, basic_pie_test): New targets.
8042         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8043         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8044         (two_file_pie_test): New target.
8045         * testsuite/Makefile.in: Rebuild.
8046         * README: Remove note saying that -pie is not supported.
8047
8048 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8049
8050         * options.h (class General_options): Add -init and -fini.
8051         * layout.cc (Layout::finish_dynamic_section): Emit
8052         given init and fini functions.
8053
8054 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8055
8056         * gc.h (gc_process_relocs): Check if icf is enabled using new
8057         function.
8058         * gold.cc (queue_initial_tasks): Likewise.
8059         (queue_middle_tasks): Likewise.
8060         * object.cc (do_layout): Likewise.
8061         * symtab.cc (is_section_folded): Likewise.
8062         * main.cc (main): Likewise.
8063         * reloc.cc (Read_relocs::run): Likewise.
8064         (Sized_relobj::do_scan_relocs): Likewise.
8065         * icf.cc (is_function_ctor_or_dtor): New function.
8066         (Icf::find_identical_sections): Check if function is ctor or dtor when
8067         safe icf is chosen.
8068         * options.h (General_options::icf): Change option to be an enum.
8069         (Icf_status): New enum.
8070         (icf_enabled): New method.
8071         (icf_safe_folding): New method.
8072         (set_icf_status): New method.
8073         (icf_status_): New variable.
8074         * (options.cc) (General_options::finalize): Set icf_status_.
8075         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8076         icf_test and icf_keep_unique_test to use the --icf enum flag.
8077         * testsuite/icf_safe_test.sh: New file.
8078         * testsuite/icf_safe_test.cc: New file.
8079
8080 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8081
8082         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8083         includes to gc.h and icf.h.
8084         * arm.cc: Include gc.h.
8085         * gold.cc: Likewise.
8086         * i386.cc: Likewise.
8087         * powerpc.cc: Likewise.
8088         * sparc.cc: Likewise.
8089         * x86_64.cc: Likewise.
8090         * gc.h: Include icf.h.
8091
8092 2009-10-11  Ian Lance Taylor  <iant@google.com>
8093
8094         * plugin.cc: Include "gold.h" before other header files.
8095
8096 2009-10-10  Chris Demetriou  <cgd@google.com>
8097
8098         * options.h (Input_file_argument::Input_file_type): New enum.
8099         (Input_file_argument::is_lib_): Replace with...
8100         (Input_file_argument::type_): New member.
8101         (Input_file_argument::Input_file_argument): Take Input_file_type
8102         'type' rather than boolean 'is_lib' as second argument.
8103         (Input_file_argument::is_lib): Use type_.
8104         (Input_file_argument::is_searched_file): New function.
8105         (Input_file_argument::may_need_search): Handle is_searched_file.
8106         * options.cc (General_options::parse_library): Support -l:filename.
8107         (General_options::parse_just_symbols): Update for Input_file_argument
8108         changes.
8109         (Command_line::process): Likewise.
8110         * archive.cc (Archive::get_file_and_offset): Likewise.
8111         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8112         * script.cc (read_script_file, script_add_file): Likewise.
8113         * fileread.cc (Input_file::Input_file): Likewise.
8114         (Input_file::will_search_for): Handle is_searched_file.
8115         (Input_file::open): Likewise.
8116         * readsyms.cc (Read_symbols::get_name): Likewise.
8117         * testsuite/Makefile.am (searched_file_test): New test.
8118         * testsuite/Makefile.in: Regenerate.
8119         * testsuite/searched_file_test.cc: New file.
8120         * testsuite/searched_file_test_lib.cc: New file.
8121
8122 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8123             Ian Lance Taylor  <iant@google.com>
8124
8125         * descriptor.cc: Include <cstdio> and "binary-io.h".
8126         (Descriptors::open): Open the files in binary mode always.
8127         * script.cc (Lex::get_token): Treat \r as whitespace.
8128
8129 2009-10-09  Ian Lance Taylor  <iant@google.com>
8130
8131         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8132
8133 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8134             Ian Lance Taylor  <iant@google.com>
8135
8136         * configure.ac: Check for readv function also.
8137         * fileread.cc (readv): Define if not HAVE_READV.
8138         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8139         does not exist.
8140         * config.in: Regenerate.
8141         * configure: Regenerate.
8142
8143 2009-10-09  Doug Kwan  <dougkwan@google.com>
8144
8145         * layout.cc (Layout::make_output_section): Call target hook to make
8146         ordinary output section.
8147         (Layout::finalize): Adjust parameter list of call the
8148         Target::may_relax().
8149         * layout.h (class Layout::section_list): New method.
8150         * merge.h (Output_merge_base::entsize): Change visibility to public.
8151         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8152         New methods.
8153         (Output_merge_string::do_is_string): New method.
8154         * object.cc (Sized_relobj::do_setup): renamed from
8155         Sized_relobj::set_up.
8156         * object.h (Sized_relobj::adjust_shndx,
8157         Sized_relobj::initializ_input_to_output_maps,
8158         Sized_relobj::free_input_to_output_maps): Change visibilities to
8159         protected.
8160         (Sized_relobj::setup): Virtualize.
8161         (Sized_relobj::do_setup): New method declaration.
8162         (Sized_relobj::invalidate_section_offset,
8163         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8164         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8165         * options.cc (parse_int): New function.
8166         * options.h (parse_int): New declaration.
8167         (DEFINE_int): New macro.
8168         (stub_group_size): New option.
8169         * output.cc (Output_section::Output_section): Initialize memebers
8170         merge_section_map_, merge_section_by_properties_map_,
8171         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8172         (Output_section::add_input_section): Handled deferred code-fill
8173         generation and remove an old comment.
8174         (Output_section::add_relaxed_input_section): New method definition.
8175         (Output_section::add_merge_input_section): Use merge section by
8176         properties map to speed to search.  Update merge section maps
8177         as appropriate.
8178         (Output_section::build_relaxation_map): New method definition.
8179         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8180         Same.
8181         (Output_section::relax_input_section): Renamed to
8182         Output_section::convert_input_sections_to_relaxed_sections and change
8183         interface to take a vector of pointers to relaxed sections.
8184         (Output_section::find_merge_section,
8185         Output_section::find_relaxed_input_section): New method definitions.
8186         (Output_section::is_input_address_mapped,
8187         Output_section::output_offset, Output_section::output_address):
8188         Use output section data maps to speed up searching.
8189         (Output_section::find_starting_output_address): Add comments.
8190         (Output_section::do_write,
8191         Output_section::write_to_postprocessing_buffer): Do code-fill
8192         generation as appropriate.
8193         (Output_section::get_input_sections): Invalidate relaxed input section
8194         map.
8195         (Output_section::restore_states): Adjust type of checkpoint .
8196         Invalidate relaxed input section map.
8197         * output.h (Output_merge_base): New class declaration.
8198         (Input_section_specifier): New class defintion.
8199         (class Output_relaxed_input_section) Change base class to
8200         Output_section_data_build.
8201         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8202         base class initializer.
8203         (Output_section::add_relaxed_input_section): New method declaration.
8204         (Output_section::Input_section): Change visibility to protected.
8205         (Output_section::Input_section::relobj,
8206         Output_section::Input_section::shndx): Handle relaxed input sections.
8207         Output_section::input_sections) Change visibility to protected.  Also
8208         define overload to return a non-const pointer.
8209         (Output_section::Merge_section_properties): New class defintion.
8210         (Output_section::Merge_section_by_properties_map,
8211         Output_section::Output_section_data_by_input_section_map,
8212         Output_section::Relaxation_map): New types.
8213         (Output_section::relax_input_section): Rename method to
8214         Output_section::convert_input_sections_to_relaxed_sections and change
8215         interface to take a vector of relaxed section pointers.
8216         (Output_section::find_merge_section,
8217         Output_section::find_relaxed_input_section,
8218         Output_section::build_relaxation_map,
8219         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8220         New method declarations.
8221         (Output_section::merge_section_map_
8222         Output_section::merge_section_by_properties_map_,
8223         Output_section::relaxed_input_section_map_,
8224         Output_section::is_relaxed_input_section_map_valid_,
8225         Output_section::generate_code_fills_at_write_): New data members.
8226         * script-sections.cc
8227         (Output_section_element_input::set_section_addresses): Call
8228         current_data_size and addralign methods of relaxed input sections.
8229         (Orphan_output_section::set_section_addresses): Call current_data_size
8230         and addralign methods of relaxed input sections.
8231         * symtab.cc (Symbol_table::compute_final_value): Extract template
8232         from the body of Symbol_table::sized_finalize_symbol.
8233         (Symbol_table::sized_finalized_symbol): Call
8234         Symbol_table::compute_final_value.
8235         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8236         (Symbol_table::compute_final_value): New templated method declaration.
8237         * target.cc (Target::do_make_output_section): New method defintion.
8238         * target.h (Target::make_output_section): New method declaration.
8239         (Target::relax): Add more parameters for input objects, symbol table
8240         and layout.  Adjust call to do_relax.
8241         (Target::do_make_output_section): New method declaration.
8242         (Target::do_relax): Add parameters for input objects, symbol table
8243         and layout.
8244
8245 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8246
8247         * pread.c: Include stdio.h.
8248
8249 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8250
8251         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8252         defined.
8253
8254 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8255
8256         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8257         Change read_shndx type to unsigned int.
8258         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8259         int.
8260         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8261         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8262         Change read_shndx type to unsigned int.
8263         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8264         int.
8265         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8266         * layout.cc (Layout::create_symtab_sections): Cast the result of
8267         local_symcount * symsize to off_t in the gold_assert.
8268
8269 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8270
8271         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8272         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8273         R_ARM_BASE_ABS.
8274         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8275         (Arm_relocate_functions::thm_abs5): New function.
8276         (Arm_relocate_functions::abs12): New function.
8277         (Arm_relocate_functions::abs16): New function.
8278         (Arm_relocate_functions::base_abs): New function.
8279         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8280         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8281         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8282         R_ARM_BASE_ABS.
8283         (Scan::global): Likewise.
8284         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8285         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8286         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8287         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8288         R_ARM_BASE_ABS.
8289
8290 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8291
8292         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8293         (Arm_relocate_functions::movt_prel): New function.
8294         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8295         (Arm_relocate_functions::thm_movt_prel): New function.
8296         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8297         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8298         (Scan::global, Relocate::relocate): Likewise.
8299         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8300
8301 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8302
8303         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8304         Incremental_checker.
8305         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8306         unsigned int.
8307         (class Incremental_inputs_header): New class.
8308         (Incremental_inputs_header_writer): Edit comment.
8309         (Incremental_inputs_entry): New class.
8310         (Incremental_inputs_entry_writer): Edit comment.
8311         (Sized_incremental_binary::do_find_incremental_inputs_section):
8312         Add *strtab_shndx parameter, fill it.
8313         (Sized_incremental_binary::do_check_inputs): New method.
8314         (Incremental_checker::can_incrementally_link_output_file): Use
8315         Sized_incremental_binary::check_inputs.
8316         (Incremental_inputs::report_command_line): Save command line in
8317         command_line_.
8318         * incremental.h:
8319         (Incremental_binary::find_incremental_inputs_section): New
8320         method.
8321         (Incremental_binary::do_find_incremental_inputs_section): Add
8322         strtab_shndx parameter.
8323         (Incremental_binary::do_check_inputs): New pure virtual method.
8324         (Sized_incremental_binary::do_check_inputs): Declare.
8325         (Incremental_checker::Incremental_checker): Add incremental_inputs
8326         parameter, use it to initialize incremental_inputs_.
8327         (Incremental_checker::incremental_inputs_): New field.
8328         (Incremental_checker::command_line): New method.
8329         (Incremental_checker::inputs): New method.
8330         (Incremental_checker::command_line_): New field.
8331
8332 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8333
8334         * incremental.cc: Include <cstdarg> and "target-select.h".
8335         (vexplain_no_incremental): New function.
8336         (explain_no_incremental): New function.
8337         (Incremental_binary::error): New method.
8338         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8339         method.
8340         (make_sized_incremental_binary): New function.
8341         (open_incremental_binary): New function.
8342         (can_incrementally_link_file): Add checks if output is ELF and has
8343         inputs section.
8344         * incremental.h: Include "elfcpp_file.h" and "output.h".
8345         (Incremental_binary): New class.
8346         (Sized_incremental_binary): New class.
8347         (open_incremental_binary): Declare.
8348         * object.cc (is_elf_object): Use
8349         elfcpp::Elf_recognizer::is_elf_file.
8350         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8351         * output.h (Output_file::filesize): New method.
8352
8353 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8354
8355         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8356         New function.
8357         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8358         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8359         function.
8360         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8361         function.
8362         (Arm_relocate_functions::movw_abs_nc): New function.
8363         (Arm_relocate_functions::movt_abs): New function.
8364         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8365         (Arm_relocate_functions::thm_movt_abs): New function.
8366         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8367         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8368         (Scan::global): Likewise.
8369         (Relocate::relocate): Likewise.
8370         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8371
8372 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8373
8374         * arm.cc (Arm_relocate_functions::got_prel) New function.
8375         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8376         (Relocate::relocate): Likewise.
8377         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8378
8379 2009-10-06  Ian Lance Taylor  <iant@google.com>
8380
8381         * options.h (class General_options): Define
8382         split_stack_adjust_size parameter.
8383         * object.h (class Object): Add uses_split_stack_ and
8384         has_no_split_stack_ fields.  Add uses_split_stack and
8385         has_no_split_stack accessor functions.  Declare
8386         handle_split_stack_section.
8387         (class Reloc_symbol_changes): Define.
8388         (class Sized_relobj): Define Function_offsets.  Declare
8389         split_stack_adjust, split_stack_adjust_reltype, and
8390         find_functions.
8391         * object.cc (Object::handle_split_stack_section): New function.
8392         (Sized_relobj::do_layout): Call handle_split_stack_section.
8393         * dynobj.cc (Sized_dynobj::do_layout): Call
8394         handle_split_stack_section.
8395         * reloc.cc (Sized_relobj::relocate_sections): Call
8396         split_stack_adjust for executable sections in split_stack
8397         objects.  Pass reloc_map to relocate_section.
8398         (Sized_relobj::split_stack_adjust): New function.
8399         (Sized_relobj::split_stack_adjust_reltype): New function.
8400         (Sized_relobj::find_functions): New function.
8401         * target-reloc.h: Include "object.h".
8402         (relocate_section): Add reloc_symbol_changes parameter.  Change
8403         all callers.
8404         * target.h (class Target): Add calls_non_split method.  Declare
8405         do_calls_non_split virtual method.  Declare match_view and
8406         set_view_to_nop.
8407         * target.cc: Include "elfcpp.h".
8408         (Target::do_calls_non_split): New function.
8409         (Target::match_view): New function.
8410         (Target::set_view_to_nop): New function.
8411         * gold.cc (queue_middle_tasks): Give an error if mixing
8412         split-stack and non-split-stack objects with -r.
8413         * i386.cc (Target_i386::relocate_section): Add
8414         reloc_symbol_changes parameter.
8415         (Target_i386::do_calls_non_split): New function.
8416         * x86_64.cc (Target_x86_64::relocate_section): Add
8417         reloc_symbol_changes parameter.
8418         (Target_x86_64::do_calls_non_split): New function.
8419         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8420         parameter.
8421         * powerpc.cc (Target_powerpc::relocate_section): Add
8422         reloc_symbol_changes parameter.
8423         * sparc.cc (Target_sparc::relocate_section): Add
8424         reloc_symbol_changes parameter.
8425         * configure.ac: Call AM_CONDITIONAL for the default target.
8426         * configure: Rebuild.
8427         * testsuite/Makefile.am (TEST_AS): New variable.
8428         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8429         (check_DATA): Add split_i386 and split_x86_64 files.
8430         (SPLIT_DEFSYMS): Define.
8431         (split_i386_[1234n].o): New targets.
8432         (split_i386_[124]): New targets.
8433         (split_i386_[1234r].stdout): New targets.
8434         (split_x86_64_[1234n].o): New targets.
8435         (split_x86_64_[124]): New targets.
8436         (split_x86_64_[1234r].stdout): New targets.
8437         (MOSTLYCLEANFILES): Add new executables.
8438         * testsuite/split_i386.sh: New file.
8439         * testsuite/split_x86_64.sh: New file.
8440         * testsuite/split_i386_1.s: New file.
8441         * testsuite/split_i386_2.s: New file.
8442         * testsuite/split_i386_3.s: New file.
8443         * testsuite/split_i386_4.s: New file.
8444         * testsuite/split_i386_n.s: New file.
8445         * testsuite/split_x86_64_1.s: New file.
8446         * testsuite/split_x86_64_2.s: New file.
8447         * testsuite/split_x86_64_3.s: New file.
8448         * testsuite/split_x86_64_4.s: New file.
8449         * testsuite/split_x86_64_n.s: New file.
8450         * testsuite/testfile.cc (Target_test): Update relocation_section
8451         function.
8452         * testsuite/Makefile.in: Rebuild.
8453
8454 2009-10-06  Ian Lance Taylor  <iant@google.com>
8455
8456         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8457         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8458         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8459         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8460         the address on ldo_addrs_.
8461         (Target_i386::Relocate::fix_up_ldo): New function.
8462
8463 2009-10-06   Rafael Espindola  <espindola@google.com>
8464
8465         * plugin.cc (add_input_library): New.
8466         (Plugin::load): Add add_input_library to tv.
8467         (Plugin_manager::add_input_file): Add the is_lib argument.
8468         (add_input_file): Update call to Plugin_manager::add_input_file.
8469         (add_input_library): New.
8470         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8471
8472 2009-09-30  Doug Kwan  <dougkwan@google.com>
8473
8474         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8475         symbol and call Symbol::may_need_copy_reloc to determine if
8476         a copy reloc is needed.
8477         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8478         nocopyreloc is given in command line.
8479         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8480         given in command line.
8481         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8482         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8483         of the removed Target_i386::may_need_copy_reloc.
8484         * options.h (copyreloc): New option with default value false.
8485         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8486         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8487         instead of the removed Target_powerpc::may_need_copy_reloc.
8488         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8489         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8490         instead of the removed Target_sparc::may_need_copy_reloc.
8491         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8492         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8493         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8494         instead of the removed Target_x86_64::may_need_copy_reloc.
8495
8496 2009-09-30  Ian Lance Taylor  <iant@google.com>
8497
8498         * object.h (class Object): Remove target_ field, and target,
8499         sized_target, and set_target methods.
8500         (Object::sized_target): Remove.
8501         (class Sized_relobj): Update declarations.  Remove sized_target.
8502         * object.cc (Sized_relobj::setup): Remove target parameter.
8503         Change all callers.
8504         (Input_objects::add_object): Don't do anything with the target.
8505         (make_elf_sized_object): Add punconfigured parameter.  Change all
8506         callers.  Set or test parameter target.
8507         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8508         Change all callers.
8509         * parameters.cc (Parameters::set_target): Change parameter type to
8510         be non-const.
8511         (Parameters::default_target): Remove.
8512         (set_parameters_target): Change parameter type to be non-const.
8513         (parameters_force_valid_target): New function.
8514         (parameters_clear_target): New function.
8515         * parameters.h (class Parameters): Update declarations.  Remove
8516         default_target method.  Add sized_target and clear_target
8517         methods.  Change target_ to be non-const.
8518         (set_parameters_target): Update declaration.
8519         (parameters_force_valid_target): Declare.
8520         (parameters_clear_target): Declare.
8521         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8522         as NULL if we aren't searching.
8523         (Add_symbols::run): Don't check for compatible target.
8524         * fileread.cc (Input_file::open_binary): Call
8525         parameters_force_valid_target.
8526         * gold.cc (queue_middle_tasks): Likewise.
8527         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8528         set_target on object.
8529         * dynobj.h (class Sized_dynobj): Update declarations.
8530         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8531         make_elf_object returns NULL.
8532         (Archive::include_member): Don't check whether object target is
8533         compatible.
8534         * output.cc (Output_section::add_input_section): Get target from
8535         parameters.
8536         (Output_section::relax_input_section): Likewise.
8537         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8538         parameters.
8539         (Sized_relobj::do_scan_relocs): Likewise.
8540         (Sized_relobj::relocate_sections): Likewise.
8541         * resolve.cc (Symbol_table::resolve): Likewise.
8542         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8543         parameter.  Change all callers.
8544         (Symbol_table::add_from_object): Get target from parameters.
8545         (Symbol_table::add_from_relobj): Don't check object target.
8546         (Symbol_table::add_from_dynobj): Likewise.
8547         (Symbol_table::define_special_symbol): Get target from
8548         parameters.
8549         * symtab.h (class Symbol_table): Update declaration.
8550         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8551         parameter.  Change all callers.  Clear parameter target.
8552         (Binary_test): Test target here.
8553         * testsuite/object_unittest.cc (gold_testsuite): Remove
8554         target_test_pointer parameter.  Change all callers.
8555         (Object_test): Test target here.
8556
8557 2009-09-26  Ian Lance Taylor  <iant@google.com>
8558
8559         * testsuite/initpri1.c: Don't try to use constructor priorities if
8560         compiling with gcc before 4.3.
8561
8562 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8563
8564         * testsuite/retain_symbols_file_test.sh (check_present): Change
8565         output file name to retain_symbols_file_test.stdout.
8566         (check_absent): Likewise.
8567
8568 2009-09-18  Craig Silverstein  <csilvers@google.com>
8569
8570         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8571         * options.cc: Include <cerrno> and <fstream>.
8572         (General_options::finalize): Parse -retain-symbols-file tag.
8573         * options.h: New flag.
8574         (General_options): New method should_retain_symbol, new
8575         variable symbols_to_retain.
8576         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8577         should_retain_symbol map.
8578         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8579         * testsuite/Makefile.in: Regenerate.
8580         * testsuite/retain_symbols_file_test.sh: New file.
8581
8582 2009-09-18  Nick Clifton  <nickc@redhat.com>
8583
8584         * po/es.po: Updated Spanish translation.
8585
8586 2009-09-17  Doug Kwan  <dougkwan@google.com>
8587
8588         * debug.h (DEBUG_RELAXATION): New constant.
8589         (DEBUG_ALL): Add DEBUG_RELAXATION.
8590         (debug_string_to_enum): Add relaxation debug option.
8591         * layout.cc
8592         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8593         Layout::Relaxation_debug_check::read_sections,
8594         Layout::Relaxation_debug_check::read_sections): New method definitions.
8595         (Layout::Layout): Initialize data members
8596         record_output_section_data_from_scrips_,
8597         script_output_section_data_list_ and relaxation_debug_check_.
8598         (Layout::save_segments, Layout::restore_segments,
8599         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8600         Layout::relaxation_loop_body): New method definitions.
8601         (Layout::finalize): Support relaxation.  Move section layout code to
8602         Layout::relaxation_loop_body.
8603         (Layout::set_asection_address_from_script): Move code for orphan
8604         section placement out.
8605         (Layout::place_orphan_sections_in_script): New method definition.
8606         * layout.h (Output_segment_headers, Output_file_header):
8607         New forward class declarations.
8608         (Layout::~Layout): Define.
8609         (Layout::new_output_section_data_from_script): New method definition.
8610         (Layout::place_orphan_sections_in_script): New method declaration.
8611         (Layout::Segment_states): New type declaration.
8612         (Layout::save_segments, Layout::restore_segments,
8613         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8614         Layout::relaxation_loop_body): New method declarations.
8615         (Layout::Output_section_data_list): New type declaration.
8616         (Layout::Relaxation_debug_check): New class definition.
8617         (Layout::record_output_section_data_from_script_,
8618         Layout::script_output_section_data_list_, Layout::segment_states_,
8619         Layout::relaxation_debug_check_): New data members.
8620         * output.cc: (Output_section_headers::do_size): New method definition.
8621         (Output_section_headers::Output_section_headers): Move size
8622         computation to Output_section_headers::do_size.
8623         (Output_segment_headers::do_size): New method definition.
8624         (Output_file_header::Output_file_header): Move size computation to
8625         Output_file_header::do_size and call it.
8626         (Output_file_header::do_size): New method definition.
8627         (Output_data_group::Output_data_group): Adjust call to
8628         Output_section_data.
8629         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8630         (Output_symtab_xindex::do_write): Add array bound check.
8631         (Output_section::Input_section::print_to_mapfile): Handle
8632         RELAXED_INPUT_SECTION_CODE.
8633         (Output_section::Output_section): Initialize data member checkpoint_.
8634         (Output_section::~Output_section): Delete checkpoint object pointed
8635         by checkpoint_.
8636         (Output_section::add_input_section): Always add an Input_section if
8637         relaxing.
8638         (Output_section::add_merge_input_section): Add assert.
8639         (Output_section::relax_input_section): New method definition.
8640         (Output_section::set_final_data_size): Set load address to zero for
8641         an unallocated section.
8642         (Output_section::do_address_and_file_offset_have_reset_values):
8643         New method definition.
8644         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8645         Handle relaxed input section.
8646         (Output_section::sort_attached_input_sections): Checkpoint input
8647         section list lazily.
8648         (Output_section::get_input_sections): Change type of input_sections to
8649         list of Simple_input_section pointers.  Checkpoint input section list
8650         lazily.  Also handle relaxed input sections.
8651         (Output_section::add_input_section_for_script): Take a reference to
8652         a Simple_input_section object instead of Relobj pointer and section
8653         index as parameter.  Handle relaxed input sections.
8654         (Output_section::save_states, Output_section::restore_states): New
8655         method definitions.
8656         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8657         (Output_data::is_data_size_fixed): New method definition.
8658         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8659         if it is fixed.
8660         (Output_data::address_and_file_offset_have_reset_values): New method
8661         definition.
8662         (Output_data::do_address_and_file_offset_have_reset_values): New method
8663         definition.
8664         (Output_data::set_data_size): Check that data size is not fixed.
8665         (Output_data::fix_data_size): New method definition.
8666         (Output_data::is_data_size_fixed_): New data member.
8667         (Output_section_headers::set_final_data_size): New method definition.
8668         (Output_section_headers::do_size): New method declaration.
8669         (Output_segment_headers::set_final_data_size): New method definition.
8670         (Output_segment_headers::do_size): New method declaration.
8671         (Output_file_header::set_final_data_size)::New method definition.
8672         (Output_file_header::do_size)::New method declaration.
8673         (Output_section_data::Output_section_data): Add new parameter
8674         is_data_size_fixed and use it to fix data size.
8675         (Output_data_const::Output_data_const): Adjust call to base class
8676         constructor and fix data size.
8677         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8678         base class constructor and fix data size.
8679         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8680         base class constructor and fix data size.
8681         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8682         class constructor and fix data size.
8683         (Output_data_group::set_final_data_size): New method definition.
8684         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8685         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8686         class constructor and fix data size.
8687         (Output_relaxed_input_section): New class definition.
8688         (Output_section::Simple_input_section): New class definition.
8689         (Output_section::get_input_sections): Adjust parameter list.
8690         (Output_section::add_input_section_for_script): Same.
8691         (Output_section::save_states, Output_section::restore_states,
8692         Output_section::do_address_and_file_offset_have_reset_values,
8693         (Output_section::Input_section::Input_section): Handle
8694         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8695         Output_relaxed_input_section.
8696         (Output_section::Input_section::is_input_section,
8697         Output_section::Input_section::set_output_section): Handle relaxed
8698         input section.
8699         (Output_section::Input_section::is_relaxed_input_section,
8700         Output_section::Input_section::output_section_data,
8701         Output_section::Input_section::relaxed_input_section): New method
8702         definitions.
8703         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8704         value.
8705         (Output_section::Input_section::u1_): Update comments.
8706         (Output_section::Input_section::u2_): Add new union member poris.
8707         (Output_section::Checkpoint_output_section): New classs definition.
8708         (Output_section::relax_input_section): New method declaration.
8709         (Output_section::checkpoint_): New data member.
8710         (Output_segment): Update comments.
8711         (Output_segment::Output_segment): Un-privatize copy constructor.
8712         (Output_segment::operator=): Un-privatize.
8713         * script-sections.cc (Output_section_element::Input_section_list):
8714         Change element type to Output_section::Simple_input_section.
8715         (Output_section_element_dot_assignment::set_section_addresses):
8716         Register output section data for relaxation clean up.
8717         (Output_data_exression::Output_data_expression): Adjust call to base
8718         constructor to fix data size.
8719         (Output_section_element_data::set_section_addresses): Register
8720         Output_data_expression object for relaxation clean up.
8721         (struct Input_section_info): Replace Relobj pointer and section index
8722         pair with Output_section::Simple_input_section and Convert struct to a
8723         class.
8724         (Input_section_sorter::operator()): Adjust access to
8725         Input_section_info data member to use accessors.
8726         (Output_section_element_input::set_section_addresses): Use layout
8727         parameter.  Adjust code to use Output_section::Simple_input_section
8728         and Input_secction_info classes.  Register filler for relaxation
8729         clean up.
8730         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8731         and section index pair with Output_section::Simple_input_section
8732         class.  Adjust code accordingly.
8733         (Phdrs_element::release_segment): New method definition.
8734         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8735         segment list.
8736         (Script_sections::release_segments): New method definition.
8737         * gold/script-sections.h (Script_sections::release_segments): New
8738         method declaration.
8739         * gold/target.h (Target::may_relax, Target::relax,
8740         Target::do_may_relax, Target::do_relax): New method definitions.
8741
8742 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8743
8744         * arm.cc (has_signed_unsigned_overflow): New function.
8745         (Arm_relocate_functions::abs8): New function.
8746         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8747         (Target_arm::Scan::global): Likewise.
8748         (Target_arm::relocate::relocate): Likewise.
8749         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8750         Likewise.
8751
8752 2009-09-16  Cary Coutant  <ccoutant@google.com>
8753
8754         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8755         * testsuite/Makefile.in: Regenerate.
8756
8757 2009-09-11  Nick Clifton  <nickc@redhat.com>
8758
8759         * po/gold.pot: Updated by the Translation project.
8760
8761 2009-09-08  Cary Coutant  <ccoutant@google.com>
8762
8763         * output.cc (Output_file::open): Add execute permission to empty file.
8764         * testsuite/Makefile.am (permission_test): New test.
8765         * testsuite/Makefile.in: Regenerate.
8766
8767 2009-09-02  Ian Lance Taylor  <iant@google.com>
8768
8769         * output.cc (Output_file::resize): Call map_no_anonymous rather
8770         than map.
8771
8772 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8773
8774         * gold.cc: Include "incremental.h".
8775         (queue_initial_tasks): Call Incremental_checker methods.
8776         * incremental.cc: Include "output.h".
8777         (Incremental_checker::can_incrementally_link_output_file): New
8778         method.
8779         * incremental.h (Incremental_checker): New class.
8780
8781         * output.cc (Output_file::open_for_modification): New method.
8782         (Output_file::map_anonymous): Changed return type to bool.  Record
8783         map in base_ field.
8784         (Output_file::map_no_anonymous): New method, broken out of map.
8785         (Output_file::map): Use map_no_anonymous and map_anonymous.
8786         * output.h (class Output_file): Update declarations.
8787
8788 2009-08-24  Cary Coutant  <ccoutant@google.com>
8789
8790         * options.h (Command_line::Pre_options): New class.
8791         (Command_line::pre_options): New member.
8792         * options.cc (gold::options::ready_to_register): New variable.
8793         (One_option::register_option): Do nothing if not registering options.
8794         Assert if same short option registered twice.
8795         (General_options::General_options): Turn off option registration when
8796         done constructing.
8797         (Command_line::Pre_options::Pre_options): New constructor.
8798
8799 2009-08-24  Cary Coutant  <ccoutant@google.com>
8800
8801         * options.h (General_options::no_keep_memory): Remove incorrect
8802         short option.
8803
8804 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8805
8806         * Makefile.am (am__skiplex, am__skipyacc): New.
8807         * Makefile.in: Regenerate.
8808
8809 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8810
8811         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8812         (INCLUDES): ... this.
8813         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8814         (AM_CPPFLAGS): Renamed from ...
8815         (INCLUDE): ... this.
8816         * Makefile.in, testsuite/Makefile.in: Regenerate.
8817
8818         * Makefile.in: Regenerate.
8819         * aclocal.m4: Likewise.
8820         * config.in: Likewise.
8821         * configure: Likewise.
8822         * testsuite/Makefile.in: Likewise.
8823
8824         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8825         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8826         * Makefile.in: Regenerate.
8827         * testsuite/Makefile.in: Regenerate.
8828
8829 2009-08-19  Cary Coutant  <ccoutant@google.com>
8830
8831         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8832         symbols in shared libraries overridden by hidden or internal symbols
8833         in the main program.
8834
8835 2009-08-19  Chris Demetriou  <cgd@google.com>
8836
8837         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8838         checking source file names in error messages.
8839
8840 2009-08-18  Doug Kwan  <dougkwan@google.com>
8841
8842         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8843         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8844         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8845         an elfcpp::Ehdr as parameter.
8846         * object.cc (Object::set_target): Remove the version that looks up
8847         a target and sets it.
8848         (Sized_relobj::setup): Take a Target object instead of
8849         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8850         (make_elf_sized_object): Find target and ask target to
8851         make an ELF object.
8852         * object.h: (Object::set_target): Remove the version that looks up
8853         a target and sets it.
8854         (Sized_relobj::setup): Take a Target object instead of
8855         an elfcpp:Ehdr as parameter.
8856         * target.cc: Include dynobj.h.
8857         (Target::do_make_elf_object_implementation): New.
8858         (Target::do_make_elf_object): New.
8859         * target.h (Target::make_elf_object): New template declaration.
8860         (Target::do_make_elf_object): New method declarations.
8861         (Target::do_make_elf_object_implementation): New template declaration.
8862
8863 2009-08-14  Ian Lance Taylor  <iant@google.com>
8864
8865         * gold.h (FUNCTION_NAME): Define.
8866         (gold_unreachable): Use FUNCTION_NAME.
8867
8868 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8869
8870         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8871         symbol in the --keep-unique list is not found.
8872
8873 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8874
8875         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8876         been maked as --keep-unique.
8877         (Icf::unfold_section): New function.
8878         * icf.h (Icf::unfold_section): New function.
8879         * options.h (General_options::keep_unique): New option.
8880         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8881         * testsuite/Makefile.in: Regenerate.
8882         * testsuite/icf_keep_unique_test.sh: New file.
8883         * testsuite/icf_keep_unique_test.cc: New file.
8884
8885 2009-08-12  Cary Coutant  <ccoutant@google.com>
8886
8887         PR 10471
8888         * resolve.cc (Symbol_table::resolve): Check for references from
8889         dynamic objects to hidden and internal symbols.
8890         * testsuite/Makefile.am (hidden_test.sh): New test.
8891         * testsuite/Makefile.in: Regenerate.
8892         * testsuite/hidden_test.sh: New script.
8893         * testsuite/hidden_test_1.c: New test source.
8894         * testsuite/hidden_test_main.c: New test source.
8895
8896 2009-08-11  Doug Kwan  <dougkwan@google.com>
8897
8898         * arm.cc: Update comments.
8899         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8900         segment to locate the .ARM.exidx section if present.
8901
8902 2009-08-09  Doug Kwan  <dougkwan@google.com>
8903
8904         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8905         patch.
8906
8907 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8908         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8909         compiler warnings.
8910
8911 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8912
8913         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8914         valid tls_segment only for non-debug-section relocations.
8915         * testsuite/Makefile.am: Add gc_tls_test.
8916         * testsuite/Makefile.in: Regenerate.
8917         * testsuite/gc_tls_test.cc: New file.
8918         * testsuite/gc_tls_test.sh: New file.
8919
8920 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8921
8922         * icf.cc: New file.
8923         * icf.h: New file.
8924         * Makefile.am (CCFILES): Add icf.cc.
8925         (HFILES): Add icf.h
8926         * Makefile.in: Regenerate.
8927         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8928         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8929         section, symbol and addend information for the relocs.
8930         * gold.cc (queue_middle_tasks): Call identical code folding.
8931         * gold.h: Add defines for multimap.
8932         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8933         to the call of finalize_local_symbols.
8934         * main.cc (main): Create object of class Icf.
8935         * object.cc (Sized_relobj::do_layout): Allow this function to be
8936         called twice during icf.
8937         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8938         to sections marked as identical by icf.
8939         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8940         when available.
8941         (Sized_relobj::do_section_entsize): New function.
8942         * object.h (Object::section_entsize): New function.
8943         (Object::do_section_entsize): New pure virtual function.
8944         (Relobj::finalize_local_symbols): Add new parameter.
8945         (Relobj::do_section_entsize): New function.
8946         * options.h (General_options::icf): New option.
8947         (General_options::icf_iterations): New option.
8948         (General_options::print_icf_sections): New option.
8949         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8950         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8951         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8952         icf.
8953         * symtab.cc (Symbol_table::is_section_folded): New function.
8954         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8955         to sections marked as identical by icf.
8956         * symtab.h (Symbol_table::set_icf): New function.
8957         (Symbol_table::icf): New function.
8958         (Symbol_table::is_section_folded): New function.
8959         (Symbol_table::icf_): New data member.
8960         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8961         * testsuite/Makefile.am: Add commands to build icf_test.
8962         * testsuite/Makefile.in: Regenerate.
8963         * testsuite/icf_test.sh: New file.
8964         * testsuite/icf_test.cc: New file.
8965
8966 2009-07-24  Chris Demetriou  <cgd@google.com>
8967
8968         * layout.cc (is_compressible_debug_section): Fix incorrect
8969         comment about compressed section names.
8970
8971 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8972
8973         PR 10419
8974         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8975
8976 2009-07-16  Ian Lance Taylor  <iant@google.com>
8977
8978         PR 10400
8979         * layout.h: #include <map>.
8980         (class Kept_section): Change from struct to class.  Add accessors
8981         and setters.  Add section size to Comdat_group mapping.  Change
8982         Comdat_group to std::map.  Add is_comdat_ field.  Add
8983         linkonce_size field in union.
8984         (class Layout): Update declaration of find_or_add_kept_section.
8985         Don't declare find_kept_object.
8986         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8987         parameter.  Add object, shndx, is_comdat, and is_group_name
8988         parameters.  Change all callers.  Adjust for new Kept_section.
8989         (Layout::find_kept_object): Remove.
8990         * object.cc (Sized_relobj::include_section_group): Update use of
8991         Kept_section.  Rename secnum to shndx.  Only record
8992         Kept_comdat_section if sections are the same size.
8993         (Sized_relobj::include_linkonce_section): Update use of
8994         Kept_section.  Only record Kept_comdat_section if sections are the
8995         same size.  Set size of linkonce section.
8996         (Sized_relobj::map_to_kept_section): Update call to
8997         get_kept_comdat_section.
8998         * object.h (class Sized_relobj): Rename fields in
8999         Kept_comdat_section to drop trailing underscores; change object
9000         field to Relobj*.  Change Kept_comdat_section_table to store
9001         struct rather than pointer.
9002         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9003         Add kept_object and kept_shndx parameters.  Change all callers.
9004         (Sized_relobj::get_kept_comdat_section): Change return type to
9005         bool.  Add kept_object and kept_shndx parameters.  Change all
9006         callers.
9007         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9008         Layout::find_or_add_kept_section.
9009
9010 2009-07-09  Ian Lance Taylor  <iant@google.com>
9011
9012         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9013         Reserve space in the hash table.
9014
9015 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9016
9017         * fileread.cc (File_read::get_mtime): New method.
9018         * fileread.h (Timespec): New structure.
9019         (File_read::get_mtime): New method.
9020         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9021         Renamed from timestamp_nsec.
9022         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9023         Elf_Xword.
9024         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9025         timestamp_nsec.
9026         (Incremental_inputs::report_archive): Save mtime; style fix.
9027         (Incremental_inputs::report_obejct): Save mtime; style fix.
9028         (Incremental_inputs::report_script): Save mtime; style fix.
9029         (Incremental_inputs::finalize_inputs): Style fix.
9030         (Incremental_inputs::finalize): Style fix.
9031         (Incremental_inputs::create_input_section_data): Store inputs
9032         mtime.
9033         * incremental.h (Incremental_inputs::report_script): Add mtime
9034         argument.
9035         (Incremental_inputs::Input_info::Input_info): Intialize only one
9036         union member.
9037         (Incremental_inputs::Input_info::archive): Move to nameless
9038         union.
9039         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9040         (Incremental_inputs::Input_info::script): Move to nameless union.
9041         (Incremental_inputs::mtime): New field.
9042         * script.cc (read_input_script): Pass file mtime to
9043         Incremental_input.
9044         * script.h (Script_info::inputs): Style fix.
9045
9046 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9047
9048         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9049         instead of 32.
9050
9051 2009-06-24  Ian Lance Taylor  <iant@google.com>
9052
9053         PR 10156
9054         * layout.cc (Layout::choose_output_section): If we find an
9055         existing section, update the flags.
9056         (Layout::create_notes): New function, broken out of
9057         Layout::finalize.
9058         (Layout::finalize): Don't create note sections.
9059         (Layout::create_note): Don't crash if linker script discards
9060         section.
9061         (Layout::create_gold_note): Likewise.
9062         (Layout::create_build_id): Likewise.  Don't set
9063         after_input_sections on the section.
9064         (Layout::create_executable_stack_info): Remove target parameter.
9065         Change caller.
9066         * layout.h (class Layout): Declare create_notes.  Update
9067         declaration of create_executable_stack_info.
9068         * gold.cc (queue_middle_tasks): Call create_notes.
9069         * output.cc (Output_section::update_flags_for_input_section): Move
9070         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9071         invalid.
9072         * output.h (Output_data::mark_address_invalid): New function.
9073         (class Output_section): Only declare, not define,
9074         update_flags_for_input_section.  Remove set_flags.
9075
9076 2009-06-24  Ian Lance Taylor  <iant@google.com>
9077
9078         * script-sections.cc (Output_section_definition::
9079         set_section_addresses): Rename shadowing local load_address to
9080         laddr.
9081
9082 2009-06-24  Ian Lance Taylor  <iant@google.com>
9083
9084         PR 10244
9085         * reloc.cc (relocate_sections): Skip empty relocation sections.
9086
9087 2009-06-23  Ian Lance Taylor  <iant@google.com>
9088
9089         PR 10156
9090         * layout.cc (Layout::create_note): Use choose_output_section
9091         rather than make_output_section.
9092
9093 2009-06-23  Ian Lance Taylor  <iant@google.com>
9094
9095         PR 10237
9096         * options.cc (General_options::parse_V): Set printed_version_.
9097         (General_options::General_options): Initialize printed_version_.
9098         * options.h (class General_options): Add printed_version_ field.
9099         * gold.cc (queue_initial_tasks): If there are no input files,
9100         don't give a fatal error if we printed the version information.
9101         (queue_middle_tasks): If using -r with a shared object, give a
9102         fatal error rather than an ordinary error.
9103
9104 2009-06-23  Ian Lance Taylor  <iant@google.com>
9105
9106         PR 10219
9107         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9108         (Layout::make_output_section): Set have_stabstr_section_ if we see
9109         a .stab*str section.
9110         (Layout::finalize): Call link_stabs_sections.
9111         (Layout::link_stabs_sections): New file.
9112         * layout.h (class Layout): Add have_stabstr_section_ field.
9113         Declare link_stabs_sections.
9114
9115 2009-06-23  Doug Kwan  <dougkwan@google.com>
9116
9117         * Makefile.am (libgold_a_LIBADD): New.
9118         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9119         * Makefile.in: Regenerate.
9120         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9121         * configure: Regenerate.
9122         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9123         * fileread.cc: Include sys/state.h
9124         * gold.h: Declare memmem and strndup if found missing.
9125         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9126
9127 2009-06-23  Ian Lance Taylor  <iant@google.com>
9128
9129         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9130         * configure: Rebuild.
9131
9132 2009-06-23  Ian Lance Taylor  <iant@google.com>
9133
9134         PR 10147
9135         * object.cc (Object::section_contents): Don't try to get a view if
9136         the section has length zero.
9137         (Object::handle_gnu_warning_section): If the section is empty, use
9138         the name of the section as the warning.
9139
9140 2009-06-23  Ian Lance Taylor  <iant@google.com>
9141
9142         PR 10133
9143         * stringpool.h (class Stringpool_template): Add optimize_ field.
9144         (Stringpool_template::set_optimize): New function.
9145         * stringpool.cc (Stringpool_template::Stringpool_template):
9146         Initialize optimize_ field.
9147         (Stringpool_template::set_string_offsets): Test local optimize
9148         fild rather than parameter.
9149         * layout.cc (Layout::Layout): Call set_optimize on the section
9150         name stringpool.
9151
9152 2009-06-22  Ian Lance Taylor  <iant@google.com>
9153
9154         PR 10030
9155         * yyscript.y: Parse TARGET.
9156         * script.cc (script_set_target): New function.
9157         * script-c.h (script_set_target): Declare.
9158         * options.cc (General_options::string_to_object_format): Rename
9159         from string_to_object_format in anonymous namespace.  Change
9160         callers.
9161         * options.h (class General_options): Declare
9162         string_to_object_format.
9163
9164 2009-06-22  Ian Lance Taylor  <iant@google.com>
9165
9166         * script-sections.cc (Script_sections::create_segments): Don't put
9167         program headers in a PT_LOAD segment if -n or -N.
9168
9169 2009-06-22  Ian Lance Taylor  <iant@google.com>
9170
9171         PR 10141
9172         * options.h (class General_options): Add -z lazy and -z now.  Sort
9173         -z options into alphabetical order.
9174         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9175
9176 2009-06-21  Ian Lance Taylor  <iant@google.com>
9177
9178         * layout.cc (Layout::make_output_section): Call
9179         Target::new_output_section.
9180         (Layout::attach_allocated_section_to_segment): Put large section
9181         sections in a separate load segment with the large segment flag
9182         set.
9183         (Layout::segment_precedes): Sort large data segments after other
9184         load segments.
9185         (align_file_offset): New static function.
9186         (Layout::set_segment_offsets): Use align_file_offset.
9187         * output.h (class Output_section): Add is_small_section_ and
9188         is_large_section_ fields.
9189         (Output_section::is_small_section): New function.
9190         (Output_section::set_is_small_section):  New function.
9191         (Output_section::is_large_section): New function.
9192         (Output_section::set_is_large_section): New function.
9193         (Output_section::is_large_data_section): New function.
9194         (class Output_segment): Add is_large_data_segment_ field.
9195         (Output_segment::is_large_data_segment): New function.
9196         (Output_segment::set_is_large_data_segment): New function.
9197         * output.cc (Output_section::Output_section): Initialize new
9198         fields.
9199         (Output_segment::Output_segment): Likewise.
9200         (Output_segment::add_output_section): Add assertion that large
9201         data sections always go in large data segments.  Force small data
9202         sections to the end of the list of data sections.  Force small BSS
9203         sections to the start of the list of BSS sections.  For large BSS
9204         sections to the end of the list of BSS sections.
9205         * symtab.h (class Symbol): Declare is_common_shndx.
9206         (Symbol::is_defined): Check Symbol::is_common_shndx.
9207         (Symbol::is_common): Likewise.
9208         (class Symbol_table): Define enum Commons_section_type.  Update
9209         declarations.  Add small_commons_ and large_commons_ fields.
9210         * symtab.cc (Symbol::is_common_shndx): New function.
9211         (Symbol_table::Symbol_table): Initialize new fields.
9212         (Symbol_table::add_from_object): Put small and large common
9213         symbols in the right list.
9214         (Symbol_table::sized_finalized_symbol): Check
9215         Symbol::is_common_shndx.
9216         (Symbol_table::sized_write_globals): Likewise.
9217         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9218         common symbol lists.  Don't call do_allocate_commons_list if the
9219         list is empty.
9220         (Symbol_table::do_allocate_commons_list): Remove is_tls
9221         parameter.  Add comons_section_type parameter.  Change all
9222         callers.  Handle small and large common symbols.
9223         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9224         Symbol::is_common_shndx.
9225         * resolve.cc (symbol_to_bits): Likewise.
9226         * target.h (Target::small_common_shndx): New function.
9227         (Target::small_common_section_flags): New function.
9228         (Target::large_common_shndx): New function.
9229         (Target::large_common_section_flags): New function.
9230         (Target::new_output_section): New function.
9231         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9232         small_common_section_flags, and large_common_section_flags
9233         fields.
9234         (Target::do_new_output_section): New virtual function.
9235         * arm.cc (Target_arm::arm_info): Initialize new fields.
9236         * i386.cc (Target_i386::i386_info): Likewise.
9237         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9238         Likewise.
9239         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9240         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9241         (Target_x86_64::do_new_output_section): New function.
9242         * configure.ac: Define conditional MCMODEL_MEDIUM.
9243         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9244         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9245         (large_LDFLAGS): Define.
9246         * testsuite/large.c: New file.
9247         * testsuite/testfile.cc (Target_test::test_target_info):
9248         Initialize new fields.
9249         * configure, testsuite/Makefile.in: Rebuild.
9250
9251 2009-06-05  Doug Kwan  <dougkwan@google.com>
9252
9253         * Makefile.am (CCFILES): Add target.cc.
9254         * Makefile.in: Regenerate.
9255         * i386.cc (class Target_i386): Define new virtual method to
9256         override do_is_local_label_name in parent.
9257         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9258         local symbols if --discard-locals or -X is given.
9259         * options.h (class General_options): Declare new options
9260         '--discard-locals' and '-X' for discarding locals.
9261         * target.h (class Target): Define new methods is_local_label_name.
9262         Declare new virtual method do_is_local_label_name.
9263         * target.cc: New file.
9264         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9265         (check_SCRIPTS): Add discard_locals_test.sh.
9266         (check_DATA): Add discard_local_tests.syms.
9267         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9268         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9269         * testsuite/Makefile.in: Regenerate.
9270         * testsuite/discard_locals_test.c: New file.
9271         * testsuite/discard_locals_test.sh: Same.
9272
9273 2009-06-05  Doug Kwan  <dougkwan@google.com>
9274
9275         * object.cc (Sized_relobj::Sized_relobj): Initialize
9276         discarded_eh_frame_shndx_ to -1U.
9277         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9278         section.
9279         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9280         a discarded .eh_frame section.
9281         (Sized_relobj::do_finalize_local_symbols): Ditto.
9282         * object.h (class Sized_relobj): Declare new member
9283         discarded_eh_frame_shndx_.
9284         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9285         (local_labels_test.o, local_labels_test): New rules.
9286         * testsuite/Makefile.in: Regenerate.
9287
9288 2009-06-04  Doug Kwan  <dougkwan@google.com>
9289
9290         * layout.cc (Layout::section_name_mapping): Add mapping for
9291         special ARM sections.
9292
9293 2009-06-03  Doug Kwan  <dougkwan@google.com>
9294
9295         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9296         (utils::has_overflow): Same.
9297
9298 2009-06-03  Ian Lance Taylor  <iant@google.com>
9299
9300         * layout.cc (Layout::section_name_mapping): New array, replacing
9301         Layout::linkonce_mapping.
9302         (Layout::section_name_mapping_count): New variable, replacing
9303         Layout::linkonce_mapping_count.
9304         (Layout::linkonce_output_name): Remove.
9305         (Layout::output_section_name): Rewrite.
9306         * layout.h (class Layout): Rename Linkonce_mapping to
9307         Section_name_mapping, linkonce_mapping to section_name_mapping,
9308         linkonce_mapping_count to section_name_mapping_count.  Don't
9309         declare linkonce_output_name.
9310
9311 2009-06-03  Doug Kwan  <dougkwan@google.com>
9312
9313         * gold/arm.cc (namespace utils): New.
9314         (Target_arm::reloc_is_non_pic): Define new method.
9315         (class Arm_relocate_functions): New.
9316         (Target_arm::Relocate::relocate): Handle relocation types used by
9317         Android.
9318
9319 2009-06-03  Ian Lance Taylor  <iant@google.com>
9320
9321         * arm.cc (Target_arm::scan::global): Use || instead of |.
9322
9323 2009-06-02  Doug Kwan  <dougkwan@google.com>
9324
9325         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9326         issued_non_pic_error_.
9327         (class Target_arm::Scan): Declare new method check_non_pic.
9328         Define new method symbol_needs_plt_entry.
9329         Declare new data member issued_non_pic_error_.
9330         (class Target_arm::Relocate): Declare new method
9331         should_apply_static_reloc.
9332         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9333         (Target_arm::Scan::check_non_pic): Define new method.
9334         (Target_arm::Scan::local): Handle a small subset of reloc types used
9335         by Android.
9336         (Target_arm::Scan::local): Same.
9337         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9338
9339 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9340
9341         * incremental.cc (Incremental_inputs::report_command_line): Filter
9342         out --incremental-* options.
9343
9344 2009-05-29  Doug Kwan  <dougkwan@google.com>
9345
9346         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9347         template class.
9348         (class Target_arm): Update comment.
9349         (Target_arm::Target_arm): Initialize new data members GOT_,
9350         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9351         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9352         and Target_arm::rel_dyn_section.
9353         Declare new_enum Target_arm::Got_type.
9354         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9355         and DYNBSS_.
9356         Update commments for member do_dynsym_value.
9357         (Target_arm::got_size, Target_arm::plt_section,
9358         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9359         new methods inside class defintion.
9360         (Target_arm::got_section): Define new method.
9361         (Target_arm::rel_dyn_section): Same.
9362         (Output_data_plt_arm): New template class.
9363         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9364         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9365         (Output_data_plt_arm::add_entry): Same.
9366         (Output_data_plt_arm::first_plt_entry): Define new
9367         static data member for PLT instruction template.
9368         (Output_data_plt_arm::plt_entry): Same.
9369         (Output_data_plt_arm::do_write): Define new method.
9370         (Target_arm::make_plt_entry): Same.
9371         (Target_arm::do_finalize_sections): Same.
9372         (Target_arm::do_dynsym_value): Same.
9373
9374 2009-05-28  Doug Kwan  <dougkwan@google.com>
9375
9376         * Makefile.am (TARGETSOURCES): Add arm.cc.
9377         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9378         * Makefile.in: Regenerate.
9379         * arm.cc: New file.
9380         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9381
9382 2009-05-26  Doug Kwan  <dougkwan@google.com>
9383
9384         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9385         (General_options::check_excluded_libs): Strip off directories in
9386         archive name before matching like GNU ld does.
9387         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9388         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9389         (exclude_libs_test_LDFLAGS): Add linker option
9390         -Wl,--exclude-libs,libexclude_libs_test_3
9391         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9392         an explicit archive without using -l.
9393         (alt/libexclude_libs_test_3.a): New make rule.
9394         * testsuite/Makefile.in: Regenerate.
9395         * testsuite/exclude_libs_test.c : Declare lib3_default().
9396         (main): Call it.
9397         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9398         * exclude_libs_test_3.c: New file.
9399
9400 2009-05-26  Nick Clifton  <nickc@redhat.com>
9401
9402         * po/id.po: New Indonesian translation.
9403         * po/gold.pot: Updated template file.
9404
9405 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9406
9407         * testsuite/Makefile.am: Add -ffunction-sections to compile
9408         gc_comdat_test files.  Add -Wl,--gc-sections to build
9409         gc_comdat_test.
9410         * testsuite/Makefile.in: Regenerate.
9411         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9412
9413 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9414
9415         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9416         kept comdat section was garbage collected.
9417         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9418         * testsuite/Makefile.in: Regenerate.
9419         * testsuite/gc_comdat_test.sh: New file.
9420         * testsuite/gc_comdat_test_1.cc: New file.
9421         * testsuite/gc_comdat_test_2.cc: New file.
9422
9423 2009-05-19  Doug Kwan  <dougkwan@google.com>
9424
9425         * archive.cc (Archive::Archive): Move constructor from archive.h
9426         to here.  Initialize no_export_.
9427         (Archive::get_elf_object_for_member): Set no_export flag of object.
9428         * archive.h (Archive::Archive): Move constructor body to
9429         archive.cc.
9430         (Archive::no_export): New method.
9431         (Archive::no_export_): New field.
9432         * object.h (Object::Object): Initialize no_export_ to false.
9433         (Object::no_export, Object::set_no_export): New methods.
9434         (Object::no_export_): New field.
9435         * options.cc (General_options::parse_exclude_libs): New method.
9436         (General_options::check_excluded_libs) Same.
9437         * options.h (exclude_libs): New option.
9438         (General_options::check_excluded_libs): New method declaration.
9439         (General_options::excluded_libs_): New field.
9440         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9441         default or protected visibility if an object has no-export flag set.
9442         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9443         (check_SCRIPTS): Add exclude_libs_test.sh.
9444         (check_DATA): Add exclude_libs_test.syms.
9445         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9446         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9447         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9448         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9449         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9450         libexclude_libs_test_2.a): New rules.
9451         * testsuite/Makefile.in: Regenerate.
9452         * testsuite/exclude_libs_test.c: New file.
9453         * testsuite/exclude_libs_test.sh: Ditto.
9454         * testsuite/exclude_libs_test_1.c: Ditto.
9455         * testsuite/exclude_libs_test_2.c: Ditto.
9456
9457 2009-05-15  Ian Lance Taylor  <iant@google.com>
9458
9459         * configure.ac: Check for declarations for cases where libiberty.h
9460         checks HAVE_DECL_xxx.
9461         * configure, config.in: Rebuild.
9462
9463 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9464
9465         * gold.h (Incremental_argument_list): Remove (invalid) forward
9466         declaration.
9467         * incremental.cc (Incremental_inputs::report_achive): New method.
9468         (Incremental_inputs::report_object): New method.
9469         (Incremental_inputs::report_script): New method.
9470         (Incremental_inputs::finalize_inputs): New method.
9471         (Incremental_inputs::finalize): Call finalize_inputs().
9472         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9473         Create inputs entries.
9474         * incremental.h (Incremental_input_type): New enum.
9475         (Incremental_inputs::Incremental_input): Initialize new fields.
9476         (Incremental_inputs::report_inputs): New method.
9477         (Incremental_inputs::report_achive): New method.
9478         (Incremental_inputs::report_object): New method.
9479         (Incremental_inputs::report_script): New method.
9480         (Incremental_inputs::finalize_inputs): New method.
9481         (Incremental_inputs::Input_info): New struct.
9482         (Incremental_inputs::Input_info_map): New typedef.
9483         (Incremental_inputs::lock_): New field.
9484         (Incremental_inputs::Inputs_): New field.
9485         (Incremental_inputs::Inputs_map): New field.
9486         * main.cc (main): Call Incremental_input::report_inputs.
9487         * options.h (Input_argument_list): Typedef moved from
9488         Input_arguments.
9489         (Input_file_group::Files): Remove, use ::Input_argument_list.
9490         (Input_file_group::Input_argument_list): Remove, use
9491         ::Input_argument_list.
9492         * plugin.cc (Plugin_manager::add_input_file): Add error in
9493         incremental build.
9494         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9495         functions.
9496         * script.cc (read_input_script): Call
9497         Incremental_input::report_script.
9498         * script.h (Script_info): New class.
9499
9500 2009-04-27  Ian Lance Taylor  <iant@google.com>
9501
9502         * x86_64.cc (do_adjust_output_section): Set entsize to
9503         plt_entry_size.
9504
9505 2009-04-23  Elliott Hughes  <enh@google.com>
9506
9507         * output.cc (Output_file::close): After short writes, continue
9508         writing from the correct offset in the buffer being written.
9509
9510 2009-04-23  Chris Demetriou  <cgd@google.com>
9511
9512         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9513         * configure: Regenerate.
9514         * config.in: Regenerate.
9515         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9516         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9517
9518 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9519
9520         * incremental.cc (Incremental_inputs_header_data): Renamed from
9521         Incremental_input_header_data.
9522         (Incremental_inputs_header_data::data_size): New field.
9523         (Incremental_inputs_header_data::put_input_file_count): Renamed
9524         from input_file_count.
9525         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9526         from command_line_offset.
9527         (Incremental_inputs_header_data::put_reserved): Renamed from
9528         put_reserved.
9529         (Incremental_inputs_entry_data): Renamed from
9530         Incremental_input_entry_data.
9531         (Incremental_inputs_entry_data::data_size): New field.
9532         (Incremental_inputs::report_command_line): New method.
9533         (Incremental_inputs::finalize): New method.
9534         (Incremental_inputs::create_incremental_inputs_data): New method.
9535         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9536         * incremental.h: New file.
9537         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9538        (Layout::finalize): Create incremental inputs section in
9539         incremental builds.
9540        (Layout::create_incremental_info_sections): New method.
9541         * layout.h (Layout::incremental_inputs): New method.
9542        (Layout::create_incremental_info_sections): New method.
9543        (Layout::incremental_inputs_): New field.
9544         * main.cc (main): Notify Incremental_input of the command line.
9545
9546 2009-04-01  Ian Lance Taylor  <iant@google.com>
9547             Mikolaj Zalewski  <mikolajz@google.com>
9548
9549         * gold.h (reserve_unordered_map): Define, three versions, one for
9550         each version of Unordered_map.
9551         * layout.cc (Layout::Layout): Remove options parameter.  Add
9552         number_of_input_files parameter.  Don't initialize options_.
9553         Initialize number_of_input_files_ and resized_signatures_.  Move
9554         sections_are_attached_.
9555         (Layout::layout_group): Reserve space for group_signatures_.
9556         (Layout::find_or_add_kept_section): Change name parameter to be a
9557         reference.  Resize signatures_ map when it gets large enough.
9558         (Layout::layout_eh_frame): Use parameters->options() instead of
9559         this->options_.
9560         (Layout::make_output_section): Likewise.
9561         (Layout::attach_allocated_section_to_segment): Likewise.
9562         (Layout::finalize, Layout::create_executable_stack): Likewise.
9563         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9564         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9565         * layout.h (class Layout): Update declarations.  Remove options_
9566         field.  Add number_of_input_files_ and resized_signatures_
9567         fields.  Move sections_are_attached_ field.
9568         * main.cc (main): Pass number of input files to Layout
9569         constructor.  Don't pass options.
9570
9571 2009-03-30  Ian Lance Taylor  <iant@google.com>
9572
9573         * ffsll.c (ffsll): Correct implementation.
9574
9575 2009-03-27  Ian Lance Taylor  <iant@google.com>
9576
9577         * ffsll.c: New file.
9578         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9579         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9580         * ftruncate.c (ftruncate): Declare before definition.
9581         * mremap.c (mremap): Likewise.
9582         * pread.c (pread): Likewise.
9583         * configure, Makefile.in, config.in: Rebuild.
9584
9585         * mremap.c: New file.
9586         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9587         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9588         (mremap): Declare if HAVE_MREMAP is not defined.
9589         * configure, Makefile.in, config.in: Rebuild.
9590
9591 2009-03-27  Cary Coutant  <ccoutant@google.com>
9592
9593         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9594         position independent.
9595         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9596         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9597
9598 2009-03-24  Cary Coutant  <ccoutant@google.com>
9599
9600         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9601         an executable.
9602         (needs_dynamic_reloc): Likewise.
9603
9604 2009-03-24  Ian Lance Taylor  <iant@google.com>
9605
9606         * yyscript.y (file_cmd): Recognize EXTERN.
9607         (extern_name_list, extern_name_list_body): New nonterminals.
9608         * script.cc (script_add_extern): Define.
9609         * script-c.h (script_add_extern): Declare.
9610
9611 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9612
9613         * object.cc (is_elf_object): Define.
9614         * object.h (is_elf_object): Declare.
9615         * archive.cc (Archive::get_elf_object_for_member): Call
9616         is_elf_object.
9617         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9618
9619 2009-03-24  Elliott Hughes  <enh@google.com>
9620
9621         * output.cc (Output_file::map_anonymous): Define.
9622         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9623         try an anonymous one.  Report the size if the mmap fails.
9624         * output.h (class Output_file): Declare map_anonymous.
9625
9626 2009-03-24  Ian Lance Taylor  <iant@google.com>
9627
9628         * target-select.cc (instantiate_target): Don't acquire the lock if
9629         the instantiated_target_ field has already been set.
9630
9631 2009-03-23  Ian Lance Taylor  <iant@google.com>
9632
9633         * gold-threads.h (class Initialize_lock): Define.
9634         * gold-threads.cc (class Initialize_lock_once): Define.
9635         (initialize_lock_control): New static variable.
9636         (initialize_lock_pointer): New static variable.
9637         (initialize_lock_once): New static function.
9638         (Initialize_lock::Initialize_lock): Define.
9639         (Initialize_lock::initialize): Define.
9640         * target-select.h: Include "gold-threads.h".
9641         (class Target_selector): Add lock_ and initialize_lock_ fields.
9642         Don't define instantiate_target, just declare it.
9643         * target-select.cc (Target_selector::Target_selector): Initialize
9644         new fields.
9645         (Target_selector::instantiate_target): Define.
9646         * descriptors.h: Include "gold-threads.h".
9647         (class Descriptors): Add initialize_lock_ field.
9648         * descriptors.cc (Descriptors::Descriptors): Initialize new
9649         field.
9650         (Descriptors::open): Use initialize_lock_ field
9651         * errors.h (class Errors): Add initialize_lock_ field.
9652         * errors.cc (Errors::Errors): Initialize new field.
9653         (Errors::initialize_lock): Use initialize_lock_ field.
9654         * powerpc.cc (class Target_selector_powerpc): Remove
9655         instantiated_target_ field.  In do_recognize call
9656         instantiate_target rather than do_instantiate_target.  In
9657         do_instantiate_target just allocate a new target.
9658         * sparc.cc (class Target_selector_sparc): Likewise.
9659
9660         * freebsd.h: New file.
9661         * i386.cc: Include "freebsd.h".
9662         (Target_i386): Derive from Target_freebsd rather than
9663         Sized_target.
9664         (Target_selector_i386): Derive from Target_selector_freebsd rather
9665         than Target_selector.
9666         * x86_64.cc: Include "freebsd.h".
9667         (Target_x86_64): Derive from Target_freebsd rather than
9668         Sized_target.
9669         (Target_selector_x86_64): Derive from Target_selector_freebsd
9670         rather than Target_selector.
9671         * target.h (class Target): Add adjust_elf_header and
9672         do_adjust_elf_header.
9673         * output.cc (Output_file_header:: do_sized_write): Call target
9674         adjust_elf_header routine.
9675         * configure.tgt: Set targ_osabi.
9676         * configure.ac: Define GOLD_DEFAULT_OSABI.
9677         * parameters.cc (Parameters::default_target): Pass
9678         GOLD_DEFAULT_OSABI to select_target.
9679         * target-select.h (class Target_selector): Make instantiate_target
9680         protected rather than private.
9681         * Makefile.am (HFILES): Add freebsd.h.
9682         * configure, Makefile.in, config.in: Rebuild.
9683
9684         * merge.cc (do_add_input_section): Correct pend value.  Change
9685         message about last entry not being null terminated from error to
9686         warning.
9687
9688 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9689
9690         * incremental.cc: New file.
9691         * Makefile.am (CCFILES): Add incremental.cc.
9692         * Makefile.in: Rebuild.
9693
9694 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9695
9696         * layout.cc (Layout::output_section_name): Preserve names
9697         of '.note.' sections.
9698
9699 2009-03-19  Ian Lance Taylor  <iant@google.com>
9700
9701         * descriptors.cc (Descriptors::open): Check that the options are
9702         valid before using them.
9703
9704 2009-03-18  Ian Lance Taylor  <iant@google.com>
9705
9706         * script-sections.h: Include <list>.
9707         (class Script_sections): Change Sections_elements from std::vector
9708         to std::list.  Typedef public Elements_iterator.  Add
9709         orphan_section_placement_, data_segment_align_start_, and
9710         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9711         field.
9712         * script-sections.cc (class Orphan_section_placement): New class.
9713         (class Sections_element): Add virtual functions is_relro and
9714         orphan_section_init.  Remove virtual function place_orphan_here.
9715         (class Output_section_definition): Add is_relro and
9716         orphan_section_init.  Remove place_orphan_here.
9717         (class Orphan_output_section): Likewise.
9718         (Script_sections::Script_sections): Update for field changes.
9719         (Script_sections::data_segment_align): Set saw_data_segment_align_
9720         and data_segment_align_start_, not data_segment_align_index.
9721         (Script_sections::data_segment_relro_end): Check
9722         saw_data_segment_align_.  Use data_segment_align_start_ rather
9723         than data_segment_align_index_.
9724         (Script_sections::place_orphan): Rewrite to use
9725         Orphan_section_placement.
9726
9727 2009-03-17  Ian Lance Taylor  <iant@google.com>
9728
9729         * archive.cc (Archive::add_symbols): Check for a version attached
9730         to the symbol name in the archive map.
9731         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9732         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9733         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9734         (ver_test_11.a): New target.
9735         * testsuite/Makefile.in: Rebuild.
9736
9737         * configure.ac: Check for chsize and posix_fallocate.  Replace
9738         ftruncate.
9739         * ftruncate.c: New file, from gnulib.
9740         * output.cc (posix_fallocate): Define dummy version if not
9741         HAVE_POSIX_FALLOCATE.
9742         (Output_file::map): Call posix_fallocate rather than lseek and
9743         write.
9744         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9745         * configure, Makefile.in, config.in: Rebuild.
9746
9747 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9748
9749         * layout.h (Layout::create_note): Add section_name parameter.
9750         * layout.cc (Layout::create_note): Likewise.
9751         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9752
9753 2009-03-17  Ian Lance Taylor  <iant@google.com>
9754
9755         * descriptors.cc: Include "options.h".
9756         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9757         (Descriptors::open): Always use O_CLOEXEC when opening a new
9758         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9759         then set FD_CLOEXEC.
9760
9761         * sparc.cc (class Target_sparc): Add has_got_section.
9762         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9763         make sure we have a GOT section.
9764
9765         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9766         (Target_sparc::Scan::local): Likewise.
9767         (Target_sparc::Scan::global): Likewise.
9768         (Target_sparc::Relocate::relocate): Likewise.
9769         (Target_sparc::Relocate::relocate_tls): Likewise.
9770
9771         * symtab.cc (Symbol_table::define_default_version): New function,
9772         broken out of add_from_object.
9773         (Symbol_table::add_from_object): Call define_default_version.
9774         (Symbol_table::define_special_symbol): Add resolve_oldsym
9775         parameter.  Change all callers.  If the version for a symbol comes
9776         from a version script, resolve it with the symbol with the same
9777         name with no version.  Also add the symbol without a version if
9778         appropriate.
9779         (do_define_in_output_data): If resolving with oldsym, don't delete
9780         sym.
9781         (do_define_in_output_segment): Likewise.
9782         (do_define_as_constant): Likewise.
9783         * symtab.h (class Symbol_table): Update declarations.
9784
9785 2009-03-13  Ian Lance Taylor  <iant@google.com>
9786
9787         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9788         (Read_symbols::requeue): New function.
9789         (Read_symbols::do_read_symbols): If make_elf_object fails because
9790         the target type is not configured, and the file was searched for,
9791         issue a warning and retry with the next directory.
9792         (Add_symbols::run): If the file has an incompatible format, and
9793         it was searched for, requeue the Read_symbols task.  On error,
9794         release the object.
9795         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9796         dirindex parameter to constructor.  Change all callers.  Declare
9797         incompatible_warning and requeue.
9798         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9799         input_argument_ and input_group_ fields.  Add them to
9800         constructor.  Change all callers.
9801         (class Read_script): Add dirindex_ field.  Add it to constructor.
9802         Change all callers.
9803         * archive.cc (Archive::setup): Remove input_objects parameter.
9804         Change all callers.
9805         (Archive::get_file_and_offset): Likewise.
9806         (Archive::read_all_symbols): Likewise.
9807         (Archive::read_symbols): Likewise.
9808         (Archive::get_elf_object_for_member): Remove input_objects
9809         parameter.  Add punconfigured parameter.  Change all callers.
9810         (Archive::add_symbols): Change return type to bool.  Check return
9811         value of include_member.
9812         (Archive::include_all_members): Likewise.
9813         (Archive::include_member): Change return type to bool.  Return
9814         false if first included object has incompatible target.  Set
9815         included_member_ field.
9816         (Add_archive_symbols::run): If add_symbols returns false, requeue
9817         Read_symbols task.
9818         * archive.h (class Archive): Add included_member_ field.
9819         Initialize it in constructor.  Add input_file and searched_for
9820         methods.  Update declarations.
9821         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9822         input_argument_ fields.  Add them to constructor.  Change all
9823         callers.
9824         * script.cc: Include "target-select.h".
9825         (class Parser_closure): Add skip_on_incompatible_target_ and
9826         found_incompatible_target_ fields.  Add
9827         skip_on_incompatible_target parameter to constructor.  Change all
9828         callers.  Add methods skip_on_incompatible_target,
9829         clear_skip_on_incompatible_target, found_incompatible_target, and
9830         set_found_incompatible_target.
9831         (read_input_script): Add dirindex parameter.  Change all callers.
9832         If parser finds an incompatible target, requeue Read_symbols
9833         task.
9834         (script_set_symbol): Clear skip_on_incompatible_target in
9835         closure.
9836         (script_add_assertion, script_parse_option): Likewise.
9837         (script_start_sections, script_add_phdr): Likewise.
9838         (script_check_output_format): New function.
9839         * script.h (read_input_script): Update declaration.
9840         * script-c.h (script_check_output_format): Declare.
9841         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9842         (ignore_cmd): Remove OUTPUT_FORMAT.
9843         * fileread.cc (Input_file::Input_file): Add explicit this.
9844         (Input_file::will_search_for): New function.
9845         (Input_file::open): Add pindex parameter.  Change all callers.
9846         * fileread.h (class Input_file): Add input_file_argument method.
9847         Declare will_search_for.  Update declarations.
9848         * object.cc (make_elf_object): Add punconfigured parameter.
9849         Change all callers.
9850         * object.h (class Object): Make input_file public.  Add
9851         searched_for method.
9852         (make_elf_object): Update declaration.
9853         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9854         restart search.
9855         * dirsearch.h (class Dirsearch): Update declaration.
9856         * options.h (class General_options): Add --warn-search-mismatch.
9857         * parameters.cc (Parameters::is_compatible_target): New function.
9858         * parameters.h (class Parameters): Declare is_compatible_target.
9859         * workqueue.cc (Workqueue::add_blocker): New function.
9860         * workqueue.h (class Workqueue): Declare add_blocker.
9861
9862         * fileread.cc (Input_file::open): Remove options parameter.
9863         Change all callers.
9864         (Input_file::open_binary): Likewise.
9865         * script.cc (read_input_script): Likewise.
9866         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9867         options parameter from constructor.  Change all callers.
9868         (class Read_script): Likewise.
9869         * fileread.h (class Input_file): Update declarations.
9870         * script.h (read_input_script): Update declaration.
9871
9872 2009-03-10  Nick Clifton  <nickc@redhat.com>
9873
9874         * po/es.po: New Spanish translation.
9875
9876 2009-03-06  Cary Coutant  <ccoutant@google.com>
9877
9878         * options.cc (parse_short_option): Keep dash_z from registering itself.
9879
9880 2009-03-03  Ian Lance Taylor  <iant@google.com>
9881
9882         PR 9918
9883         * target-reloc.h (relocate_section): Pass output_section to
9884         relocate.
9885         * i386.cc (Target_i386::should_apply_static_reloc): Add
9886         output_section parameter.  Change all callers.
9887         (Target_i386::Relocate::relocate): Add output_section parameter.
9888         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9889         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9890         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9891         * testsuite/two_file_shared.sh: New script.
9892         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9893         (check_DATA): Add two_file_shared.dbg.
9894         (two_file_shared.dbg): New target.
9895         * testsuite/Makefile.in: Rebuild.
9896
9897 2009-03-01  Ian Lance Taylor  <iant@google.com>
9898
9899         * configure.ac: Check for byteswap.h.
9900         * configure: Rebuild.
9901         * config.in: Rebuild.
9902
9903 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9904
9905         * layout.cc (Layout::find_or_add_kept_section): New function.
9906         (Layout::add_comdat): Removed.
9907         * layout.h (struct Kept_section): Move out of class Layout.
9908         Remove trailing underscores from field names.  Add group_sections
9909         field.  Rename group_ field to is_group.  Change all uses.
9910         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9911         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9912         comdat_groups_ field.
9913         (Sized_relobj::include_section_group): Use
9914         find_or_add_kept_section and Kept_section::group_sections.
9915         (Sized_relobj::include_linkonce_section): Likewise.
9916         * object.cc (class Sized_relobj): Don't define Comdat_group or
9917         Comdat_group_table.  Remove find_comdat_group and
9918         add_comdat_group.  Remove comdat_groups_ field.
9919         * plugin.cc (include_comdat_group): Use
9920         Layout::find_or_add_kept_section.
9921
9922 2009-02-28  Ian Lance Taylor  <iant@google.com>
9923
9924         * README: --gc-sections and map files are now supported.  Document
9925         some build requirements.
9926
9927         PR 6992
9928         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9929         relocatable link set the value of the section symbol to zero.
9930         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9931         relocatable link don't include the section address in the local
9932         symbol value.
9933
9934 2009-02-27  Ian Lance Taylor  <iant@google.com>
9935
9936         PR 6811
9937         * options.h (class Search_directory): Add is_system_directory.
9938         (class General_options): Declare is_in_system_directory.
9939         * options.cc (get_relative_sysroot): Make static.
9940         (get_default_sysroot): Make static.
9941         (General_optoins::is_in_system_directory): New function.
9942         * fileread.cc (Input_file::is_in_system_directory): New function.
9943         * fileread.h (class Input_file): Declare is_in_system_directory.
9944         * object.h (class Object): Add is_in_system_directory.
9945         (class Input_objects): Remove system_library_directory_ field.
9946         * object.cc (Input_objects::add_object): Don't set
9947         system_library_directory_.
9948         (input_objects::found_in_system_library_directory): Remove.
9949         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9950         parameter.  Change all callers.
9951         (Symbol_table::sized_write_globals): Likewise.
9952         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9953         Call Object::is_in_system_directory.
9954         * symtab.h (class Symbol_table): Update declarations.
9955
9956         PR 5990
9957         * descriptors.h (Open_descriptor): Add is_on_stack field.
9958         * descriptors.cc (Descriptors::open): If the descriptor is on the
9959         top of the stack, remove it.  Initialize is_on_stack field.
9960         (Descriptors::release): Only add pod to stack if it is not on the
9961         stack already.
9962         (Descriptors::close_some_descriptor): Clear stack_next and
9963         is_on_stack fields.
9964
9965         PR 7091
9966         * output.cc (Output_section::find_starting_output_address): Rename
9967         from starting_output_address; add PADDR parameter; change return
9968         type.
9969         * output.h (class Output_section): Declare
9970         find_starting_output_address instead of starting_output_address.
9971         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9972         section symbol for which we can't find a merge section.
9973
9974         PR 9836
9975         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9976         hidden or internal, force the symbol to be local.
9977         * resolve.cc (Symbol::override_visibility): Define.
9978         (Symbol::override_base): Use override_visibility.
9979         (Symbol_table::resolve): Likewise.
9980         (Symbol::override_base_with_special): Likewise.
9981         (Symbol_table::override_with_special): If the visibility is hidden
9982         or internal, force the symbol to be local.
9983         * symtab.h (class Symbol): Add set_visibility and
9984         override_visibility.
9985         * testsuite/ver_test_1.sh: New file.
9986         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9987         (check_DATA): Add ver_test_1.syms.
9988         (ver_test_1.syms): New target.
9989         * testsuite/Makefile.in: Rebuild.
9990
9991 2009-02-25  Cary Coutant  <ccoutant@google.com>
9992
9993         * layout.cc (Layout::choose_output_section): Don't rename sections
9994         when using a linker script that has a SECTIONS clause.
9995         * Makefile.in: Regenerate.
9996
9997         * testsuite/Makefile.am (script_test_5.sh): New test case.
9998         * testsuite/Makefile.in: Regenerate.
9999         * testsuite/script_test_5.cc: New file.
10000         * testsuite/script_test_5.sh: New file.
10001         * testsuite/script_test_5.t: New file.
10002
10003 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10004
10005         * archive.cc (Archive::include_member): Update calls to add_symbols.
10006         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10007         the Layout argument.
10008         * dynobj.h (do_add_symbols): Add the Layout argument.
10009         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10010         Layout argument.
10011         * object.h (Object::add_symbols): Add the Layout argument.
10012         (Object::do_add_symbols): Add the Layout argument.
10013         (Sized_relobj::do_add_symbols): Add the Layout argument.
10014         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10015         Unify the two versions.
10016         (Add_plugin_symbols): Remove.
10017         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10018         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10019         (Add_plugin_symbols): Remove.
10020         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10021         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10022         (Add_symbols::run): Make it work with Pulginobj.
10023
10024 2009-02-06  Ian Lance Taylor  <iant@google.com>
10025
10026         * object.cc (Sized_relobj::do_layout): Make info message start
10027         with lower case letter.
10028
10029 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10030
10031         * binary.cc: Fix file comment.
10032
10033         * options.h (enum Incremental_disposition): Define.
10034         (class General_options): Add new options: --incremental,
10035         --incremental_changed, --incremental_unchanged,
10036         --incremental_unknown.  Add incremental_disposition_ and
10037         implicit_incremental_ fields.
10038         (General_options::incremental_disposition): New function.
10039         (class Position_dependent_options): Add incremental_disposition
10040         option.
10041         (Position_dependent_options::copy_from_options): Set incremental
10042         dispositions.
10043         * options.cc (General_options::parse_incremental_changed): New
10044         function.
10045         (General_options::parse_incremental_unchanged): New function.
10046         (General_options::parse_incremental_unknown): New function.
10047         (General_options::General_options): Initialize new fields
10048         incremental_disposition_ and implicit_incremental_.
10049         (General_options::finalize): Check for uasge of --incremental-*
10050         without --incremental.
10051
10052 2009-02-06  Chris Demetriou  <cgd@google.com>
10053
10054         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10055         pointer and to report location as the file name associated with
10056         the symbol.
10057         (gold_undefined_symbol_at_location): New function to replace the
10058         old gold_undefined_symbol functionality.
10059         * target-reloc.h (relocate_section): Update to use
10060         gold_undefined_symbol_at_location.
10061         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10062         Call gold_undefined_symbol function rather than gold_error.
10063         * errors.h (Errors::undefined_symbol): Take location as a
10064         string, rather than calculating it from a relocation.
10065         * errors.cc (Errors::fatal): Print "fatal error:" before the
10066         formatted message.
10067         (Errors::error, Errors::error_at_location): Print "error: "
10068         before the formatted message.
10069         (Errors::undefined_symbol): Take location as a string, rather
10070         than calculating it from a relocation.
10071         (gold_undefined_symbol_at_location): New function akin to
10072         old gold_undefined_symbol, calculates location from relocation.
10073         (gold_undefined_symbol): Change to take only a Symbol pointer
10074         and to report location as the file name associated with the symbol.
10075         * testsuite/debug_msg.sh: Update for changed error messages.
10076         * testsuite/undef_symbol.sh: Likewise.
10077
10078 2009-02-04  Duncan Sands  <baldrick@free.fr>
10079
10080         PR 9812
10081         * reduced_debug_output.h
10082         (Output_reduced_debug_abbrev_section::failed): Use format for
10083         gold_warning.
10084         (Output_reduced_debug_info_section::faild): Likewise.
10085
10086 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10087
10088         * script.cc (Lazy_demangler): New class.
10089         (Version_script_info::get_symbol_version_helper): Demangle a
10090         symbol only once.
10091
10092 2009-01-29  Cary Coutant  <ccoutant@google.com>
10093
10094         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10095         to __tls_get_addr.
10096         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10097
10098 2009-01-28  Ian Lance Taylor  <iant@google.com>
10099
10100         * version.cc (version_string): Bump to 1.9.
10101
10102         * gold.h: Include <cstring> and <stdint.h>.
10103         * version.cc: Include <cstdio>.
10104         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10105         warning.
10106         * reduced_debug_output.cc (insert_into_vector): Rename from
10107         Insert_into_vector; change all callers.  Use Swap_unaligned to
10108         avoid aliasing issue; remove union since it is unnecessary.
10109
10110 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10111
10112         * Makefile.am (CCFILES): Add gc.cc.
10113         (HFILES): Add gc.h.
10114         * Makefile.in: Regenerate.
10115         * gold.cc (Gc_runner): New class.
10116         (queue_initial_tasks): Call garbage collection related tasks
10117         when corresponding options are invoked.
10118         (queue_middle_gc_tasks): New function.
10119         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10120         processed early before laying out sections during garbage collection.
10121         * gold.h (queue_middle_gc_tasks): New function.
10122         (is_prefix_of): Move from "layout.cc".
10123         * i386.cc (Target_i386::gc_process_relocs): New function.
10124         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10125         * main.cc (main): Create object of class "Garbage_collection".
10126         * object.cc (Relobj::copy_symbols_data): New function.
10127         (Relobj::is_section_name_included): New function.
10128         (Sized_relobj::do_layout): Allow this function to be called twice
10129         during garbage collection and defer layout of section during the
10130         first call.
10131         * object.h (Relobj::get_symbols_data): New function.
10132         (Relobj::is_section_name_included): New function.
10133         (Relobj::copy_symbols_data): New function.
10134         (Relobj::set_symbols_data): New function.
10135         (Relobj::get_relocs_data): New function.
10136         (Relobj::set_relocs_data): New function.
10137         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10138         (Relobj::gc_process_relocs): New function.
10139         (Relobj::do_gc_process_relocs): New pure virtual function.
10140         (Relobj::sd_): New data member.
10141         (Sized_relobj::is_output_section_offset_invalid): New function.
10142         (Sized_relobj::do_gc_process_relocs): New function.
10143         * options.h (General_options::gc_sections): Modify to not be a no-op.
10144         (General_options::print_gc_sections): New option.
10145         * plugin.cc (Plugin_finish::run): Remove function call to
10146         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10147         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10148         * reloc.cc (Read_relocs::run): Add task to process relocs and
10149         determine unreferenced sections when doing garbage collection.
10150         (Gc_process_relocs): New class.
10151         (Sized_relobj::do_gc_process_relocs): New function.
10152         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10153         sections that are garbage collected.
10154         * reloc.h (Gc_process_relocs): New class.
10155         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10156         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10157         symbols whose corresponding sections are garbage collected.
10158         (Symbol_table::Symbol_table): Add new parameter for the garbage
10159         collection object.
10160         (Symbol_table::gc_mark_undef_symbols): New function.
10161         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10162         (Symbol_table::gc_mark_dyn_syms): New function.
10163         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10164         as garbage.
10165         (Symbol_table::add_from_object): Likewise.
10166         (Symbol_table::add_from_relobj): When building shared objects, do not
10167         treat externally visible symbols as garbage.
10168         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10169         table information for static and relocatable links.
10170         * symtab.h (Symbol_table::set_gc): New function.
10171         (Symbol_table::gc): New function.
10172         (Symbol_table::gc_mark_undef_symbols): New function.
10173         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10174         (Symbol_table::gc_mark_dyn_syms): New function.
10175         (Symbol_table::gc_): New data member.
10176         * target.h (Sized_target::gc_process_relocs): New pure virtual
10177         function.
10178         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10179         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10180
10181 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10182
10183         * options.h (General_options::gc_sections): Define as a no-op for now.
10184         (General_options::no_keep_memory): Ditto.
10185         (General_options::Bshareable): Define.
10186         * options.cc (General_options::finalize): Honor -Bshareable.
10187
10188 2009-01-20  Andreas Schwab  <schwab@suse.de>
10189
10190         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10191         read the value in the contents, since we don't use it.  Use the
10192         template endianness when writing.
10193         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10194
10195 2009-01-19  Andreas Schwab  <schwab@suse.de>
10196
10197         * configure.tgt (powerpc64-*): Fix targ_obj.
10198
10199 2009-01-15  Ian Lance Taylor  <iant@google.com>
10200
10201         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10202         local symbols when stripping all symbols.
10203
10204 2009-01-14  Cary Coutant  <ccoutant@google.com>
10205
10206         * output.cc (Output_reloc): Add explicit instantiations.
10207
10208 2009-01-14  Cary Coutant  <ccoutant@google.com>
10209
10210         * archive.cc (Archive::get_elf_object_for_member): Remove call
10211         to File_read::claim_for_plugin.
10212         * descriptors.cc (Descriptors::open): Remove reference to
10213         is_claimed.
10214         (Descriptors::claim_for_plugin): Remove.
10215         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10216         (Descriptors::is_claimed): Remove.
10217         (claim_descriptor_for_plugin): Remove.
10218         * fileread.cc (File_read::claim_for_plugin): Remove.
10219         * fileread.h (File_read::claim_for_plugin): Remove.
10220         (File_read::descriptor): Reopen descriptor if necessary.
10221         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10222         (Plugin_manager::all_symbols_read): Add task parameter. Change
10223         all callers.
10224         (Plugin_manager::get_input_file): New function.
10225         (Plugin_manager::release_input_file): New function.
10226         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10227         corresponding data member.
10228         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10229         and pass to base constructor. Change all callers.
10230         (get_input_file, release_input_file): New functions.
10231         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10232         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10233         (Plugin_manager::all_symbols_read): Add task parameter.
10234         (Plugin_manager::get_input_file): New function.
10235         (Plugin_manager::release_input_file): New function.
10236         (Plugin_manager::task_): New data member.
10237         (Pluginobj::Pluginobj): Add filesize parameter.
10238         (Pluginobj::filename): New function.
10239         (Pluginobj::descriptor): New function.
10240         (Pluginobj::filesize): New function.
10241         (Pluginobj::filesize_): New data member.
10242         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10243         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10244         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10245
10246         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10247         with archive libraries.
10248         * testsuite/Makefile.in: Regenerate.
10249         * testsuite/plugin_test.c (struct sym_info): New type.
10250         (get_input_file, release_input_file): New static variables.
10251         (onload): Capture new transfer vector entries.
10252         (claim_file_hook): Stop reading at end of file according to filesize.
10253         Factor out parsing of readelf output into separate function.
10254         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10255         APIs and get the source file name from the symbol table.  Convert
10256         source file name to corresponding object file name.  Print info
10257         message when adding new input files.
10258         (parse_readelf_line): New function.
10259         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10260         * testsuite/plugin_test_2.sh: Likewise.
10261         * testsuite/plugin_test_3.sh: Likewise.
10262         * testsuite/plugin_test_4.sh: New test case.
10263
10264 2009-01-07  Ian Lance Taylor  <iant@google.com>
10265
10266         * version.cc (version_string): Bump to 1.8.
10267
10268 2008-12-23  Cary Coutant  <ccoutant@google.com>
10269
10270         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10271         * plugin.cc (Plugin_manager::finish): Rename as
10272         layout_deferred_objects.  Move cleanup to separate function.
10273         (Plugin_manager::cleanup): New function.
10274         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10275         separately.
10276         * plugin.h (Plugin_manager::finish): Rename as
10277         layout_deferred_objects.
10278         (Plugin_manager::cleanup): New function.
10279         (Plugin_manager::cleanup_done): New field.
10280
10281 2008-12-23  Cary Coutant  <ccoutant@google.com>
10282
10283         * plugin.cc (is_visible_from_outside): New function.
10284         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10285         so we don't return "IR only" status for exported symbols or -r links.
10286
10287         * testsuite/Makefile.am (plugin_test_3): New test case.
10288         * testsuite/Makefile.in: Regenerate.
10289         * testsuite/plugin_test_3.sh: New file.
10290
10291 2008-12-22  Cary Coutant  <ccoutant@google.com>
10292
10293         * object.cc (Sized_relobj::layout_section): New function.
10294         (Sized_relobj::do_layout): Defer layout of input sections until after
10295         plugin has provided replacement files.
10296         (Sized_relobj::do_layout_deferred_sections): New function.
10297         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10298         (Relobj::layout_deferred_sections): New function.
10299         (Relobj::do_layout_deferred_sections): New function.
10300         (Sized_relobj::do_layout_deferred_sections): New function.
10301         (Sized_relobj::layout_section): New function.
10302         (Sized_relobj::Deferred_layout): New structure.
10303         (Sized_relobj::deferred_layout_): New field.
10304         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10305         Change all callers.  Layout deferred sections.
10306         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10307         references.
10308         (Plugin_hook::run): Move code from do_plugin_hook inline.
10309         (Plugin_hook::do_plugin_hook): Remove.
10310         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10311         (Plugin_manager::finish): Renamed, was cleanup.
10312         (Plugin_manager::should_defer_layout): New function.
10313         (Plugin_manager::add_deferred_layout_object): New function.
10314         (Plugin_manager::Deferred_layout_list): New type.
10315         (Plugin_manager::deferred_layout_objects_): New field.
10316         (Plugin_hook::do_plugin_hook): Remove.
10317
10318 2008-12-17  Ian Lance Taylor  <iant@google.com>
10319
10320         * options.h (class General_options): Add --no case for
10321         --export-dynamic.
10322
10323 2008-12-16  Cary Coutant  <ccoutant@google.com>
10324
10325         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10326         vector.
10327         (Plugin_manager::claim_file): Create plugin object even if
10328         plugin did not call the add_symbols callback.
10329         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10330         asking for more symbols than were added.
10331         * testsuite/Makefile.am (plugin_test_1): Add test case with
10332         no global symbols.
10333         (empty.syms): New target.
10334         * testsuite/Makefile.in: Regenerate.
10335         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10336         message. Don't call add_symbols if no globals.
10337         (all_symbols_read_hook): Don't provide replacement for empty
10338         claimed file.
10339
10340 2008-12-12  Ian Lance Taylor  <iant@google.com>
10341
10342         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10343         r_type == 0 for a local symbol with r_sym == 0.
10344         (scan_relocatable_relocs): Pass r_sym to
10345         local_non_section_strategy.
10346         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10347         r_sym parameter.
10348
10349         * configure.ac: Update test for TLS descriptors: they are
10350         supported as of glibc 2.9.
10351         * configure: Rebuild.
10352
10353 2008-12-11  Ian Lance Taylor  <iant@google.com>
10354
10355         PR 7091
10356         * target-reloc.h (Default_scan_relocatable_relocs): For each
10357         function, map r_type == 0 to RELOC_DISCARD.
10358
10359 2008-12-10  Cary Coutant  <ccoutant@google.com>
10360
10361         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10362         object to override a kept COMDAT group from a plugin object.
10363
10364 2008-12-09  Ian Lance Taylor  <iant@google.com>
10365
10366         PR 7088
10367         * yyscript.y (file_cmd): Handle INPUT.
10368
10369         * testsuite/initpri1.c: Change all declarations to be full
10370         prototypes by adding void, to avoid compiler warnings.
10371
10372 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10373
10374         * options.cc (General_options::parse_plugin_opt): New.
10375         (General_options::add_plugin): The argument now is just the filename.
10376         (General_options::add_plugin_option): New.
10377         * options.h (plugin_opt): New.
10378         (add_plugin): Change argument name.
10379         (add_plugin_option): New.
10380         * plugin.cc (Plugin::load): Don't parse the plugin option.
10381         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10382         (Plugin::add_option): New.
10383         (Plugin::args_): Change type.
10384         (Plugin::filename_): New.
10385         (Plugin_manager::add_plugin_option): New.
10386         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10387         * testsuite/Makefile.in: Regenerate.
10388
10389 2008-12-05  Cary Coutant  <ccoutant@google.com>
10390
10391         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10392         Handle --strip-lto-sections option.
10393         * options.h (strip_lto_sections): New option.
10394
10395 2008-12-01  Cary Coutant  <ccoutant@google.com>
10396
10397         * plugin.cc (ld_plugin_message): Change format parameter to const.
10398         Fix mismatch between new[] and delete.
10399
10400 2008-11-14  Cary Coutant  <ccoutant@google.com>
10401
10402         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10403         instead of -1U.
10404
10405 2008-11-05  Craig Silverstein  <csilvers@google.com>
10406
10407         * options.cc (General_options::parse_dynamic_list): New function.
10408         * options.h (General_options): New flags dynamic_list,
10409         dynamic_list_data, dynamic_list_cpp_new, and
10410         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10411         (General_options::in_dynamic_list): New function.
10412         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10413         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10414         (Lex::can_continue_name): Likewise.
10415         (yylex): Likewise.
10416         (read_script_file): New parameter script_options.
10417         (read_dynamic_list): New function.
10418         (Script_options::define_dynamic_list): New function.
10419         (dynamic_list_keyword_parsecodes): New variable.
10420         (dynamic_list_keywords): New variable.
10421         * script.h (Script_options::define_dynamic_list): New function
10422         prototype.
10423         (read_dynamic_list): New function prototype.
10424         * symtab.cc (strprefix): New macro.
10425         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10426         dynamic_list_data, dynamic_list_cpp_new, and
10427         dynamic_list_cpp_typeinfo.
10428         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10429         (dynamic_list_expr): New rule.
10430         (dynamic_list_nodes): Likewise.
10431         (dynamic_list_node): Likewise.
10432         * testsuite/Makefile.am (dynamic_list): New test.
10433         * testsuite/Makefile.in: Regenerated.
10434         * testsuite/dynamic_list.t: New file.
10435         * testsuite/dynamic_list.sh: New file.
10436
10437 2008-11-05  Craig Silverstein  <csilvers@google.com>
10438
10439         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10440         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10441         (t11_last): Likewise.
10442         * testsuite/ver_test_6.c (main): Likewise.
10443
10444 2008-10-07  Cary Coutant  <ccoutant@google.com>
10445
10446         * options.c (General_options::finalize): Add check for -static and
10447         -shared.
10448         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10449         is not empty.
10450
10451 2008-10-02  Cary Coutant  <ccoutant@google.com>
10452
10453         * plugin.cc (make_sized_plugin_object): Fix conditional
10454         compilation to work when not all targets are enabled.
10455
10456 2008-09-29  Cary Coutant  <ccoutant@google.com>
10457
10458         * archive.cc (Archive::get_file_and_offset): Use filename instead
10459         of name to get library path.
10460         (Archive::include_member): Unlock external member of a thin archive.
10461
10462         * testsuite/Makefile.am (TEST_AR): New variable.
10463         (thin_archive_test_1): New test.
10464         (thin_archive_test_2): New test.
10465         * testsuite/Makefile.in: Regenerate.
10466         * testsuite/thin_archive_main.cc: New file.
10467         * testsuite/thin_archive_test_1.cc: New file.
10468         * testsuite/thin_archive_test_2.cc: New file.
10469         * testsuite/thin_archive_test_3.cc: New file.
10470         * testsuite/thin_archive_test_4.cc: New file.
10471
10472 2008-09-29  Cary Coutant  <ccoutant@google.com>
10473
10474         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10475         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10476         instead of -1U.
10477         (Sized_relobj::do_finalize_local_symbols): Likewise.
10478         (Sized_relobj::map_to_kept_section): Likewise.
10479         * object.h (Sized_relobj::invalid_address): New constant.
10480         (Sized_relobj::do_output_section_offset): Check for invalid_address
10481         and return -1ULL.
10482         * output.cc (Output_reloc::local_section_offset): Use constant
10483         invalid_address instead of -1U.
10484         (Output_reloc::get_address): Likewise.
10485         (Output_section::output_address): Change -1U to -1ULL.
10486         * output.h (Output_reloc::invalid_address): New constant.
10487         * reloc.cc (Sized_relobj::write_sections): Use constant
10488         invalid_address instead of -1U.
10489         (Sized_relobj::relocate_sections): Likewise.
10490         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10491         values for merge sections.
10492         * target-reloc.h (relocate_for_relocatable): Use constant
10493         invalid_address instead of -1U.
10494
10495 2008-09-19  Cary Coutant  <ccoutant@google.com>
10496
10497         Add plugin functionality for link-time optimization (LTO).
10498         * configure.ac (plugins): Add --enable-plugins option.
10499         * configure: Regenerate.
10500         * config.in: Regenerate.
10501         * Makefile.am (LIBDL): New variable.
10502         (CCFILES): Add plugin.cc.
10503         (HFILES): Add plugin.h.
10504         (ldadd_var): Add LIBDL.
10505         * Makefile.in: Regenerate.
10506
10507         * archive.cc: Include "plugin.h".
10508         (Archive::setup): Don't preread archive symbols when using a plugin.
10509         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10510         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10511         files.
10512         (Archive::include_member): Add symbols from plugin objects.
10513         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10514         * descriptors.cc (Descriptors::open): Check for file descriptors
10515         abandoned by plugins.
10516         (Descriptors::claim_for_plugin): New function.
10517         * descriptors.h (Descriptors::claim_for_plugin): New function.
10518         (Open_descriptor::is_claimed): New field.
10519         (claim_descriptor_for_plugin): New function.
10520         * fileread.cc (File_read::claim_for_plugin): New function.
10521         * fileread.h (File_read::claim_for_plugin): New function.
10522         (File_read::descriptor): New function.
10523         * gold.cc: Include "plugin.h".
10524         (queue_initial_tasks): Add task to call plugin hooks for generating
10525         new object files.
10526         * main.cc: Include "plugin.h".
10527         (main): Load plugin libraries.
10528         * object.h (Pluginobj): Declare.
10529         (Object::pluginobj): New function.
10530         (Object::do_pluginobj): New function.
10531         (Object::set_target): New function.
10532         * options.cc: Include "plugin.h".
10533         (General_options::parse_plugin): New function.
10534         (General_options::General_options): Initialize plugins_ field.
10535         (General_options::add_plugin): New function.
10536         * options.h (Plugin_manager): Declare.
10537         (General_options): Add --plugin option.
10538         (General_options::has_plugins): New function.
10539         (General_options::plugins): New function.
10540         (General_options::add_plugin): New function.
10541         (General_options::plugins_): New field.
10542         * plugin.cc: New file.
10543         * plugin.h: New file.
10544         * readsyms.cc: Include "plugin.h".
10545         (Read_symbols::do_read_symbols): Check for archive before checking
10546         for ELF file.  Call plugin hooks to claim files.
10547         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10548         from a real object file; force override when processing replacement
10549         files.
10550         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10551         (Symbol::init_base_object): Likewise.
10552         (Symbol::init_base_output_data): Likewise.
10553         (Symbol::init_base_output_segment): Likewise.
10554         (Symbol::init_base_constant): Likewise.
10555         (Symbol::init_base_undefined): Likewise.
10556         (Symbol::output_section): Assert that object is not a plugin.
10557         (Symbol_table::add_from_pluginobj): New function.
10558         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10559         undefined.
10560         (Symbol_table::sized_write_globals): Likewise.
10561         (Symbol_table::add_from_pluginobj): Instantiate template.
10562         * symtab.h (Sized_pluginobj): Declare.
10563         (Symbol::in_real_elf): New function.
10564         (Symbol::set_in_real_elf): New function.
10565         (Symbol::in_real_elf_): New field.
10566         (Symbol_table::add_from_pluginobj): New function.
10567
10568         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10569         (LIBDL): New variable.
10570         (LDADD): Add LIBDL.
10571         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10572         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10573         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10574         (MOSTLYCLEANFILES): Likewise.
10575         * testsuite/Makefile.in: Regenerate.
10576         * testsuite/plugin_test.c: New file.
10577         * testsuite/plugin_test_1.sh: New file.
10578         * testsuite/plugin_test_2.sh: New file.
10579
10580 2008-09-16  Ian Lance Taylor  <iant@google.com>
10581
10582         * target-reloc.h (relocate_section): Check whether a symbol is
10583         defined by the ABI before reporting an undefined symbol error.
10584         * target.h (Target::is_defined_by_abi): Make parameter const.
10585         (Target::do_is_defined_by_abi): Likewise.
10586         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10587         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10588         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10589         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10590         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10591         * testsuite/Makefile.in: Rebuild.
10592
10593         * fileread.cc (make_view): Add casts to avoid warning.
10594
10595 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10596
10597         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10598         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10599
10600 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10601
10602         * options.h (General_options::output_is_executable): New.
10603         (General_options::output_is_pie): New.
10604         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10605         for shared libraries.
10606         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10607
10608 2008-09-11  Chris Demetriou  <cgd@google.com>
10609
10610         * options.h (origin): New -z option.
10611         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10612         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10613         in DT_FLAGS_1.
10614
10615 2008-09-05  Cary Coutant  <ccoutant@google.com>
10616
10617         * fileread.cc (File_read::make_view): Add check for attempt to map
10618         beyond end of file.
10619
10620 2008-09-05  Cary Coutant  <ccoutant@google.com>
10621
10622         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10623         explicit instantiations.
10624
10625 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10626
10627         PR gold/6858
10628         * options.cc (General_options::finalize): Allow undefined symbols
10629         in shlibs if linking -shared.
10630
10631         PR gold/6859
10632         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10633         symbols as not needing a dynsym entry.
10634
10635 2008-08-20  Craig Silverstein  <csilvers@google.com>
10636
10637         * fileread.cc (File_read::open): Do not lock the file unless it
10638         was successfully opened.
10639
10640 2008-08-14  Cary Coutant  <ccoutant@google.com>
10641
10642         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10643         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10644         * testsuite/tls_test.cc (struct int128): 128-bit struct
10645         for testing TLS relocs with non-zero addend.
10646         (v12): New TLS variable.
10647         (t12): New test.
10648         (t_last): Add check for v12.
10649         * testsuite/tls_test.h (t12): New function.
10650         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10651
10652 2008-08-13  Ian Lance Taylor  <iant@google.com>
10653
10654         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10655         set tls_segment_ or relro_segment_.
10656         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10657         when appropriate.
10658         * output.h (Output_section::clear_is_relro): New function.
10659         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10660         sections specially even when output_data_ is empty.
10661         (Output_segment::maximum_alignment): When first section is relro,
10662         only force alignment for PT_LOAD segments.
10663         * script.cc (script_data_segment_align): New function.
10664         (script_data_segment_relro_end): New function.
10665         * script-c.h (script_data_segment_align): Declare.
10666         (script_data_segment_relro_end): Declare.
10667         * script-sections.h (class Script_sections): Declare
10668         data_segment_align and data_segment_relro_end.  Add fields
10669         segment_align_index_ and saw_relro_end_.
10670         * script-sections.cc (class Sections_element): Add set_is_relro
10671         virtual function.  Add new bool* parameter to place_orphan_here.
10672         Add get_output_section virtual function.
10673         (class Output_section_definition): Add set_is_relro.  Add new
10674         bool* parameter to place_orphan_here.  Add get_output_section.
10675         Add is_relro_ field.
10676         (Output_section_definition::Output_section_definition): Initialize
10677         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10678         and is_relro_ fields.
10679         (Output_section_definition::place_orphan_here): Add is_relro
10680         parameter.
10681         (Output_section_definition::set_section_addresses): Set relro for
10682         output section.
10683         (Output_section_definition::alternate_constraint): Likewise.
10684         (class Orphan_output_section): Add new bool* parameter to
10685         place_orphan_here.  Add get_output_section.
10686         (Orphan_output_section::place_orphan_here): Add is_relro
10687         parameter.
10688         (Script_sections::Script_sections): Initialize
10689         data_segment_align_index_ and saw_relro_end_.
10690         (Script_sections::data_segment_align): New function.
10691         (Script_sections::data_segment_relro_end): New function.
10692         (Script_sections::place_orphan): Set or clear is_relro.
10693         (Script_sections::set_section_addresses): Force alignment of first
10694         TLS section.
10695         * yyscript.y (exp): Call script_data_segment_align and
10696         script_data_segment_relro_end.
10697         * testsuite/relro_script_test.t: New file.
10698         * testsuite/relro_test.cc (using_script): Declare.
10699         (t1, t2): Test using_script.
10700         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10701         (relro_script_test_SOURCES): Define.
10702         (relro_script_test_DEPENDENCIES): Define.
10703         (relro_script_test_LDFLAGS): Define.
10704         (relro_script_test_LDADD): Define.
10705         (relro_script_test.so): New target.
10706         * testsuite/Makefile.in: Rebuild.
10707
10708 2008-08-06  Cary Coutant <ccoutant@google.com>
10709
10710         * archive.cc (Archive::total_archives, Archive::total_members)
10711         (Archive::total_members_loaded): New variables.
10712         (Archive::setup): Add parameter.  Add option to preread
10713         archive symbols.
10714         (Archive::read_armap): Add counter.
10715         (Archive::get_file_and_offset): New function.
10716         (Archive::get_elf_object_for_member): New function.
10717         (Archive::read_all_symbols): New function.
10718         (Archive::read_symbols): New function.
10719         (Archive::add_symbols): Add counters.
10720         (Archive::include_all_members): Use armap to find members if it's
10721         already built.
10722         (Archive::include_member): Skip reading symbols if already read.
10723         Factored code into Archive::get_file_and_offset and
10724         Archive::get_elf_object_for_member.  Changed call to
10725         Mapfile::report_include_archive_member.
10726         (Archive::print_stats): New function.
10727         * archive.h: Declare Object and Read_symbols_data classes.
10728         (Archive::Archive): Add initializers for new members.
10729         (Archive::setup): Add parameter.
10730         (Archive::print_stats): New function.
10731         (Archive::total_archives, Archive::total_members)
10732         (Archive::total_members_loaded): New variables.
10733         (Archive::get_file_and_offset): New function.
10734         (Archive::get_elf_object_for_member): New function.
10735         (Archive::read_all_symbols): New function.
10736         (Archive::read_symbols): New function.
10737         (Archive::Archive_member): New class.
10738         (Archive::members_): New member.
10739         (Archive::num_members_): New member.
10740         * main.cc: Include archive.h.
10741         (main): Call Archive::print_stats.
10742         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10743         archive parameter; member_name is now the fully-decorated name.
10744         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10745         * options.h: (General_options): Add --preread-archive-symbols option.
10746         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10747         Archive::setup.
10748
10749 2008-08-04  Ian Lance Taylor  <iant@google.com>
10750
10751         * symtab.h (Symbol::use_plt_offset): New function.
10752         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10753         * powerpc.cc (Relocate::relocate): Likewise.
10754         * sparc.cc (Relocate::relocate): Likewise.
10755         * x86_64.cc (Relocate::relocate): Likewise.
10756         * testsuite/weak_plt.sh: New test.
10757         * testsuite/weak_plt_main.cc: New test.
10758         * testsuite/weak_plt_shared.cc: New test.
10759         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10760         (check_PROGRAMS): Add weak_plt.
10761         (check_DATA): Add weak_plt_shared.so.
10762         (weak_plt_main_pic.o, weak_plt): New targets.
10763         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10764         * testsuite/Makefile.in: Rebuild.
10765
10766         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10767         gcctestdir/ld.
10768         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10769         * testsuite/Makefile.in: Rebuild.
10770
10771 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10772
10773         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10774         * Makefile.in: Regenerate.
10775         * po/POTFILES.in: Regenerate.
10776
10777 2008-07-29  Ian Lance Taylor  <iant@google.com>
10778
10779         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10780         symbols before other symbols.
10781         * testsuite/script_test_2.cc (test_addr): Declare.
10782         (test_addr_alias): Declare.
10783         (main): Check that test_addr and test_addr_alias have the right
10784         values.
10785         * testsuite/script_test_2.t: Define test_addr_alias and
10786         test_addr.
10787
10788 2008-07-24  Ian Lance Taylor  <iant@google.com>
10789
10790         PR 5990
10791         * descriptors.cc: New file.
10792         * descriptors.h: New file.
10793         * gold-threads.h (class Hold_optional_lock): New class.
10794         * fileread.cc: Include "descriptors.h".
10795         (File_read::~File_read): Release descriptor rather than closing
10796         it.
10797         (File_read::open) [file]: Call open_descriptor rather than open.
10798         Set is_descriptor_opened_.
10799         (File_read::open) [memory]: Assert that descriptor is not open.
10800         (File_read::reopen_descriptor): New function.
10801         (File_read::release): Release descriptor.
10802         (File_read::do_read): Make non-const.  Reopen descriptor.
10803         (File_read::read): Make non-const.
10804         (File_read::make_view): Reopen descriptor.
10805         (File_read::do_readv): Likewise.
10806         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10807         Update declarations.
10808         * layout.cc: Include "descriptors.h".
10809         (Layout::create_build_id): Use open_descriptor rather than open.
10810         * output.cc: Include "descriptors.h".
10811         (Output_file::open): Use open_descriptor rather than open.
10812         * archive.cc (Archive::const_iterator): Change Archive to be
10813         non-const.
10814         (Archive::begin, Archive::end): Make non-const.
10815         (Archive::count_members): Likewise.
10816         * archive.h (class Archive): Update declarations.
10817         * object.h (Object::read): Make non-const.
10818         * Makefile.am (CCFILES): Add descriptors.cc.
10819         (HFILES): Add descriptors.h.
10820         * Makefile.in: Rebuild.
10821
10822         PR 6716
10823         * gold.h: Always include <clocale>.  Add Solaris workarounds
10824         following code in binutils/sysdep.h.
10825
10826         PR 6048
10827         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10828         this->eh_frame_hdr_ is NULL before using it.
10829
10830         * dynobj.cc (Versions::Versions): Update comment.
10831
10832         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10833         the base version name.
10834
10835         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10836         array size plus one.
10837         (Stringpool_template::set_string_offsets): Subtract one from key
10838         before using it as an array index.
10839         (Stringpool_template::get_offset_with_length): Likewise.
10840         (Stringpool_template::write_to_buffer): Likewise.
10841         * stringpool.h (Stringpool_template::get_offset_from_key):
10842         Likewise.
10843
10844 2008-07-23  Ian Lance Taylor  <iant@google.com>
10845
10846         PR 6658
10847         * object.h (Merged_symbol_value::value): Do our best to handle a
10848         negative addend.
10849
10850         PR 6647
10851         * script.cc (Version_script_info::get_versions): Don't add empty
10852         version tag to return value.
10853         (Version_script_info::get_symbol_version_helper): Change return
10854         type to bool.  Add pversion parameter.  Change all callers.
10855         (script_register_vers_node): Don't require a non-NULL tag.
10856         * script.h (class Version_script_info): Update declarations.
10857         (Version_script_info::get_symbol_version): Change return type to
10858         bool.  Add version parameter.  Change all callers.
10859         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10860         handling.  Handle an empty version from a version script.
10861         (Symbol_table::define_special_symbol): Likewise.
10862         * testsuite/ver_test_10.script: New file.
10863         * testsuite/ver_test_10.sh: New file.
10864         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10865         (check_DATA): Add ver_test_10.syms.
10866         (ver_test_10.syms, ver_test_10.so): New target.
10867         * testsuite/Makefile.in: Rebuild.
10868
10869 2008-07-23  Simon Baldwin  <simonb@google.com>
10870
10871         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10872         to zero for undefined symbols from dynamic libraries.
10873
10874 2008-07-23  Ian Lance Taylor  <iant@google.com>
10875
10876         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10877         Change all callers.
10878         * symtab.h (class Symbol_table): Update declaration.
10879         * testsuite/ver_test_9.cc: New file.
10880         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10881         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10882         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10883         (ver_test_9.so, ver_test_9.o): New targets.
10884         * testsuite/Makefile.in: Rebuild.
10885
10886 2008-07-22  Ian Lance Taylor  <iant@google.com>
10887
10888         * options.h (class General_options): Define --check-sections.
10889         * layout.cc (Layout::set_segment_offsets): Handle
10890         --check-sections.
10891
10892         * options.h (class General_options): Define -n/--nmagic and
10893         -N/--omagic.
10894         * options.cc (General_options::finalize): For -n/--nmagic or
10895         -N/--omagic, set -static.
10896         * layout.cc (Layout::attach_allocated_section_to_segment): If
10897         -N/--omagic, don't put read-only and read-write sections in
10898         different segments.
10899         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10900         finding a read-only segment.
10901         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10902         don't set the minimum segment alignment to the common page size,
10903         and don't set the file offset to the address modulo the page size.
10904         * script-sections.cc (Script_sections::create_segments): If
10905         -n/--omagic, don't put read-only and read-write sections in
10906         different segments.
10907
10908         * cref.cc: New file.
10909         * cref.h: New file.
10910         * options.h (class General_options): Add --print-symbol-counts.
10911         * main.cc (main): Issue defined symbol report if requested.
10912         * archive.cc (Archive::interpret_header): Make into a const member
10913         function.
10914         (Archive::add_symbols): Call Input_objects::archive_start and
10915         archive_stop.
10916         (Archive::const_iterator): Define new class.
10917         (Archive::begin, Archive::end): New functions.
10918         (Archive::include_all_members): Rewrite to use iterator.
10919         (Archive::count_members): New function.
10920         * archive.h (class Archive): Update declarations.
10921         (Archive::filename): New function.
10922         * object.cc: Include "cref.h".
10923         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10924         (Sized_relobj::do_get_global_symbol_counts): New function.
10925         (Input_objects::add_object): Add object to cross-referencer.
10926         (Input_objects::archive_start): New function.
10927         (Input_objects::archive_stop): New function.
10928         (Input_objects::print_symbol_counts): New function.
10929         * object.h: Declare Cref and Archive.
10930         (Object::get_global_symbol_counts): New function.
10931         (Object::do_get_global_symbol_counts): New pure virtual function.
10932         (class Sized_relobj): Add defined_count_ field.  Update
10933         declarations.
10934         (class Input_objects): Add cref_ field.  Update constructor.
10935         Update declarations.
10936         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10937         defined_count_.
10938         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10939         symbol counts.
10940         (Sized_dynobj::do_get_global_symbol_counts): New function.
10941         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10942         defined_count_.  Update declarations.  Define Symbols typedef.
10943         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10944         parameter.  Change all callers.
10945         (Symbol_table::add_from_dynobj): Add sympointers and defined
10946         parameters.  Change all callers.
10947         * symtab.h (class Symbol_table): Update declarations.
10948         * Makefile.am (CCFILES): Add cref.cc.
10949         (HFILES): Add cref.h.
10950         * Makefile.in: Rebuild.
10951
10952 2008-07-22  Simon Baldwin  <simonb@google.com>
10953
10954         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10955         to zero when writing undefined symbols.
10956
10957 2008-07-22  Ian Lance Taylor  <iant@google.com>
10958
10959         * output.cc (Output_section::add_input_section): Don't try to
10960         merge empty merge sections.
10961
10962 2008-07-21  Craig Silverstein  <csilvers@google.com>
10963
10964         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10965         Include symbol version in error message.
10966
10967 2008-07-20  Chris Demetriou  <cgd@google.com>
10968
10969         * configure.ac (gold_cv_c_random_seed): New configured variable.
10970         (RANDOM_SEED_CFLAGS): New substituted variable.
10971         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10972         * configure: Rebuild.
10973         * Makefile.in: Likewise.
10974         * testsuite/Makefile.in: Likewise.
10975
10976 2008-07-18  Ian Lance Taylor  <iant@google.com>
10977
10978         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10979         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10980         * testsuite/ver_test_main.cc (main): Call t4.
10981         (t4, t4_2a): Define.
10982         * testsuite/ver_test_2.cc (t4_2): Define.
10983         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10984         * testsuite/ver_test_4.cc (t4_2a): Define.
10985         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10986         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10987
10988 2008-07-17  Ian Lance Taylor  <iant@google.com>
10989
10990         * dynobj.cc (Versions::add_def): If we give an error about a
10991         missing version, go ahead and create the version anyhow.
10992
10993 2008-07-10  Ian Lance Taylor  <iant@google.com>
10994
10995         Handle output sections with more than 0x7fffffff bytes.
10996         * object.h (class Relobj): Change map_to_output_ to
10997         output_sections_, and just keep a section pointer.  Change all
10998         uses.  Move comdat group support to Sized_relobj.
10999         (Relobj::is_section_specially_mapped): Remove.
11000         (Relobj::output_section): Remove poff parameter.  Change all
11001         callers.
11002         (Relobj::output_section_offset): New function.
11003         (Relobj::set_section_offset): Rewrite.
11004         (Relobj::map_to_output): Remove.
11005         (Relobj::output_sections): New function.
11006         (Relobj::do_output_section_offset): New pure virtual function.
11007         (Relobj::do_set_section_offset): Likewise.
11008         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11009         group support from Relobj.  Update declarations.
11010         (Sized_relobj::get_output_section_offset): New function.
11011         (Sized_relobj::do_output_section_offset): New function.
11012         (Sized_relobj::do_set_section_offset): New function.
11013         * object.cc (Relobj::output_section_address): Remove.
11014         (Sized_relobj::Sized_relobj): Initialize new fields.
11015         (Sized_relobj::include_section_group): Cast find_kept_object to
11016         Sized_relobj.
11017         (Sized_relobj::include_linkonce_section): Likewise.
11018         (Sized_relobj::do_layout): Use separate arrays for output section
11019         and output offset.
11020         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11021         output_sections.
11022         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11023         output_sections and section_offsets.
11024         (Sized_relobj::write_local_symbols): Likewise.
11025         (map_to_kept_section): Compute output address directly.
11026         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11027         output_sections and section_offsets.
11028         (Sized_relobj::write_sections): Likewise.
11029         (Sized_relobj::relocate_sections): Likewise.
11030         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11031         * output.h (class Output_reloc): Update declarations.  Change
11032         u2_.relobj to Sized_relobj*.
11033         (class Output_data_reloc): Change add functions to use
11034         Sized_relobj*.
11035         * output.cc (Output_reloc::Output_reloc): Change relobj to
11036         Sized_relobj*.
11037         (Output_reloc::local_section_offset): Change return type to
11038         Elf_Addr.  Use get_output_section_offset.
11039         (Output_reloc::get_address): Likewise.
11040         (Output_section::is_input_address_mapped): Don't call
11041         is_section_specially_mapped.
11042         (Output_section::output_offset): Likewise.
11043         (Output_section::output_address): Likewise.
11044         (Output_section::starting_output_address): Likewise.
11045         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11046         parameter to Sized_relobj*.
11047         (Copy_relocs::need_copy_reloc): Likewise.
11048         (Copy_relocs::save): Likewise.
11049         * copy-relocs.h (class Copy_relocs): Update declarations.
11050         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11051         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11052         * target-reloc.h (relocate_for_relocatable): Change
11053         offset_in_output_section type to Elf_Addr.  Change code that uses
11054         it as well.
11055         * layout.cc (Layout::layout): Always set *off.
11056         * mapfile.cc (Mapfile::print_input_section): Use
11057         output_section_offset.
11058         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11059         Sized_relobj*.
11060         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11061         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11062         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11063
11064 2008-07-03  Ian Lance Taylor  <iant@google.com>
11065
11066         * layout.cc (Layout::include_section): Do not discard unrecognized
11067         SHT_STRTAB sections.
11068
11069 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11070
11071         * script.cc (Lex::can_continue_name): Make '?' allowable in
11072         version-script names.
11073         * testsuite/version_script.map: Change glob pattern to use '?'
11074
11075 2008-06-30  Manish Singh  <yosh@gimp.org>
11076
11077         PR 6585
11078         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11079         Correct typo.
11080
11081 2008-06-30  Ian Lance Taylor  <iant@google.com>
11082
11083         PR 6660
11084         PR 6682
11085         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11086         versions]: Don't try to read the value in the contents, since we
11087         don't use it.  Use the template endianness when writing.
11088
11089 2008-06-25  Cary Coutant  <ccoutant@google.com>
11090
11091         * fileread.cc (File_read::make_view): Assert on zero-length view.
11092         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11093         symbol table when there are no symbols to read.
11094
11095 2008-06-23  Craig Silverstein  <csilvers@google.com>
11096
11097         * version.cc (version_string): Bump to 1.7
11098
11099 2008-06-18  Craig Silverstein  <csilvers@google.com>
11100
11101         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11102         constant 0xFFFF to type Valtype.
11103         (Powerpc_relocate_functions::rel16_ha): Likewise.
11104
11105 2008-06-17  Ian Lance Taylor  <iant@google.com>
11106
11107         * output.h (Output_section::Input_section): Initialize p2align_ to
11108         zero for Output_section_data constructors.
11109         (Output_section::Input_section::addralign): If not an input
11110         section, return the alignment of the Output_section_data.
11111         * testsuite/copy_test.cc: New file.
11112         * testsuite/copy_test_1.cc: New file.
11113         * testsuite/copy_test_2.cc: New file.
11114         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11115         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11116         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11117         (copy_test_1_pic.o, copy_test_1.so): New targets.
11118         (copy_test_2_pic.o, copy_test_2.so): New targets.
11119         * testsuite/Makefile.in: Rebuild.
11120
11121         * script-sections.cc (Script_sections::place_orphan): Initialize
11122         local variable exact.
11123
11124 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11125
11126         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11127
11128 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11129             David S. Miller  <davem@davemloft.net>
11130
11131         * powerpc.cc: New file.
11132         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11133         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11134         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11135         * Makefile.in: Rebuild.
11136
11137 2008-06-09  Ian Lance Taylor  <iant@google.com>
11138
11139         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11140         <exception>.
11141         (throwing, orig_terminate): New static variables.
11142         (terminate_handler): New static function.
11143         (t2): Set terminate handler.
11144
11145 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11146
11147         PR 6584
11148         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11149         alignment.
11150
11151 2008-05-30  Cary Coutant  <ccoutant@google.com>
11152
11153         * archive.cc (Archive::include_all_members) Correct to step
11154         over symbol table and extended name table in thin archives.
11155
11156 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11157
11158         PR 6407
11159         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11160         calculation.
11161
11162 2008-05-28  Caleb Howe  <cshowe@google.com>
11163
11164         * reduced_debug_output.cc: New file.
11165         * reduced_debug_output.h: New file.
11166         * options.h (class General_options): Add --strip-debug-non-line.
11167         * options.cc (General_options::finalize): Add strip_debug_non_line
11168         to the strip heirarchy.
11169         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11170         fields.
11171         * layout.cc: Include "reduced_debug_output.h".
11172         (Layout::Layout): Initialize new fields.
11173         (line_only_debug_sections): New static array.
11174         (is_lines_only_debug_sections): New static inline function.
11175         (Layout::include_section): Handle --strip-debug-non-line.
11176         (Layout::make_output_section): If --strip-debug-non-line, build
11177         new output sections for .debug_abbrev and .debug_info.
11178         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11179         gold.  Warn about possible overflow.
11180         (read_signed_LEB_128): Likewise.
11181         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11182         (read_signed_LEB_128): Declare.
11183         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11184         (HFILES): Add reduced_debug_output.h.
11185         * Makefile.in: Rebuild.
11186
11187 2008-05-21  Ian Lance Taylor  <iant@google.com>
11188
11189         * mapfile.cc: New file.
11190         * mapfile.h: New file.
11191         * options.h (class General_options): Add -M/--print-map and -Map.
11192         * options.cc (General_options::finalize): Make -M equivalent to
11193         -Map -.
11194         * main.cc: Include <cstdio> and "mapfile.h".
11195         (main): Open mapfile if requested.
11196         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11197         constructor.  Change caller.
11198         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11199         (queue_middle_tasks): Likewise.
11200         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11201         declarations.
11202         * archive.cc: Include "mapfile.h".
11203         (Archive::add_symbols): Add mapfile parameter.  Change all
11204         callers.  Pass mapfile, symbol, and reason to include_member.
11205         (Archive::include_all_members): Add mapfile parameter.  Change all
11206         callers.
11207         (Archive::include_member): Add mapfile, sym, and why parameters.
11208         Change all callers.  Report inclusion to map file.
11209         * archive.h: Include "fileread.h".
11210         (class Archive): Update declarations.
11211         (Archive::file): New const method.
11212         (class Add_archive_symbols): Add mapfile_ field.  Update
11213         constructor.  Change all callers.
11214         * readsyms.h (class Read_symbols): Likewise.
11215         (class Finish_group): Likewise.
11216         (class Read_script): Likewise.
11217         * common.cc: Include "mapfile.h".
11218         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11219         all callers.
11220         (Symbol_table::do_allocate_commons): Likewise.
11221         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11222         symbol allocation to mapfile.
11223         * common.h (class Allocate_commons_task): Add mapfile_ field.
11224         Update constructor.  Change all callers.
11225         * symtab.h (class Symbol_table): Update declarations.
11226         * layout.cc: Include "mapfile.h".
11227         (Layout_task_runner::run): Print information to mapfile.
11228         (Layout::create_gold_note): Change Output_data_fixed_space to
11229         Output_data_zero_fill.
11230         (Layout::create_build_id): Likewise.
11231         (Layout::print_to_mapfile): New function.
11232         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11233         constructor.  Change caller.
11234         (class Layout): Declare print_to_mapfile.
11235         * output.cc (Output_section::Input_section::print_to_mapfile): New
11236         function.
11237         (Output_section::add_input_section): If producing a map, always
11238         add to input_sections_ list.
11239         (Output_section::do_print_to_mapfile): New function.
11240         (Output_segment::print_sections_to_mapfile): New function.
11241         (Output_segment::print_section_list_to_mapfile): New function.
11242         * output.h: Include "mapfile.h".
11243         (Output_data::print_to_mapfile): New function.
11244         (Output_data::do_print_to_mapfile): New virtual function.
11245         (Output_segment_headers::do_print_to_mapfile): New function.
11246         (Output_file_header::do_print_to_mapfile): New function.
11247         (Output_data_const::do_print_to_mapfile): New function.
11248         (class Output_data_const_buffer): Add map_name_ field.  Update
11249         constructor.  Change all callers.  Add do_print_to_mapfile
11250         function.
11251         (class Output_data_fixed_space): Likewise.
11252         (class Output_data_space): Likewise.
11253         (class Output_data_zero_fill): New class.
11254         (Output_data_strtab::do_print_to_mapfile): New function.
11255         (Output_data_reloc_base::do_print_to_mapfile): New function.
11256         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11257         (Output_data_group::do_print_to_mapfile): New function.
11258         (Output_data_got::do_print_to_mapfile): New function.
11259         (Output_data_dynamic::do_print_to_mapfile): New function.
11260         (Output_symtab_xindex::do_print_to_mapfile): New function.
11261         (class Output_section): Declare do_print_to_mapflie.  Declare
11262         print_to_mapfile in Input_section.
11263         (class Output_segment): Declare new functions.
11264         * object.h (Sized_relobj::symbol_count): New function.
11265         * script-sections.cc
11266         (Output_section_element_dot_assignment::set_section_addresses):
11267         Change Output_data_fixed_space to Output_data_zero_fill.
11268         (Output_data_expression::do_print_to_mapfile): New function.
11269         * script.cc (read_input_script): Add mapfile parameter.  Change
11270         all callers.
11271         * script.h (read_input_script): Update declaration.
11272         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11273         (Eh_frame::do_print_to_mapfile): New function.
11274         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11275         (Output_merge_string::do_print_to_mapfile): New function.
11276         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11277         function.
11278         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11279         function.
11280         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11281         function.
11282         * Makefile.am (CCFILES): Add mapfile.cc.
11283         (HFILES): Add mapfile.h.
11284         * Makefile.in: Rebuild.
11285
11286 2008-05-19  Ian Lance Taylor  <iant@google.com>
11287
11288         * options.h (class General_options): Add -z relro.
11289         * layout.cc (Layout::Layout): Initialize relro_segment_.
11290         (Layout::add_output_section_data): Return the output section.
11291         (Layout::make_output_section): Rcognize relro sections and mark
11292         them appropriately.
11293         (Layout::attach_allocated_section_to_segment): Put relro sections
11294         in a PT_GNU_RELRO segment.
11295         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11296         section as relro.
11297         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11298         PT_TLS segments.
11299         (Layout::linkonce_mapping): Map d.rel.ro.local to
11300         .data.rel.ro.local.
11301         (Layout::output_section_name): Us .data.rel.ro.local for any
11302         section which begins with that.
11303         * layout.h (class Layout): Update add_output_section_data
11304         declaration.  Add relro_segment_ field.
11305         * output.cc (Output_section::Output_section): Initialize is_relro_
11306         and is_relro_local_ fields.
11307         (Output_segment::add_output_section): Group relro sections.
11308         (Output_segment::is_first_section_relro): New function.
11309         (Output_segment::maximum_alignment): If there is a relro section,
11310         align the segment to the common page size.
11311         (Output_segment::set_section_addresses): Track whether we are
11312         looking at relro sections.  If the last section is a relro
11313         section, align to the common page size.
11314         (Output_segment::set_section_list_addresses): Add in_relro
11315         parameter.  Change all callers.  Align to the page size when
11316         moving from relro to non-relro section.
11317         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11318         segment.
11319         * output.h (class Output_section): Add is_relro_ and
11320         is_relro_local_ fields.
11321         (Output_section::is_relro): New function.
11322         (Output_section::set_is_relro): New function.
11323         (Output_section::is_relro_local): New function.
11324         (Output_section::set_is_relro_local): New function.
11325         (class Output_segment): Update declarations.
11326         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11327         * sparc.cc (Target_sparc::got_section): Likewise.
11328         * x86_64.cc (Target_x86_64::got_section): Likewise.
11329         * testsuite/relro_test_main.cc: New file.
11330         * testsuite/relro_test.cc: New file.
11331         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11332         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11333         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11334         (relro_test.so, relro_test_pic.o): New targets.
11335         * testsuite/Makefile.in: Rebuild.
11336
11337 2008-05-16  Ian Lance Taylor  <iant@google.com>
11338
11339         * output.cc (Output_segment::add_output_section): Remove front
11340         parameter.
11341         * output.h (class Output_segment): Remove
11342         add_initial_output_section and overloaded add_output_section.
11343         Update declaration of remaining add_output_section.
11344         * layout.cc (Layout::create_interp): Call add_output_section
11345         rather than add_initial_output_section.
11346         (Layout::finish_dynamic_section): Likewise.
11347
11348         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11349         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11350         know the dynamic type.
11351         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11352         field.  Initialize it in constructor.
11353         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11354         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11355         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11356         reloc.
11357
11358         * output.cc (Output_reloc::get_address): Change return type to
11359         Elf_Addr.
11360         * output.h (class Output_reloc): Update get_address declaration.
11361         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11362         for section addresses.
11363
11364 2008-05-09  Ian Lance Taylor  <iant@google.com>
11365
11366         PR 6493
11367         * gold.cc (gold_nomem): Use return value of write.
11368
11369 2008-05-08  Ian Lance Taylor  <iant@google.com>
11370
11371         * symtab.c (Symbol::init_base_output_data): Add version
11372         parameter.  Change all callers.
11373         (Symbol::init_base_output_segment): Likewise.
11374         (Symbol::init_base_constant): Likewise.
11375         (Symbol::init_base_undefined): Likewise.
11376         (Sized_symbol::init_output_data): Likewise.
11377         (Sized_symbol::init_output_segment): Likewise.
11378         (Sized_symbol::init_constant): Likewise.
11379         (Sized_symbol::init_undefined): Likewise.
11380         (Symbol_table::do_define_in_output_data): If the new symbol has a
11381         version, mark it as the default.
11382         (Symbol_table::do_define_in_output_segment): Likewise.
11383         (Symbol_table::do_define_as_constant): Likewise.
11384         * symtab.h (class Symbol): Update declarations.
11385         (class Sized_symbol): Likewise.
11386         * resolve.cc (Symbol::override_version): New function.
11387         (Symbol::override_base): Call override_version.
11388         (Symbol::override_base_with_special): Likewise.
11389         * testsuite/ver_script_8.script: New file.
11390         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11391         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11392         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11393         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11394
11395 2008-05-06  Ian Lance Taylor  <iant@google.com>
11396
11397         PR 6049
11398         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11399         functions.
11400         (class General_options): Remove existing --undefined, and add
11401         --no-undefined instead.  Add new --undefined as synonym for -u.
11402         * archive.cc (Archive::add_symbols): Check whether symbol was
11403         named with -u.
11404         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11405         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11406         all uses.  Add IS_UNDEFINED.  Update declarations to split
11407         different versions of init_base.  Declare init_base_undefined.
11408         (Symbol::is_defined): Handle IS_UNDEFINED.
11409         (Symbol::is_undefined): Likewise.
11410         (Symbol::is_weak_undefined): Call is_undefined.
11411         (Symbol::is_absolute): Handle IS_CONSTANT.
11412         (class Sized_symbol): Update declarations to split different
11413         versions of init.  Declare init_undefined.
11414         (class Symbol_table): Declare new functions.
11415         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11416         Change all callers.
11417         (Symbol::init_base_output_data): Likewise.
11418         (Symbol::init_base_output_segment): Likewise.
11419         (Symbol::init_base_constant): Likewise.
11420         (Symbol::init_base_undefined): New function.
11421         (Sized_symbol::init_object): Rename from init.  Change all
11422         callers.
11423         (Sized_symbol::init_output_data): Likewise.
11424         (Sized_symbol::init_output_segment): Likewise.
11425         (Sized_symbol::init_constant): Likewise.
11426         (Sized_symbol::init_undefined): New function.
11427         (Symbol_table::add_undefined_symbols_from_command_line): New
11428         function.
11429         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11430         function.
11431         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11432         (Symbol::output_section): Likewise.
11433         (Symbol::set_output_section): Likewise.
11434         (Symbol_table::sized_finalize_symbol): Likewise.
11435         (Symbol_table::sized_write_globals): Likewise.
11436         * resolve.cc (Symbol_table::should_override): Likewise.
11437         (Symbol::override_base_with_special): Likewise.
11438
11439         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11440         symbol, change it to have default visibility.
11441         * testsuite/protected_1.cc: New file.
11442         * testsuite/protected_2.cc: New file.
11443         * testsuite/protected_3.cc: New file.
11444         * testsuite/protected_main_1.cc: New file.
11445         * testsuite/protected_main_2.cc: New file.
11446         * testsuite/protected_main_3.cc: New file.
11447         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11448         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11449         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11450         (protected_1.so): New target.
11451         (protected_1_pic.o, protected_2_pic.o): New targets.
11452         (protected_3_pic.o): New target.
11453         (check_PROGRAMS): Add protected_2.
11454         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11455         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11456         * testsuite/Makefile.in: Rebuild.
11457
11458         * options.h (DEFINE_var): Add set_user_set_##varname__.
11459         (DEFINE_bool_alias): New macro.
11460         (class General_options): Define -Bstatic using DEFINE_bool_alias
11461         rather than DEFINE_special.  Add --undefined as an alias for -z
11462         defs.
11463         * options.cc (General_options::parse_Bstatic): Remove.
11464
11465         * options.h (class General_options): Add --fatal-warnings.
11466         * main.cc (main): Implement --fatal-warnings.
11467         * errors.h (Errors::warning_count): New function.
11468
11469         * options.h (class General_options): Add -Bsymbolic-functions.
11470         * symtab.h (Symbol::is_preemptible): Check for
11471         -Bsymbolic-functions.
11472
11473 2008-05-05  Ian Lance Taylor  <iant@google.com>
11474
11475         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11476         as noVARNAME rather than no-VARNAME.
11477         (class General_options): Add option -z combreloc.
11478         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11479         get_address.
11480         (Output_reloc::sort_before) [SHT_REL]: New function.
11481         (Output_reloc::sort_before) [SHT_RELA]: New function.
11482         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11483         Sort_relocs_comparison.
11484         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11485         parameter.  Change all callers.
11486         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11487         sort_relocs parameter.  Change all callers.
11488         * output.cc (Output_reloc::get_address): New function, broken out
11489         of write_rel.
11490         (Output_reloc::write_rel): Call it.
11491         (Output_reloc::compare): New function.
11492         (Output_data_reloc_base::do_write): Optionally sort relocs.
11493
11494         * configure.ac: If targ_extra_obj is set, link it in.
11495         * configure.tgt: Initialize all variables.
11496         (x86_64*): Set targ_extra_obj and targ_extra_size.
11497         * configure: Rebuild.
11498
11499         * object.cc (Sized_relobj::include_section_group): Adjust section
11500         indexes read from group data.  Build vector to pass to
11501         layout_group.
11502         * layout.cc (Layout::layout_group): Add flags and shndxes
11503         parameters.  Remove contents parameter.  Change caller.  Update
11504         explicit instantiations.
11505         * layout.h (class Layout): Update layout_group declaration.
11506         * output.cc (Output_data_group::Output_data_group): Add flags and
11507         input_shndxes parameters.  Remove contents parameter.  Change
11508         caller.
11509         (Output_data_group::do_write): Change input_sections_ to
11510         input_shndxes_.
11511         * output.h (class Output_data_group): Update constructor
11512         declaration.  Rename input_sections_ to input_shndxes_.
11513         * testsuite/many_sections_test.cc: Add template.
11514
11515 2008-04-30  Cary Coutant  <ccoutant@google.com>
11516
11517         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11518
11519         * layout.cc (Layout::include_section): Refactored check for debug
11520         info section.
11521         (Layout::add_comdat): Add new parameters.  Change type
11522         of signature parameter.  Add object and shndx to signatures table.
11523         (Layout::find_kept_object): New function.
11524         * layout.h: Include <cstring>.
11525         (Layout::is_debug_info_section): New function.
11526         (Layout::add_comdat): Add new parameters.
11527         (Layout::find_kept_object): New function.
11528         (Layout::Kept_section): New struct.
11529         (Layout::Signatures): Change type of map range.
11530         * object.cc (Relobj::output_section_address): New function.
11531         (Sized_relobj::include_section_group): Add new parameters.  Change
11532         calls to Layout::add_comdat.  Change to build table of kept comdat
11533         groups and table mapping discarded sections to kept sections.
11534         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11535         (Sized_relobj::do_layout): Change calls to include_section_group and
11536         include_linkonce_section.
11537         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11538         value to zero when section is discarded.
11539         (Sized_relobj::map_to_kept_section): New function.
11540         * object.h (Relobj::output_section_address): New function.
11541         (Relobj::Comdat_group): New type.
11542         (Relobj::find_comdat_group): New function.
11543         (Relobj::Comdat_group_table): New type.
11544         (Relobj::Kept_comdat_section): New type.
11545         (Relobj::Kept_comdat_section_table): New type.
11546         (Relobj::add_comdat_group): New function.
11547         (Relobj::set_kept_comdat_section): New function.
11548         (Relobj::get_kept_comdat_section): New function.
11549         (Relobj::comdat_groups_): New field.
11550         (Relobj::kept_comdat_sections_): New field.
11551         (Symbol_value::input_value): Update comment.
11552         (Sized_relobj::map_to_kept_section) New function.
11553         (Sized_relobj::include_linkonce_section): Add new parameter.
11554         * target-reloc.h (Comdat_behavior): New type.
11555         (get_comdat_behavior): New function.
11556         (relocate_section): Add code to map a discarded section to the
11557         corresponding kept section when applying a relocation.
11558
11559 2008-04-30  Craig Silverstein  <csilvers@google.com>
11560
11561         * dwarf_reader.cc (next_generation_count): New static var.
11562         (Addr2line_cache_entry): New struct.
11563         (addr2line_cache): New static var.
11564         (Dwarf_line_info::one_addr2line): Added caching.
11565         (Dwarf_line_info::clear_addr2line_cache): New function.
11566         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11567         cache-size parameter.
11568         (Dwarf_line_info::one_addr2line_cache): New function.
11569         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11570         new cache-size argument to one_addr2line(), and clear cache.
11571
11572 2008-04-28  Cary Coutant  <ccoutant@google.com>
11573
11574         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11575         R_386_PC8 relocations.
11576
11577 2008-04-23  Ian Lance Taylor  <iant@google.com>
11578
11579         * object.cc (Sized_relobj::include_section_group): Check for
11580         invalid section group.
11581
11582         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11583         header size.
11584
11585         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11586         than read for file header.
11587         * archive.cc (Archive::include_member): Likewise.
11588
11589 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11590
11591         * aclocal.m4: Regenerate.
11592         * configure: Regenerate.
11593
11594 2008-04-19  Ian Lance Taylor  <iant@google.com>
11595
11596         * version.cc (version_string): Bump to 1.6.
11597
11598         * testsuite/Makefile.am (many_sections_r_test): New target.
11599         (many_sections_r_test_SOURCES): Remove.
11600         (many_sections_r_test_DEPENDENCIES): Remove.
11601         (many_sections_r_test_LDFLAGS): Remove.
11602         (many_sections_r_test_LDADD): Remove.
11603
11604         * object.cc (Sized_relobj::do_add_symbols): Always pass
11605         local_symbol_count_ to add_from_relobj.
11606
11607         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11608         every thousand variables.
11609         * testsuite/Makefile.in: Rebuild.
11610
11611         * object.cc (Xindex::initialize_symtab_xindex): New function.
11612         (Xindex::read_symtab_xindex): New function.
11613         (Xindex::sym_xindex_to_shndx): New function.
11614         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11615         available.
11616         (Sized_relobj::do_initialize_xindex): New function.
11617         (Sized_relobj::do_read_symbols): Adjust section links.
11618         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11619         parameter.  Change all callers.
11620         (Sized_relobj::include_section_group): Adjust section links and
11621         symbol section indexes.
11622         (Sized_relobj::do_layout): Adjust section links.
11623         (Sized_relobj::do_count_local_symbols): Adjust section links and
11624         symbol section indexes.
11625         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11626         ordinary and special symbols.
11627         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11628         dynsym_xindex parameters.  Change all callers.  Adjust section
11629         links.  Use SHN_XINDEX when needed.
11630         (Sized_relobj::get_symbol_location_info): Adjust section links.
11631         Don't get fooled by special symbols.
11632         * object.h (class Xindex): Define.
11633         (class Object): Add xindex_ parameter.  Declare virtual functoin
11634         do_initialize_xindex.
11635         (Object::adjust_sym_shndx): New function.
11636         (Object::set_xindex): New protected function.
11637         (class Symbol_value): Add is_ordinary_shndx_ field.
11638         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11639         (Symbol_value::value): Assert ordinary section.
11640         (Symbol_value::initialize_input_to_output_map): Likewise.
11641         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11642         Change all callers.
11643         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11644         all callers.
11645         (class Sized_relobj): Update declarations.
11646         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11647         parameter.  Change all callers.
11648         (Sized_relobj::adjust_shndx): New function.
11649         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11650         field.
11651         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11652         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11653         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11654         (Sized_dynobj::read_dynsym_section): Adjust section links.
11655         (Sized_dynobj::read_dynamic): Likewise.
11656         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11657         section links.
11658         (Sized_dynobj::do_initialize_xindex): New function.
11659         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11660         do_initialize_xindex.
11661         (Sized_dynobj::adjust_shndx): New function.
11662         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11663         dynsym_xindex_ fields.
11664         (Layout::finalize): Add a call to set_section_indexes before
11665         creating the symtab sections.
11666         (Layout::set_section_indexes): Don't do anything if the section
11667         already has a section index.
11668         (Layout::create_symtab_sections): Add shnum parameter.  Change
11669         caller.  Create .symtab_shndx section if needed.
11670         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11671         caller.
11672         (Layout::allocated_output_section_count): New function.
11673         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11674         needed.
11675         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11676         fields.  Update declarations.
11677         (Layout::symtab_xindex): New function.
11678         (Layout::dynsym_xindex): New function.
11679         (class Write_symbols_task): Add layout_ field.
11680         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11681         Change caller.
11682         * output.cc (Output_section_headers::Output_section_headers): Add
11683         shstrtab_section parameter.  Change all callers.
11684         (Output_section_headers::do_sized_write): Store overflow values
11685         for section count and section string table section index in
11686         section header zero.
11687         (Output_file_header::do_sized_write): Check for overflow of
11688         section count and section string table section index.
11689         (Output_symtab_xindex::do_write): New function.
11690         (Output_symtab_xindex::endian_do_write): New function.
11691         * output.h (class Output_section_headers): Add shstrtab_section_.
11692         Update declarations.
11693         (class Output_symtab_xindex): Define.
11694         (Output_section::has_out_shndx): New function.
11695         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11696         field.
11697         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11698         Change all callers.
11699         (Sized_symbol::init): Likewise.
11700         (Symbol::output_section): Check for ordinary symbol.
11701         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11702         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11703         callers.
11704         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11705         Change all callers.  Simplify handling of symbols from sections
11706         not included in the link.
11707         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11708         distinction.
11709         (Weak_alias_sorter::operator()): Assert that symbols are
11710         ordinary.
11711         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11712         distinction.
11713         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11714         parameters.  Change all callers.
11715         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11716         symbol distinction.  Use SHN_XINDEX when needed.
11717         (Symbol_table::write_section_symbol): Add symtab_xindex
11718         parameter.  Change all callers.
11719         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11720         SHN_XINDEX when needed.
11721         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11722         declarations.
11723         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11724         (Symbol::is_defined): Check is_ordinary.
11725         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11726         (Symbol::is_absolute, Symbol::is_common): Likewise.
11727         (class Sized_symbol): Update declarations.
11728         (class Symbol_table): Update declarations.
11729         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11730         parameters.  Change all callers.
11731         (Sized_symbol::override): Likewise.
11732         (Symbol_table::override): Likewise.
11733         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11734         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11735         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11736         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11737         to be in an ordinary section.
11738         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11739         object and is_ordinary parameters.  Change all callers.
11740         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11741         Change all callers.  Don't add undefined or non-ordinary symbols
11742         to reloc_map_.
11743         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11744         Change all callers.
11745         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11746         declarations.
11747         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11748         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11749         (Sized_relobj::relocate_sections): Likewise.
11750         * target-reloc.h (scan_relocs): Adjust section symbol index.
11751         (scan_relocatable_relocs): Likewise.
11752         * i386.cc (Scan::local): Check for ordinary symbols.
11753         * sparc.cc (Scan::local): Likewise.
11754         * x86_64.cc (Scan::local): Likewise.
11755         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11756         to symbol_section_and_value.
11757         * testsuite/many_sections_test.cc: New file.
11758         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11759         (check_PROGRAMS): Add many_sections_test.
11760         (many_sections_test_SOURCES): Define.
11761         (many_sections_test_DEPENDENCIES): Define.
11762         (many_sections_test_LDFLAGS): Define.
11763         (BUILT_SOURCES): Add many_sections_define.h.
11764         (many_sections_define.h): New target.
11765         (BUILT_SOURCES): Add many_sections_check.h.
11766         (many_sections_check.h): New target.
11767         (check_PROGRAMS): Add many_sections_r_test.
11768         (many_sections_r_test_SOURCES): Define.
11769         (many_sections_r_test_DEPENDENCIES): Define.
11770         (many_sections_r_test_LDFLAGS): Define.
11771         (many_sections_r_test_LDADD): Define.
11772         (many_sections_r_test.o): New target.
11773         * testsuite/Makefile.in: Rebuild.
11774
11775 2008-04-17  Cary Coutant  <ccoutant@google.com>
11776
11777         * errors.cc (Errors::info): New function.
11778         (gold_info): New function.
11779         * errors.h (Errors::info): New function.
11780         * gold.h (gold_info): New function.
11781         * object.cc (Input_objects::add_object): Print trace output.
11782         * options.cc (options::parse_set): New function.
11783         (General_options::parse_wrap): Deleted.
11784         (General_options::General_options): Deleted initializer.
11785         * options.h (options::String_set): New typedef.
11786         (options::parse_set): New function.
11787         (DEFINE_set): New macro.
11788         (General_options::wrap): Changed to use DEFINE_set. Changed
11789         callers of any_wrap_symbols and is_wrap_symbol.
11790         (General_options::trace, General_options::trace_symbol):
11791         New options.
11792         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11793         (General_options::wrap_symbols_): Deleted.
11794         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11795
11796 2008-04-17  David S. Miller  <davem@davemloft.net>
11797
11798         * options.cc (General_options::parse_V): New function.
11799         * options.h: Add entries for -V and -Qy.
11800
11801 2008-04-17  Ian Lance Taylor  <iant@google.com>
11802
11803         * common.cc (Symbol_table::allocate_commons): Remove options
11804         parameter.  Change caller.
11805         (Symbol_table::do_allocate_commons): Remove options parameter.
11806         Change caller.  Just call do_allocate_commons_list twice.
11807         (Symbol_table::do_allocate_commons_list): New function, broken out
11808         of do_allocate_commons.
11809         * common.h (class Allocate_commons_task): Remove options_ field.
11810         Update constructor.
11811         * symtab.cc (Symbol_table::Symbol_table): Initialize
11812         tls_commons_.
11813         (Symbol_table::add_from_object): Put TLS common symbols on
11814         tls_commons_ list.
11815         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11816         which are IN_OUTPUT_DATA.
11817         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11818         allocate_commons and do_allocate_commons declarations.  Declare
11819         do_allocate_commons_list.
11820         * gold.cc (queue_middle_tasks): Update creation of
11821         Allocate_commons_task to not pass options.
11822         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11823         (TLS_TEST_C_FLAGS): New variable.
11824         (tls_test_c_pic.o): New target.
11825         (tls_test_shared.so): Link in tls_test_c_pic.o.
11826         (tls_test_c_pic_ie.o): New target.
11827         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11828         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11829         (tls_test_c.o): New target.
11830         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11831         (tls_pic_test_LDADD): Likewise.
11832         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11833         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11834         (tls_test_c_gnu2.o): New target.
11835         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11836         tls_test_c_gnu2.o.
11837         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11838         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11839         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11840         * testsuite/tls_test.cc: Include "config.h".
11841         (t_last): Call t11_last.
11842         * testsuite/tls_test.h (t11, t11_last): Declare.
11843         * testsuite/tls_test_c.c: New file.
11844         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11845         * configure.ac: Check for OpenMP support.
11846         * configure, config.in, Makefile.in: Rebuild.
11847         * testsuite/Makefile.in: Rebuild.
11848
11849 2008-04-16  Cary Coutant  <ccoutant@google.com>
11850
11851         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11852         (Target_i386::tls_base_symbol_defined_): New field.
11853         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11854         (Target_i386::Scan::global): Likewise.
11855         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11856         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11857         (Target_x86_64::tls_base_symbol_defined_): New field.
11858         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11859         (Target_x86_64::Scan::global): Likewise.
11860
11861 2008-04-16  Cary Coutant  <ccoutant@google.com>
11862
11863         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11864         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11865         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11866         building shared libraries.
11867         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11868         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11869         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11870         * testsuite/Makefile.in: Rebuild.
11871         * testsuite/weak_undef.h: New file.
11872         * testsuite/weak_undef_file1.cc: Add extra test cases.
11873         * testsuite/weak_undef_file2.cc: Likewise.
11874         * testsuite/weak_undef_test.cc: Likewise.
11875
11876 2008-04-16  David S. Miller  <davem@davemloft.net>
11877
11878         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11879         Add issued_non_pic_error_ field.  Declare check_non_pic.
11880         (Target_sparc::Scan::check_non_pic): New function.
11881         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11882         (Target_sparc::Scan::global): Likewise.
11883
11884         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11885         * configure: Rebuild.
11886
11887         * options.h (DEFINE_enable): New macro.
11888         (new_dtags): New enable option.
11889         (initfirst, interpose, loadfltr, nodefaultlib,
11890         nodelete, nodlopen, nodump): New -z options.
11891         * layout.cc (Layout:finish_dynamic_section): If new
11892         dtags enabled, emit DT_RUNPATH.  Also, emit a
11893         DT_FLAGS_1 containing any specified -z flags.
11894
11895 2008-04-16  Ian Lance Taylor  <iant@google.com>
11896
11897         * copy-relocs.cc: New file.
11898         * copy-relocs.h: New file.
11899         * reloc.cc: Remove Copy_relocs code.
11900         * reloc.h: Likewise.
11901         * reloc-types.h (struct Reloc_types) [both versions]: Add
11902         get_reloc_addend_noerror.
11903         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11904         variants of add_global which take an addend which must be zero.
11905         * i386.cc: Include "copy-relocs.h".
11906         (class Target_i386): Change type of copy_relocs_ to variable,
11907         update initializer.
11908         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11909         Change all callers.
11910         (Target_i386::do_finalize_sections): Change handling of
11911         copy_relocs_.
11912         * sparc.cc: Include "copy-relocs.h".
11913         (class Target_sparc): Change type of copy_relocs_ to variable,
11914         update initializer.
11915         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11916         Change all callers.
11917         (Target_sparc::do_finalize_sections): Change handling of
11918         copy_relocs_.
11919         * x86_64.cc: Include "copy-relocs.h".
11920         (class Target_x86_64): Change type of copy_relocs_ to variable,
11921         update initializer.
11922         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11923         class.  Change all callers.
11924         (Target_x86_64::do_finalize_sections): Change handling of
11925         copy_relocs_.
11926         * Makefile.am (CCFILES): Add copy-relocs.cc.
11927         (HFILES): Add copy-relocs.h.
11928
11929         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11930
11931         * testsuite/script_test_4.sh: Permit leading zeroes.
11932
11933 2008-04-15  Ian Lance Taylor  <iant@google.com>
11934
11935         * script-sections.cc (Script_sections::create_segments): Use
11936         header_size_adjustment even when there is enough room for the
11937         headers.
11938         * testsuite/script_test_4.sh: New file.
11939         * testsuite/script_test_4.t: New file.
11940         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11941         (check_DATA): Add script_test_4.stdout.
11942         (MOSTLYCLEANFILES): Likewise.
11943         (script_test_4): New target.
11944         (script_test_4.stdout): New target.
11945         * testsuite/Makefile.in: Rebuild.
11946
11947         * sparc.cc: Add definitions for Output_data_plt_sparc class
11948         constants.
11949
11950 2008-04-14  David S. Miller  <davem@davemloft.net>
11951
11952         * sparc.cc: New file.
11953         * Makefile.am (TARGETSOURCES): Add sparc.cc
11954         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11955         * configure.tgt: Document targ_extra_size and
11956         targ_extra_big_endian.  Add entries for sparc-* and
11957         sparc64-*.
11958         * configure.ac: Handle targ_extra_size and
11959         targ_extra_big_endian.
11960         * Makefile.in: Rebuild.
11961         * configure: Likewise.
11962         * po/POTFILES.in: Likewise.
11963         * po/gold.pot: Likewise.
11964
11965 2008-04-14  Ian Lance Taylor  <iant@google.com>
11966
11967         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11968         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11969         in the name/type/flags to section mapping.  Don't call
11970         allocate_output_section.
11971         (Layout::choose_output_section): Change parameter from adjust_name
11972         to is_input_section.  Don't permit input sections after sections
11973         are attached to segments.  Don't call allocate_output_section.
11974         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11975         not write_enable_output_section.
11976         (Layout::make_output_section): Don't push to
11977         unattached_section_list_ nor call attach_to_segment.  Call
11978         attach_section_to_segment if sections are attached.
11979         (Layout::attach_sections_to_segments): New function.
11980         (Layout::attach_section_to_segment): New function.
11981         (Layout::attach_allocated_section_to_segment): Rename from
11982         attach_to_segment.  Remove flags parameter.
11983         (Layout::allocate_output_section): Remove function.
11984         (Layout::write_enable_output_section): Remove function.
11985         * layout.h (class Layout): Update for above changes.  Add new
11986         field sections_are_attached_.
11987         * output.h (Output_section::update_flags_for_input_section): New
11988         function.
11989         * output.cc (Output_section::add_input_section): Call
11990         update_flags_for_input_section.
11991         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11992
11993 2008-04-11  Cary Coutant  <ccoutant@google.com>
11994
11995         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11996         thought unnecessary.
11997         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11998
11999 2008-04-11  Ian Lance Taylor  <iant@google.com>
12000
12001         * output.h (class Output_section_data): Remove inline definition
12002         of set_addralign.
12003         * output.cc (Output_section_data::set_addralign): New function.
12004
12005 2008-04-11  Cary Coutant  <ccoutant@google.com>
12006
12007         Add support for TLS descriptors for i386 and x86_64.
12008         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12009         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12010         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12011         GOT_TYPE_TLS_DESC.
12012         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12013         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12014         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12015         relocations.
12016         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12017         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12018         Fix problem with initial-exec relocations.
12019         (Target_i386::Relocate::relocate_tls): Likewise.
12020         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12021         relaxation.
12022         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12023         support for section-plus-offset dynamic table entries.
12024         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12025         (Output_data_dynamic::Dynamic_entry): Add support for
12026         section-plus-offset dynamic table entries.
12027         (Output_data_dynamic::Classification): Likewise.
12028         (Output_data_dynamic::classification_): Renamed offset_.
12029         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12030         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12031         (Target_x86_64::make_plt_section): New function.
12032         (Target_x86_64::reserve_tlsdesc_entries): New function.
12033         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12034         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12035         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12036         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12037         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12038         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12039         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12040         add extra PLT entry for TLS descriptors.
12041         (Output_data_plt_x86_64::got_): New field.
12042         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12043         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12044         fields.
12045         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12046         descriptors.
12047         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12048         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12049         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12050         R_386_TLS_DESC_CALL relocations.
12051         (Target_x86_64::Scan::global): Likewise.
12052         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12053         for TLS descriptors.
12054         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12055         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12056         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12057         GD-to-IE relaxation.
12058         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12059         and TLS_DESCRIPTORS.
12060         * Makefile.in: Rebuild.
12061         * configure: Rebuild.
12062         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12063         (tls_test_shared2.so): New target.
12064         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12065         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12066         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12067         (tls_shared_gd_to_ie_test_LDADD): New variable.
12068         (tls_shared_gnu2_gd_to_ie_test): New target.
12069         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12070         New targets.
12071         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12072         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12073         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12074         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12075         (tls_shared_gnu2_test): New target.
12076         (tls_test_gnu2_shared.so): New target.
12077         (tls_shared_gnu2_test_SOURCES): New variable.
12078         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12079         (tls_shared_gnu2_test_LDFLAGS): New variable.
12080         (tls_shared_gnu2_test_LDADD): New variable.
12081         * testsuite/Makefile.in: Rebuild.
12082         * testsuite/Makefile.
12083
12084 2008-04-11  Ian Lance Taylor  <iant@google.com>
12085
12086         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12087         justsyms.t.
12088         * testsuite/Makefile.in: Rebuild.
12089
12090         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12091         long.
12092         * testsuite/script_test_2.cc (main): Adjust test.
12093
12094 2008-04-11  David S. Miller  <davem@davemloft.net>
12095             Ian Lance Taylor  <iant@google.com>
12096
12097         * options.h (General_options): Add entries for '-Y' and
12098         '-relax'.
12099         * options.cc (General_options:finalize): If -Y was used, add those
12100         entries to the library path instead of the default "/lib" and
12101         "/usr/lib".
12102
12103 2008-04-11  David S. Miller  <davem@davemloft.net>
12104
12105         * testsuite/justsyms.t: Start at 0x100.
12106         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12107         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12108         long.
12109         * testsuite/script_test_2.cc: Adjust string and section length
12110         checks.
12111
12112 2008-04-09  Ian Lance Taylor  <iant@google.com>
12113
12114         PR gold/5996
12115         * script-sections.cc (Sections_element::allocate_to_segment): Add
12116         orphan parameter.
12117         (Output_section_definition::allocate_to_segment): Likewise.
12118         (Orphan_output_section::allocate_to_segment): Likewise.
12119         (Script_sections::attach_sections_using_phdrs_clause): Don't
12120         propagate non-PT_LOAD segments to orphan sections.
12121         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12122         readelf rather than objdump.
12123         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12124         .interp section and PT_INTERP segment are the same size.
12125         * testsuite/Makefile.in: Rebuild.
12126
12127         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12128         aliases for symbols defined in the same object.
12129         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12130         (weak_alias_test_SOURCES): New variable.
12131         (weak_alias_test_DEPENDENCIES): New variable.
12132         (weak_alias_test_LDFLAGS): New variable.
12133         (weak_alias_test_LDADD): New variable.
12134         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12135         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12136         (weak_alias_test_3.o): New target.
12137         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12138         * testsuite/weak_alias_test_main.cc: New file.
12139         * testsuite/weak_alias_test_1.cc: New file.
12140         * testsuite/weak_alias_test_2.cc: New file.
12141         * testsuite/weak_alias_test_3.cc: New file.
12142
12143 2008-04-08  Ian Lance Taylor  <iant@google.com>
12144
12145         * options.h (class General_options): Add --noinhibit-exec option.
12146         * main.cc (main): Check --noinhibit-exec.
12147
12148         * options.h (class General_options): Define --wrap as a special
12149         option.  Add wrap_symbols_ field.
12150         (General_options::any_wrap_symbols): New function.
12151         (General_options::is_wrap_symbol): New function.
12152         * options.cc (General_options::parse_wrap): New function.
12153         (General_options::General_options): Initialize wrap_symbols_.
12154         * symtab.cc (Symbol_table::wrap_symbol): New function.
12155         (Symbol_table::add_from_object): Handle --wrap.
12156         * symtab.h (class Symbol_table): Declare wrap_symbol.
12157         * target.h (Target::wrap_char): New function.
12158         (Target::Target_info): Add wrap_char field.
12159         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12160         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12161         * testsuite/testfile.cc (Target_test::test_target_info):
12162         Likewise.
12163
12164         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12165         there is one.
12166
12167         * layout.h (class Layout): Add added_eh_frame_data_ field.
12168         * layout.cc (Layout::Layout): Initialize new field.
12169         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12170         output section until we find a section we merged successfully.
12171         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12172         that the size be non-zero.
12173
12174         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12175         qualifier.
12176
12177 2008-04-08  Craig Silverstein  <csilvers@google.com>
12178
12179         * configure.ac: Export new conditional variable HAVE_ZLIB.
12180         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12181         on HAVE_ZLIB.
12182         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12183         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12184
12185 2008-04-07  Ian Lance Taylor  <iant@google.com>
12186
12187         * version.cc (version_string): Set to "1.5".
12188
12189         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12190         Add issued_non_pic_error_ field.  Declare check_non_pic.
12191         (Target_x86_64::Scan::check_non_pic): New function.
12192         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12193         (Target_x86_64::Scan::global): Likewise.
12194
12195         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12196         addend parameter.  Change caller.  Handle merge sections.
12197         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12198         Address to Addend.  Don't add in the result of
12199         local_section_offset, pass down the addend and use the returned
12200         value.
12201         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12202         Update declarations of local_section_offset and symbol_value.
12203         * testsuite/two_file_test_1.cc (t18): New function.
12204         * testsuite/two_file_test_2.cc (f18): New function.
12205         * testsuite/two_file_test_main.cc (main): Call t18.
12206         * testsuite/two_file_test.h (t18, f18): Declare.
12207
12208         * configure.ac: Don't test for objdump, c++filt, or readelf.
12209         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12210         conditionals.
12211         (TEST_READELF): New variable.
12212         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12213         (check_PROGRAMS): Add two_file_strip_test.
12214         (two_file_strip_test): New target.
12215         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12216         (two_file_same_shared_strip_test_SOURCES): New variable.
12217         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12218         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12219         (two_file_same_shared_strip_test_LDADD): New variable.
12220         (two_file_shared_strip.so): New target.
12221         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12222         (ver_test_5.syms, ver_test_7.syms): Likewise.
12223         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12224         (strip_test_3.stdout): Use TEST_OBJDUMP.
12225         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12226
12227 2008-04-04  Cary Coutant  <ccoutant@google.com>
12228
12229         * symtab.h (Symbol::is_weak_undefined): New function.
12230         (Symbol::is_strong_undefined): New function.
12231         (Symbol::is_absolute): New function.
12232         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12233         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12234         absolute symbols.
12235         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12236         (weak_undef_test): New target.
12237         * testsuite/Makefile.in: Rebuild.
12238         * testsuite/weak_undef_file1.cc: New file.
12239         * testsuite/weak_undef_file2.cc: New file.
12240         * testsuite/weak_undef_test.cc: New file.
12241
12242 2008-04-03  Craig Silverstein  <csilvers@google.com>
12243
12244         * compressed_output.h (class Output_compressed_section): Use
12245         unsigned buffer.
12246         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12247         add zlib header.
12248         (zlib_compressed_suffix): Removed.
12249         (Output_compressed_section::set_final_data_size): Use unsigned
12250         buffers.
12251         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12252         Fix linker invocation.
12253         (flagstest_o_specialfile_and_compress_debug_sections):
12254         Likewise.
12255         * testsuite/Makefile.in: Regenerated.
12256
12257 2008-04-02  David S. Miller  <davem@davemloft.net>
12258
12259         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12260         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12261
12262 2008-04-02  Craig Silverstein  <csilvers@google.com>
12263
12264         * TODO: New file.
12265
12266 2008-04-02  Ian Lance Taylor  <iant@google.com>
12267
12268         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12269         parameters.  Update for new key type to views_.  Change all
12270         callers.
12271         (File_read::read): Adjust for byteshift in returned view.
12272         (File_read::add_view): New function, broken out of
12273         find_and_make_view.
12274         (File_read::make_view): New function, broken out of
12275         find_and_make_view.
12276         (File_read::find_or_make_view): Add offset and aligned
12277         parameters.  Rewrite accordingly.  Change all callers.
12278         (File_read::get_view): Add offset and aligned parameters.  Adjust
12279         for byteshift in return value.
12280         (File_read::get_lasting_view): Likewise.
12281         * fileread.h (class File_read): Update declarations.
12282         (class File_read::View): Add byteshift_ field.  Add byteshift to
12283         constructor.  Add byteshift method.
12284         * archive.h (Archive::clear_uncached_views): New function.
12285         (Archive::get_view): Add aligned parameter.  Change all callers.
12286         * object.h (Object::get_view): Add aligned parameter.  Change all
12287         callers.
12288         (Object::get_lasting_view): Likewise.
12289
12290         * fileread.cc (File_read::release): Don't call clear_views if
12291         there are multiple objects.
12292         * fileread.h (File_read::clear_uncached_views): New function.
12293         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12294         on the archive.
12295
12296 2008-03-31  Cary Coutant  <ccoutant@google.com>
12297
12298         Add thin archive support.
12299         * archive.cc (Archive::armagt): New const.
12300         (Archive::setup): Remove task parameter and calls to unlock.
12301         (Archive::unlock_nested_archives): New function.
12302         (Archive::read_header): Add nested_off parameter. Change
12303         all callers.
12304         (Archive::interpret_header): Likewise.
12305         (Archive::include_all_members): Change to handle thin
12306         archives.
12307         (Archive::include_member): Likewise.
12308         * archive.h (Archive::Archive): Add new parameters and
12309         initializers.
12310         (Archive::armagt): New const.
12311         (Archive::setup): Remove task parameter.
12312         (Archive::unlock_nested_archives): New function.
12313         (Archive::read_header): Add nested_off parameter.
12314         (Archive::interpret_header): Likewise.
12315         (Archive::Nested_archive_table): New typedef.
12316         (Archive::is_thin_archive_): New field.
12317         (Archive::nested_archives_): New field.
12318         (Archive::options_): New field.
12319         (Archive::dirpath_): New field.
12320         (Archive::task_): New field.
12321         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12322         for thin archives.  Pass additional parameters to
12323         Archive::Archive.  Unlock the archive file after calling
12324         Archive::setup.
12325
12326 2008-03-29  Ian Lance Taylor  <iant@google.com>
12327
12328         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12329         version symbol to be local.
12330         * testsuite/ver_test_4.sh: New file.
12331         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12332         (check_DATA): Add ver_test_4.syms.
12333         (ver_test_4.syms): New target.
12334         * testsuite/Makefile.in: Rebuild.
12335
12336         * output.cc
12337         (Output_section::Input_section_sort_entry::has_priority): New
12338         function.
12339         (Output_section::Input_section_sort_entry::match_file_name): New
12340         function.
12341         (Output_section::Input_section_sort_entry::match_section_name):
12342         Remove.
12343         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12344         Remove.
12345         (Output_section::Input_section_sort_entry::match_section_file):
12346         Remove.
12347         (Output_section::Input_section_sort_compare::operator()): Rewrite
12348         using new Input_section_sort_entry functions.  Sort crtbegin and
12349         crtend first.  Sort sections with no priority before sections with
12350         a priority.
12351         * testsuite/initpri1.c (d3): Check j != 4.
12352         (cd5): New constructor/destructor function.
12353         (main): Check j != 2.
12354
12355         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12356         new symbol when resolving, don't call set_is_default.
12357         * testsuite/ver_test_7.cc: New file.
12358         * testsuite/ver_test_7.sh: New file.
12359         * testsuite/Makefile.am (ver_test_7.so): New target.
12360         (ver_test_7.o): New target.
12361         (check_SCRIPTS): Add ver_test_7.sh.
12362         (check_DATA): Add ver_test_7.syms.
12363         (ver_test_7.syms): New target.
12364
12365 2008-03-28  Ian Lance Taylor  <iant@google.com>
12366
12367         * layout.cc (Layout::layout): If we see an input section with a
12368         name that needs sorting, set the must_sort flag for the output
12369         section.
12370         (Layout::make_output_section): If the name of the output section
12371         indicates that it might require sorting, set the may_sort flag.
12372         * output.h (Output_section::may_sort_attached_input_sections): New
12373         function.
12374         (Output_section::set_may_sort_attached_input_sections): New
12375         function.
12376         (Output_section::must_sort_attached_input_sections): New
12377         function.
12378         (Output_section::set_must_sort_attached_input_sections): New
12379         function.
12380         (class Output_section): Declare Input_section_sort_entry.  Define
12381         Input_section_sort_compare.  Declare
12382         sort_attached_input_sections.  Add new fields:
12383         may_sort_attached_input_sections_,
12384         must_sort_attached_input_sections_,
12385         attached_input_sections_are_sorted_.
12386         * output.cc (Output_section::Output_section): Initialize new
12387         fields.
12388         (Output_section::add_input_section): Add an entry to
12389         input_sections_ if may_sort or must_sort are true.
12390         (Output_section::set_final_data_size): Call
12391         sort_attached_input_sections if necessary.
12392         (Output_section::Input_section_sort_entry): Define new class.
12393         (Output_section::Input_section_sort_compare::operator()): New
12394         function.
12395         (Output_section::sort_attached_input_sections): New function.
12396         * configure.ac: Check whether the compiler supports constructor
12397         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12398         * testsuite/initpri1.c: New file.
12399         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12400         CONSTRUCTOR_PRIORITY.
12401         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12402         (initpri1_LDFLAGS): New variable.
12403         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12404
12405 2008-03-27  Ian Lance Taylor  <iant@google.com>
12406
12407         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12408         * testsuite/common_test_1.c: New file.
12409         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12410         (common_test_1_SOURCES): New variable.
12411         (common_test_1_DEPENDENCIES): New variable.
12412         (common_test_1_LDFLAGS): New variable.
12413
12414         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12415         and commons_ correctly when NAME/VERSION does not override
12416         NAME/NULL.
12417         * testsuite/ver_test_6.c: New file.
12418         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12419         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12420         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12421
12422 2008-03-26  Ian Lance Taylor  <iant@google.com>
12423
12424         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12425         of an undefined symbol from a version script.
12426         * testsuite/Makefile.am (ver_test_5.so): New target.
12427         (ver_test_5.o): New target.
12428         (check_SCRIPTS): Add ver_test_5.sh.
12429         (check_DATA): Add ver_test_5.syms.
12430         (ver_test_5.syms): New target.
12431         * testsuite/ver_test_5.cc: New file.
12432         * testsuite/ver_test_5.script: New file.
12433         * testsuite/ver_test_5.sh: New file.
12434         * Makefile.in, testsuite/Makefile.in: Rebuild.
12435
12436         PR gold/5986
12437         Fix problems building gold with gcc 4.3.0.
12438         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12439         (gold_error_at_location, gold_warning_at_location): Use it.
12440         * configure.ac: Check whether we can compile and use a template
12441         function with a printf attribute.
12442         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12443         when jumping over bytes.
12444         * object.cc: Instantiate Object::read_section_data.
12445         * debug.h: Include <cstring>
12446         * dwarf_reader.cc: Include <algorithm>
12447         * main.cc: Include <cstring>.
12448         * options.cc: Include <cstring>.
12449         * output.cc: Include <cstring>.
12450         * script.cc: Include <cstring>.
12451         * script.h: Include <string>.
12452         * symtab.cc: Include <cstring> and <algorithm>.
12453         * target-select.cc: Include <cstring>.
12454         * version.cc: Include <string>.
12455         * testsuite/testmain.cc: Include <cstdlib>.
12456         * configure, config.in: Rebuild.
12457
12458 2008-03-25  Ian Lance Taylor  <iant@google.com>
12459
12460         * options.cc: Include "../bfd/bfdver.h".
12461         (options::help): Print bug reporting address.
12462
12463         * version.cc (print_version): Adjust output for current value of
12464         BFD_VERSION_STRING.
12465
12466         * NEWS: New file.
12467
12468         * options.cc (options::help): Print list of supported targets.
12469         * target-select.h: Include <vector>.
12470         (class Target_selector): Make machine_, size_, and is_big_endian_
12471         fields const.  Add bfd_name_ and instantiated_target_ fields.
12472         (Target_selector::Target_selector): Add bfd_name parameter.
12473         (Target_selector::recognize): Make non-virtual, call
12474         do_recognize.
12475         (Target_selector::recognize_by_name): Make non-virtual, call
12476         do_recognize_by_name.
12477         (Target_selector::supported_names): New function.
12478         (Target_selector::bfd_name): New function.
12479         (Target_selector::do_instantiate_target): New pure virtual
12480         function.
12481         (Target_selector::do_recognize): New virtual function.
12482         (Target_selector::do_recognize_by_name): New virtual function.
12483         (Target_selector::instantiate_target): New private function.
12484         (supported_target_names): Declare.
12485         * target-select.cc (Target_selector::Target_selector): Update for
12486         new parameter and fields.
12487         (select_target_by_name): Check that the name matches before
12488         calling recognize_by_name.
12489         (supported_target_names): New function.
12490         * i386.cc (class Target_selector_i386): Update Target_selector
12491         constructor call.  Remove recognize and recognize_by_name.  Add
12492         do_instantiate_target.
12493         * x86_64.cc (class Target_selector_x86_64): Likewise.
12494         * testsuite/testfile.cc (class Target_selector_test): Update for
12495         changes to Target_selector.
12496
12497         * README: Rewrite, with some notes on unsupported features.
12498
12499 2008-03-24  Cary Coutant  <ccoutant@google.com>
12500
12501         * i386.cc (Target_i386::Got_type): New enum declaration.
12502         (Target_i386::Scan::local): Updated callers of Output_data_got
12503         member functions.
12504         (Target_i386::Scan::global): Likewise.
12505         (Target_i386::Relocate::relocate): Likewise.
12506         (Target_i386::Relocate::relocate_tls): Likewise.
12507         * object.h (Got_offset_list): New class.
12508         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12509         (Sized_relobj::local_got_offset): Likewise.
12510         (Sized_relobj::set_local_got_offset): Likewise.
12511         (Sized_relobj::local_has_tls_got_offset): Removed.
12512         (Sized_relobj::local_tls_got_offset): Removed.
12513         (Sized_relobj::set_local_tls_got_offset): Removed.
12514         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12515         * output.cc (Output_data_got::add_global): Added got_type parameter.
12516         (Output_data_got::add_global_with_rel): Likewise.
12517         (Output_data_got::add_global_with_rela): Likewise.
12518         (Output_data_got::add_global_pair_with_rel): New function.
12519         (Output_data_got::add_global_pair_with_rela): New function.
12520         (Output_data_got::add_local): Added got_type parameter.
12521         (Output_data_got::add_local_with_rel): Likewise.
12522         (Output_data_got::add_local_with_rela): Likewise.
12523         (Output_data_got::add_local_pair_with_rel): New function.
12524         (Output_data_got::add_local_pair_with_rela): New function.
12525         (Output_data_got::add_global_tls): Removed.
12526         (Output_data_got::add_global_tls_with_rel): Removed.
12527         (Output_data_got::add_global_tls_with_rela): Removed.
12528         (Output_data_got::add_local_tls): Removed.
12529         (Output_data_got::add_local_tls_with_rel): Removed.
12530         (Output_data_got::add_local_tls_with_rela): Removed.
12531         * output.h (Output_data_got::add_global): Added got_type parameter.
12532         (Output_data_got::add_global_with_rel): Likewise.
12533         (Output_data_got::add_global_with_rela): Likewise.
12534         (Output_data_got::add_global_pair_with_rel): New function.
12535         (Output_data_got::add_global_pair_with_rela): New function.
12536         (Output_data_got::add_local): Added got_type parameter.
12537         (Output_data_got::add_local_with_rel): Likewise.
12538         (Output_data_got::add_local_with_rela): Likewise.
12539         (Output_data_got::add_local_pair_with_rel): New function.
12540         (Output_data_got::add_local_pair_with_rela): New function.
12541         (Output_data_got::add_global_tls): Removed.
12542         (Output_data_got::add_global_tls_with_rel): Removed.
12543         (Output_data_got::add_global_tls_with_rela): Removed.
12544         (Output_data_got::add_local_tls): Removed.
12545         (Output_data_got::add_local_tls_with_rel): Removed.
12546         (Output_data_got::add_local_tls_with_rela): Removed.
12547         * resolve.cc (Symbol::override_base_with_special): Removed
12548         reference to has_got_offset_ field.
12549         * symtab.cc (Symbol::init_fields): Replaced initialization
12550         of got_offset_ with got_offsets_.  Removed initialization
12551         of has_got_offset_
12552         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12553         (Symbol::got_offset): Likewise.
12554         (Symbol::set_got_offset): Likewise.
12555         (Symbol::has_tls_got_offset): Removed.
12556         (Symbol::tls_got_offset): Removed.
12557         (Symbol::set_tls_got_offset): Removed.
12558         (Symbol::got_offset_): Removed.
12559         (Symbol::tls_mod_got_offset_): Removed.
12560         (Symbol::tls_pair_got_offset_): Removed.
12561         (Symbol::got_offsets_): New field.
12562         (Symbol::has_got_offset): Removed.
12563         (Symbol::has_tls_mod_got_offset): Removed.
12564         (Symbol::has_tls_pair_got_offset): Removed.
12565         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12566         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12567         member functions.
12568         (Target_x86_64::Scan::global): Likewise.
12569         (Target_x86_64::Relocate::relocate): Likewise.
12570         (Target_x86_64::Relocate::relocate_tls): Likewise.
12571
12572 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12573
12574         * yyscript.y: Fix spelling error in comment.
12575
12576 2008-03-24  Ian Lance Taylor  <iant@google.com>
12577
12578         * options.h (class General_options): Define build_id option.
12579         * layout.h (class Layout): Declare write_build_id, create_note,
12580         create_build_id.  Add build_id_note_ member.
12581         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12582         "libiberty.h", "md5.h", "sha1.h".
12583         (Layout::Layout): Initialize eh_frame_data_,
12584         eh_frame_hdr_section_, and build_id_note_.
12585         (Layout::finalize): Call create_build_id.
12586         (Layout::create_note): New function, broken out of
12587         Layout::create_gold_note.
12588         (Layout::create_gold_note): Call create_note.
12589         (Layout::create_build_id): New function.
12590         (Layout::write_build_id): New function.
12591         (Close_task_runner::run): Call write_build_id.
12592
12593         * x86_64.cc: Correct license to GPLv3.
12594
12595 2008-03-23  Ian Lance Taylor  <iant@google.com>
12596
12597         * options.cc: Include "demangle.h".
12598         (parse_optional_string): New function.
12599         (parse_long_option): Handle takes_optional_argument.
12600         (parse_short_option): Update dash_z initializer.  Handle
12601         takes_optional_argument.
12602         (General_options::General_options): Initialize do_demangle_.
12603         (General_options::finalize): Set do_demangle_.  Handle demangling
12604         style.
12605         * options.h (parse_optional_string): Declare.
12606         (struct One_option): Add optional_arg field.  Update constructor.
12607         Update call constructor calls.  Add takes_optional_argument
12608         function.
12609         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12610         (DEFINE_optional_string): Define.
12611         (General_options::demangle): Change from DEFINE_bool to
12612         DEFINE_optional_string.
12613         (General_options::no_demangle): New function.
12614         (General_options::do_demangle): New function.
12615         (General_options::set_do_demangle): New function.
12616         (General_options::execstack_status_): Move definition to end of
12617         class definition.
12618         (General_options::static_): Likewise.
12619         (General_options::do_demangle_): New field.
12620         * object.cc (big_endian>::get_symbol_location_info): Call
12621         Options::do_demangle, not Options::demangle.
12622         * symtab.cc (demangle): Likewise.
12623
12624 2008-03-22  Ian Lance Taylor  <iant@google.com>
12625
12626         * gold.h: Include <cstddef> and <sys/types.h>
12627         * options.h: Include <cstring>.
12628
12629 2008-03-21  Ian Lance Taylor  <iant@google.com>
12630
12631         * Added source code to GNU binutils.