2012-03-15 Doug Kwan <dougkwan@google.com>
[external/binutils.git] / gold / ChangeLog
1 2012-03-15  Doug Kwan  <dougkwan@google.com>
2
3         * arm.cc (Target_arm::got_section): Make .got section read-only
4         if -z now is given.
5
6 2012-03-15  Ian Lance Taylor  <iant@google.com>
7
8         PR gold/13850
9         * layout.cc (Layout::make_output_section): Correctly mark
10         SHT_INIT_ARRAY, et. al., as relro.
11
12 2012-03-14  Doug Kwan  <dougkwan@google.com>
13
14         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
15         dynamic relocations for protected symbols in shared objects.
16
17 2012-03-13  Ian Lance Taylor  <iant@google.com>
18
19         * resolve.cc (Symbol_table::resolve): When merging common symbols,
20         keep the larger alignment.
21
22 2012-03-12  Cary Coutant  <ccoutant@google.com>
23
24         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
25         handling of DW_LNE_define_file.
26
27 2012-03-12  Cary Coutant  <ccoutant@google.com>
28
29         * reduced_debug_output.cc
30         (Output_reduced_debug_info_section::get_die_end): Add new FORM
31         codes to switch.
32
33 2012-02-29  Cary Coutant  <ccoutant@google.com>
34
35         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
36
37 2012-02-29  Cary Coutant  <ccoutant@google.com>
38
39         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
40         Call Object::decompressed_section_contents.
41         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
42         New dtor.
43         (Sized_dwarf_line_info::buffer_start_): New data member.
44         * merge.cc (Output_merge_data::do_add_input_section): Call
45         Object::decompressed_section_contents.
46         (Output_merge_string::do_add_input_section): Likewise.
47         * object.cc (need_decompressed_section): New function.
48         (build_compressed_section_map): Decompress sections needed later.
49         (Sized_relobj_file::do_decompressed_section_contents): New function.
50         (Sized_relobj_file::do_discard_decompressed_sections): New function.
51         * object.h (Object::decompressed_section_contents): New function.
52         (Object::discard_decompressed_sections): New function.
53         (Object::do_decompressed_section_contents): New function.
54         (Object::do_discard_decompressed_sections): New function.
55         (Compressed_section_info): New type.
56         (Compressed_section_map): Include decompressed section contents.
57         (Sized_relobj_file::do_decompressed_section_contents): New function.
58         (Sized_relobj_file::do_discard_decompressed_sections): New function.
59
60 2012-02-16  Cary Coutant  <ccoutant@google.com>
61
62         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
63         * testsuite/Makefile.in: Regenerate.
64
65 2012-02-14  Cary Coutant  <ccoutant@google.com>
66
67         * options.cc (General_options::finalize): Disallow -pie and -static.
68
69 2012-02-03  Doug Kwan  <dougkwan@google.com>
70
71         * arm.cc (Arm_relocate_functions::abs8,
72         Arm_relocate_functions::abs16): Use
73         Bits::has_signed_unsigned_overflow32.
74         (Arm_relocate_functions::thm_abs8): Correct range of
75         overflow check.
76         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
77         in assertions.
78
79 2012-02-02  Doug Kwan  <dougkwan@google.com>
80
81         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
82         position independent outputs, not just shared objects.
83
84 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
85
86         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
87         * configure: Regenerated.
88
89 2012-01-27  Ian Lance Taylor  <iant@google.com>
90
91         * reloc.h (Bits): New class with static functions, copied from
92         namespace utils in arm.cc.
93         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
94         instead.
95
96 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
97
98         * incremental.cc (write_info_blocks): Correct relocation offset.
99
100 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
101
102         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
103         (Relocate::tls_gd_to_le): Likewise.
104
105 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
106
107         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
108
109 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
110
111         * configure.ac: Check if -mcmodel=medium works.
112         * configure: Regenerated.
113
114 2012-01-24  Cary Coutant  <ccoutant@google.com>
115
116         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
117         definition and ...
118         (read_unsigned_LEB_128_x): ... this new function.
119         (read_signed_LEB_128): Replaced with inline definition and ...
120         (read_signed_LEB_128_x): ... this new function.
121         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
122         (read_unsigned_LEB_128): Add inline definition.
123         (read_signed_LEB_128_x): New function.
124         (read_signed_LEB_128): Add inline definition.
125         * testsuite/Makefile.am (leb128_unittest): New unit test.
126         * testsuite/Makefile.in: Regenerate.
127         * testsuite/leb128_unittest.cc: New unit test.
128
129 2012-01-23  Ian Lance Taylor  <iant@google.com>
130
131         PR gold/13617
132         * i386.cc (Target_i386::do_code_fill): When using a jmp
133         instruction, pad with nop instructions.
134         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
135
136 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
137
138         * x86_64.cc (gc_process_relocs): Add typename on types used in
139         template.
140         (scan_relocs): Likewise.
141         (relocate_section): Likewise.
142         (apply_relocation): Likewise.
143
144 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
145
146         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
147         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
148         under x32.
149
150 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
151
152         * x86_64.cc: Initial support for x32.
153
154 2012-01-03  Cary Coutant  <ccoutant@google.com>
155
156         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
157         Use abstract base class for GOT.
158         * gold/output.h (class Output_data_got_base): New abstract base class.
159         (class Output_data_got): Derive from new base class, adjust ctors.
160         (Output_data_got::reserve_slot): Make virtual; rename to
161         do_reserve_slot; Adjust callers.
162         * gold/target.h (Sized_target::init_got_plt_for_update): Return
163         pointer to abstract base class.
164         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
165
166 2011-12-18  Ian Lance Taylor  <iant@google.com>
167
168         * object.h (Relobj::local_symbol_value): New function.
169         (Relobj::local_plt_offset): New function.
170         (Relobj::local_has_got_offset): New function.
171         (Relobj::local_got_offset): New function.
172         (Relobj::set_local_got_offset): New function.
173         (Relobj::do_local_symbol_value): New pure virtual function.
174         (Relobj::do_local_plt_offset): Likewise.
175         (Relobj::do_local_has_got_offset): Likewise.
176         (Relobj::do_local_got_offset): Likewise.
177         (Relobj::do_set_local_got_offset): Likewise.
178         (Sized_relobj::do_local_has_got_offset): Rename from
179         local_has_got_offset.
180         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
181         (Sized_relobj::do_set_local_got_offset): Rename from
182         set_local_got_offset.
183         (Sized_relobj_file::do_local_plt_offset): Rename from
184         local_plt_offset.
185         (Sized_relobj_file::do_local_symbol_value): New function.
186         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
187         local_plt_offset.
188         * output.cc (Output_data_got::Got_entry::write): Change object to
189         Relobj.  Use local_symbol_value.
190         (Output_data_got::add_global_with_rel): Change rel_dyn to
191         Output_data_reloc_generic*.  Use add_global_generic.
192         (Output_data_got::add_global_with_rela): Remove.  Change all
193         callers to use add_global_with_rel.
194         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
195         Output_data_reloc_generic*.  Use add_global_generic.
196         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
197         callers to use add_global_pair_with_rel.
198         (Output_data_got::add_local): Change object to Relobj*.
199         (Output_data_got::add_local_plt): Likewise.
200         (Output_data_got::add_local_with_rel): Change object to Relobj*,
201         change rel_dyn to Output_data_reloc_generic*.  Use
202         add_local_generic.
203         (Output_data_got::add_local_with_rela): Remove.  Change all
204         callers to use all_local_with_rel.
205         (Output_data_got::add_local_pair_with_rel): Change object to
206         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
207         add_output_section_generic.
208         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
209         callers to use add_local_pair_with_rel.
210         (Output_data_got::reserve_local): Change object to Relobj*.
211         * output.h: (class Output_data_reloc_generic): Add pure virtual
212         declarations for add_global_generic, add_local_generic,
213         add_output_section_generic.
214         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
215         functions for Output_data_reloc_generic.  Update declarations for
216         changes listed in output.cc.
217         (class Output_data_got): Change template parameter to got_size.
218         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
219         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
220         function.
221         (Sized_relobj_incr::do_local_plt_offset): New function.
222         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
223         add_global_generic.
224
225 2011-12-17  Cary Coutant  <ccoutant@google.com>
226
227         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
228         * resolve.cc (Symbol_table::resolve): Likewise.
229         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
230         arrays.
231         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
232
233 2011-12-16  Ian Lance Taylor  <iant@google.com>
234
235         * output.h (Output_data_reloc_generic::add): Only call
236         add_dynamic_reloc if this is a dynamic reloc section.
237
238 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
239
240         PR gold/13505
241         * target-reloc.h (apply_relocation): Replace <64, false> with
242         <size, big_endian>.
243
244 2011-11-25  Nick Clifton  <nickc@redhat.com>
245
246         * po/it.po: New Italian translation.
247
248 2011-11-17  Sterling Augustine  <saugustine@google.com>
249
250         * script.cc (script_include_directive): Implement.
251         (read_script_file): New local variables name and search_path. Update
252         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
253         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
254         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
255
256 2011-11-11  Sterling Augustine  <saugustine@google.com>
257
258         * yyscript.y (section_cmd): Add support for INCLUDE directive.
259         (file_or_sections_cmd): Likewise.
260
261 2011-11-11  Doug Kwan  <dougkwan@google.com>
262
263         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
264         if --just-symbols is given.
265
266 2011-11-10  Doug Kwan  <dougkwan@google.com>
267
268         PR gold/13362
269         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
270         when processing data relocs.
271         * reloc.h (Relocate_functions::rel_unaligned): New method.
272         (Relocate_functions::pcrel_unaligned): Ditto.
273         (Relocate_functions::rel32_unaligned): Ditto.
274         (Relocate_functions::pcrel32_unaligned): Ditto.
275
276 2011-11-09  Doug Kwan  <dougkwan@google.com>
277
278         PR gold/13362
279         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
280         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
281         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
282         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
283         (Relocate_functions::rel_unaligned): New.
284         (Relocate_functions::rel32_unaligned): New.
285         * target-reloc.h (relocate_for_relocatable): Add code to handle
286         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
287         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
288         arm_unaligned_reloc_r): New targets.
289         * testsuite/Makefile.in: Regenerate.
290         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
291         linking.
292
293 2011-11-02  Ian Lance Taylor  <iant@google.com>
294
295         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
296         NATIVE_LINKER.
297         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
298         * options.cc (General_options::finalize): Use library search path
299         from configure script if specified.  If not native and no sysroot,
300         only search TOOLLIBDIR.
301         * options.h (Search_directory::Search_directory): Change name to
302         const std::string&.
303         (General_options::add_to_library_path_with_sysroot): Change arg to
304         const std::string&.
305         * configure, Makefile.in, config.in: Rebuild.
306
307 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
308
309         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
310         we are working around the ARM1176 Erratum.
311         * options.h (General_options::fix_arm1176): Add option.
312         * testsuite/Makefile.am: Add testcases, and keep current ones
313         working.
314         * testsuite/Makefile.in: Regenerate.
315         * testsuite/arm_fix_1176.s: New file.
316         * testsuite/arm_fix_1176.sh: Likewise.
317
318 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
319
320         * arm.cc (Target_arm::Target_arm): Remove initialisation of
321         may_use_blx_.
322         (Target_arm::may_use_blx): Remove method.
323         (Target_arm::set_may_use_blx): Likewise.
324         (Target_arm::may_use_v4t_interworking): New method.
325         (Target_arm::may_use_v5t_interworking): Likewise.
326         (Target_arm::may_use_blx_): Remove member variable.
327         (Arm_relocate_functions::arm_branch_common): Check for v5T
328         interworking.
329         (Arm_relocate_functions::thumb_branch_common): Likewise.
330         (Reloc_stub::stub_type_for_reloc): Likewise.
331         (Target_arm::do_finalize_sections): Correct interworking checks.
332         * testsuite/Makefile.am: Add new tests.
333         * testsuite/Makefile.in: Regenerate.
334         * testsuite/arm_farcall_arm_arm.s: New test.
335         * testsuite/arm_farcall_arm_arm.sh: Likewise.
336         * testsuite/arm_farcall_arm_thumb.s: Likewise.
337         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
338         * testsuite/arm_farcall_thumb_arm.s: Likewise.
339         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
340         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
341         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
342
343 2011-10-31  Cary Coutant  <ccoutant@google.com>
344
345         PR gold/13023
346         * expression.cc (Expression::eval_with_dot): Add
347         is_section_dot_assignment parameter.
348         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
349         absolute and assigning to dot within a section.
350         * script-sections.cc
351         (Output_section_element_assignment::set_section_addresses): Pass
352         dot_section to set_if_absolute.
353         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
354         as is_section_dot_assignment flag to eval_with_dot.
355         (Output_section_element_dot_assignment::set_section_addresses):
356         Likewise.
357         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
358         parameter.  Also set value if relative to dot_section; set the
359         symbol's output_section.
360         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
361         parameter.  Adjust all callers.
362         (Expression::eval_maybe_dot): Likewise.
363         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
364         Adjust all callers.
365         * testsuite/script_test_2.t: Test assignment of an absolute value
366         to dot within an output section element.
367
368 2011-10-31  Cary Coutant  <ccoutant@google.com>
369
370         * options.h (class General_options): Add --[no-]gnu-unique options.
371         * symtab.cc (Symbol_table::sized_write_globals): Convert
372         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
373
374 2011-10-31  Cary Coutant  <ccoutant@google.com>
375
376         PR gold/13359
377         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
378         unnecessary assertion.
379         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
380
381 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
382
383         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
384         gc_mark_symbol.
385         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
386         gc_mark_symbol.
387         Change to just keep the section associated with symbol.
388         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
389         they are externally visible and --export-dynamic is turned on.
390         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
391
392 2011-10-19  Ian Lance Taylor  <iant@google.com>
393
394         PR gold/13163
395         * script-sections.cc
396         (Output_section_element_dot_assignment::needs_output_section): New
397         function.
398
399 2011-10-19  Ian Lance Taylor  <iant@google.com>
400
401         PR gold/13204
402         * layout.cc (Layout::segment_precedes): Don't assert failure if a
403         --section-start option was seen.
404         * options.h (General_options::any_section_start): New function.
405
406 2011-10-18  David S. Miller  <davem@davemloft.net>
407
408         PR binutils/13301
409         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
410         member to track relocation locations that have moved during TLS
411         reloc optimizations.
412         (Target_sparc::Relocate::Relocate): Initialize to NULL.
413         (Target_sparc::Relocate::relocate): Adjust view down by 4
414         bytes if it matches reloc_adjust_addr_.
415         (Target_sparc::Relocate::relocate_tls): Always move the
416         __tls_get_addr call delay slot instruction forward 4 bytes when
417         performing relaxation.
418
419 2011-10-18  Cary Coutant  <ccoutant@google.com>
420
421         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
422         (Output_file::map_no_anonymous): Check for non-zero
423         return code from posix_fallocate.
424
425 2011-10-17  Cary Coutant  <ccoutant@google.com>
426
427         PR gold/13245
428         * plugin.cc (is_visible_from_outside): Check for symbols
429         referenced from dynamic objects.
430         * resolve.cc (Symbol_table::resolve): Don't count references
431         from dynamic objects as references from real ELF files.
432         * testsuite/plugin_test_2.sh: Adjust expected result.
433
434 2011-10-17  Cary Coutant  <ccoutant@google.com>
435
436         * gold.cc: Include timer.h.
437         (queue_middle_tasks): Stamp time.
438         (queue_final_tasks): Likewise.
439         * main.cc (main): Store timer in parameters.  Print timers
440         for each pass.
441         * parameters.cc (Parameters::Parameters): Initialize timer_.
442         (Parameters::set_timer): New function.
443         (set_parameters_timer): New function.
444         * parameters.h (Parameters::set_timer): New function.
445         (Parameters::timer): New function.
446         (Parameters::timer_): New data member.
447         (set_parameters_timer): New function.
448         * timer.cc (Timer::stamp): New function.
449         (Timer::get_pass_time): New function.
450         * timer.h (Timer::stamp): New function.
451         (Timer::get_pass_time): New function.
452         (Timer::pass_times_): New data member.
453
454 2011-10-17  Cary Coutant  <ccoutant@google.com>
455
456         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
457         task for members of lib groups.
458
459 2011-10-17  Cary Coutant  <ccoutant@google.com>
460
461         PR gold/13288
462         * fileread.cc (File_read::find_view): Add assert.
463         (File_read::make_view): Move bounds check (replace with assert)...
464         (File_read::find_or_make_view): ... to here.
465
466 2011-10-12  Cary Coutant  <ccoutant@google.com>
467
468         * output.cc (Output_file::open_base_file): Handle case where
469         ::read returns less than requested size.
470
471 2011-10-10  Cary Coutant  <ccoutant@google.com>
472
473         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
474         Initialize defined_count_.
475         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
476         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
477         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
478         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
479         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
480         * incremental.h (Sized_relobj_incr::defined_count_): New data
481         member.
482         (Sized_incr_dynobj::defined_count_): New data member.
483         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
484         Return zeroes instead of internal error.
485
486 2011-10-10  Cary Coutant  <ccoutant@google.com>
487
488         PR gold/13249
489         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
490         (Output_reloc::symbol_value): Return PLT offset if flag is set.
491         * output.h (class Output_reloc): Add use_plt_offset flag.
492         (Output_reloc::type_): Adjust size of bit field.
493         (Output_reloc::use_plt_offset_): New bit field.
494         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
495         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
496         flag.  Adjust all callers.
497         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
498         creating RELATIVE relocations.
499
500 2011-10-10  Nick Clifton  <nickc@redhat.com>
501
502         * po/es.po: Updated Spanish translation.
503         * po/fi.po: Updated Finnish translation.
504
505 2011-10-03   Diego Novillo  <dnovillo@google.com>
506
507         * options.cc (parse_uint): Fix dereference of RETVAL.
508
509 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
510
511         * layout.h (section_order_map_): New member.
512         (get_section_order_map): New member function.
513         * output.cc (Output_section::add_input_section): Check for patterns
514         only when --section-ordering-file is specified.
515         * gold.cc (queue_middle_tasks): Delay updating order of sections till
516         output_sections have been formed.
517         * layout.cc (Layout_Layout): Initialize section_order_map_.
518         * plugin.cc (update_section_order): Store order in order_map. Do not
519         update the order.
520         * testsuite/Makefile.am: Add test case for plugin_final_layout.
521         * testsuite/Makefile.in: Regenerate.
522         * testsuite/plugin_section_order.c: New file.
523         * testsuite/plugin_final_layout.cc: New file.
524         * testsuite/plugin_final_layout.sh: New file.
525
526 2011-09-29  Cary Coutant  <ccoutant@google.com>
527
528         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
529         Check for NULL.
530         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
531         symbols during incremental update.
532         (Symbol_table::add_from_dynobj): Likewise.
533
534 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
535             Ian Lance Taylor  <iant@google.com>
536
537         * symtab.cc (Symbol_table::define_special_symbol): Always
538         canonicalize version string.
539
540 2011-09-26  Cary Coutant  <ccoutant@google.com>
541
542         * gold.cc (queue_initial_tasks): Move option checks ...
543         * options.cc (General_options::finalize): ... to here. Disable
544         some options; make others fatal.
545
546 2011-09-26  Cary Coutant  <ccoutant@google.com>
547
548         gcc PR lto/47247
549         * plugin.cc (get_symbols_v2): New function.
550         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
551         (is_referenced_from_outside): New function.
552         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
553         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
554         (get_symbols): Pass version parameter.
555         (get_symbols_v2): New function.
556         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
557         parameter.
558         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
559         (onload): Add LDPT_GET_SYMBOLS_V2.
560         (all_symbols_read_hook): Use get_symbols_v2; check for
561         LDPR_PREVAILING_DEF_IRONLY_EXP.
562         * testsuite/plugin_test_3.sh: Update expected results.
563
564 2011-09-23  Simon Baldwin  <simonb@google.com>
565
566         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
567         configuration options.
568         * configure: Regenerate.
569         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
570         * Makefile.in: Regenerate.
571         * testsuite/Makefile.in: Regenerate.
572
573 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
574
575         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
576
577 2011-09-19  Cary Coutant  <ccoutant@google.com>
578
579         * incremental.cc (can_incremental_update): Fix typo in comment.
580         * incremental.h (can_incremental_update): Likewise.
581
582 2011-09-18  Cary Coutant  <ccoutant@google.com>
583
584         * incremental.cc (can_incremental_update): New function.
585         * incremental.h (can_incremental_update): New function.
586         * layout.cc (Layout::init_fixed_output_section): Call it.
587         (Layout::make_output_section): Don't allow patch space in .eh_frame.
588         * object.cc (Sized_relobj_file::do_layout): Call
589         can_incremental_update.
590
591 2011-09-13  Cary Coutant  <ccoutant@google.com>
592
593         * configure.ac: Check for glibc support for gnu_indirect_function
594         support with static linking, setting automake conditional
595         IFUNC_STATIC.
596         * Makefile.in: Regenerate.
597         * configure: Regenerate.
598
599         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
600         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
601         for IFUNC_STATIC.
602         * testsuite/Makefile.in: Regenerate.
603
604 2011-09-13  Cary Coutant  <ccoutant@google.com>
605
606         * incremental.cc (Sized_relobj_incr::do_layout): Call
607         report_comdat_group for kept comdat sections.
608         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
609         * testsuite/Makefile.in: Regenerate.
610         * testsuite/incr_comdat_test_1.cc: New source file.
611         * testsuite/incr_comdat_test_2_v1.cc: New source file.
612         * testsuite/incr_comdat_test_2_v2.cc: New source file.
613         * testsuite/incr_comdat_test_2_v3.cc: New source file.
614
615 2011-09-13  Ian Lance Taylor  <iant@google.com>
616
617         * object.cc (Sized_relobj_file::do_layout): Remove unused local
618         variable external_symbols_offset.
619
620 2011-09-12  Ian Lance Taylor  <iant@google.com>
621
622         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
623         triggered if object has no symbols.
624
625 2011-09-09  David S. Miller  <davem@davemloft.net>
626
627         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
628         (Output_fill_debug_line::do_write): Likewise.
629
630 2011-08-29  Cary Coutant  <ccoutant@google.com>
631
632         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
633         casts to match formatting specs.
634         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
635
636 2011-08-26  Cary Coutant  <ccoutant@google.com>
637
638         * layout.cc (Free_list::allocate): Provide guarantee of minimum
639         remaining hole size when allocating.
640         (Layout::make_output_section): Set fill methods for debug sections.
641         * layout.h (Free_list::Free_list_node): Move from private to
642         public.
643         (Free_list::set_min_hole_size): New function.
644         (Free_list::begin, Free_list::end): New functions.
645         (Free_list::min_hole_): New data member.
646         * output.cc: Include dwarf.h.
647         (Output_fill_debug_info::do_minimum_hole_size): New function.
648         (Output_fill_debug_info::do_write): New function.
649         (Output_fill_debug_line::do_minimum_hole_size): New function.
650         (Output_fill_debug_line::do_write): New function.
651         (Output_section::Output_section): Initialize new data member.
652         (Output_section::set_final_data_size): Ensure patch space is larger
653         than minimum hole size.
654         (Output_section::do_write): Fill holes in debug sections.
655         * output.h (Output_fill): New class.
656         (Output_fill_debug_info): New class.
657         (Output_fill_debug_line): New class.
658         (Output_section::set_free_space_fill): New function.
659         (Output_section::free_space_fill_): New data member.
660         * testsuite/Makefile.am (incremental_test_3): Add
661         --incremental-patch option.
662         (incremental_test_4): Likewise.
663         (incremental_test_5): Likewise.
664         (incremental_test_6): Likewise.
665         (incremental_copy_test): Likewise.
666         (incremental_common_test_1): Likewise.
667         * testsuite/Makefile.in: Regenerate.
668
669 2011-08-26  Nick Clifton  <nickc@redhat.com>
670
671         * po/es.po: Updated Spanish translation.
672
673 2011-08-01  Cary Coutant  <ccoutant@google.com>
674
675         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
676         * gold/testsuite/Makefile.in: Regenerate.
677         * gold/testsuite/justsyms_exec.c: New source file.
678         * gold/testsuite/justsyms_lib.c: New source file.
679
680 2011-08-01  Cary Coutant  <ccoutant@google.com>
681
682         * layout.cc (Layout::set_segment_offsets): Don't realign text
683         segment if -Ttext was specified.
684         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
685         file type.
686         * object.h (Sized_relobj_file::e_type): New function.
687         (Sized_relobj_file::e_type_): New data member.
688         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
689         base address for ET_EXEC files.
690         * target.cc (Target::do_make_elf_object_implementation): Allow
691         ET_EXEC files with --just-symbols option.
692
693 2011-07-28  Cary Coutant  <ccoutant@google.com>
694
695         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
696         Add thread_number parameter.
697         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
698         * workqueue-threads.cc
699         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
700         current thread if its thread number is greater than desired thread
701         count.
702         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
703         Add thread_number parameter.
704         (Workqueue::should_cancel_thread): Likewise.
705         (Workqueue::find_runnable_or_wait): Pass thread_number to
706         should_cancel_thread.
707         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
708         parameter.
709
710 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
711
712         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
713         only after checking if it cannot be forced local.
714         * symtab.h (is_externally_visible): Check if the symbol is not forced
715         local.
716
717 2011-07-15  Ian Lance Taylor  <iant@google.com>
718
719         * options.h (class General_options): Add --print-output-format.
720         Move -EL next to -EB, for  better --help output.
721         * target-select.cc: Include <cstdio>, "options.h", and
722         "parameters.h".
723         (Target_selector::do_target_bfd_name): New function.
724         (print_output_format): New function.
725         * target-select.h (class Target_selector): Update declarations.
726         (Target_selector::target_bfd_name): New function.
727         (print_output_format): Declare.
728         * main.cc: Include "target-select.h".
729         (main): Handle --print-output-format.
730         * gold.cc: Include "target-select.h".
731         (queue_initial_tasks): Handle --print-output-format when there are
732         no input files.
733         * parameters.cc (parameters_force_valid_target): Give a better
734         error message if -EB/-EL does not match target.
735         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
736         function.
737
738 2011-07-15  Ian Lance Taylor  <iant@google.com>
739
740         * i386.cc (class Output_data_plt_i386): Add layout_ field.
741         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
742         (Output_data_plt_i386::do_write): Write address of .dynamic
743         section to first entry in .got.plt section.
744         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
745         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
746         Initialize layout_.
747         (Output_data_plt_x86_64::do_write): Write address of .dynamic
748         section to first entry in .got.plt section.
749         * layout.h (Layout::dynamic_section): New function.
750
751 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
752
753         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
754         to claim_file call.
755         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
756         input_section_position_, and input_section_glob_.
757         (read_layout_from_file): Call function section_ordering_specified.
758         * layout.h (is_section_ordering_specified): New function.
759         (section_ordering_specified): New function.
760         (section_ordering_specified_): New boolean member.
761         * main.cc(main): Call load_plugins after layout object is defined.
762         * output.cc (Output_section::add_input_section): Use
763         function section_ordering_specified to check if section ordering is
764         needed.
765         * output.cc (Output_section::add_relaxed_input_section): Use
766         function section_ordering_specified to check if section ordering is
767         needed.
768         (Output_section::update_section_layout): New function.
769         (Output_section::sort_attached_input_sections): Check if input section
770         must be reordered.
771         * output.h (Output_section::update_section_layout): New function.
772         * plugin.cc (get_section_count): New function.
773         (get_section_type): New function.
774         (get_section_name): New function.
775         (get_section_contents): New function.
776         (update_section_order): New function.
777         (allow_section_ordering): New function. 
778         (Plugin::load): Add the new interfaces to the transfer vector.
779         (Plugin_manager::load_plugins): New parameter.
780         (Plugin_manager::all_symbols_read): New parameter.
781         (Plugin_manager::claim_file): New parameter. Save the elf object for
782         unclaimed objects.
783         (Plugin_manager::get_elf_object): New function.
784         (Plugin_manager::get_view): Change to directly use the bool to check
785         if get_view is called from claim_file_hook.
786         * plugin.h (input_objects): New function
787         (Plugin__manager::load_plugins): New parameter.
788         (Plugin_manager::claim_file): New parameter.
789         (Plugin_manager::get_elf_object): New function.
790         (Plugin_manager::in_claim_file_handler): New function.
791         (Plugin_manager::in_claim_file_handler_): New member.
792         (layout): New function.
793         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
794         handler with an extra parameter. Make the elf object before calling
795         claim_file handler.
796         * testsuite/plugin_test.c (get_section_count): New function pointer.
797         (get_section_type): New function pointer.
798         (get_section_name): New function pointer.
799         (get_section_contents): New function pointer.
800         (update_section_order): New function pointer.
801         (allow_section_ordering): New function pointer.
802         (onload): Check if the new interfaces exist.
803
804 2011-07-13  Ian Lance Taylor  <iant@google.com>
805
806         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
807         relro section.
808         * x86_64.cc (Target_x86_64::got_section): Likewise.
809         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
810         (relro_now_test_SOURCES): New variable.
811         (relro_now_test_DEPENDENCIES): New variable.
812         (relro_now_test_LDFLAGS): New variable.
813         (relro_now_test_LDADD): New variable.
814         (relro_now_test.so): New target.
815         * testsuite/Makefile.in: Rebuild.
816
817 2011-07-12  Ian Lance Taylor  <iant@google.com>
818
819         PR gold/12980
820         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
821         GLOB_DAT relocation rather than a RELATIVE relocation for a
822         protected symbol when creating a shared library.
823         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
824         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
825         * testsuite/protected_main_1.cc (main): Test that protected
826         function has same address.
827
828 2011-07-11  Ian Lance Taylor  <iant@google.com>
829
830         PR gold/12979
831         * options.h (class General_options): Add -Bgroup.
832         * options.cc (General_options::finalize): If -Bgroup is set,
833         default to --unresolved-symbols=report-all.
834         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
835         * target-reloc.h (issue_undefined_symbol_error): Handle
836         --unresolved-symbols=report-all.
837
838 2011-07-08  Ian Lance Taylor  <iant@google.com>
839
840         PR gold/11985
841         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
842         if linker script discards key sections.
843         (Layout::create_dynamic_symtab): Likewise.
844         (Layout::assign_local_dynsym_offsets): Likewise.
845         (Layout::sized_create_version_sections): Likewise.
846         (Layout::create_interp): Likewise.
847         (Layout::finish_dynamic_section): Likewise.
848         (Layout::set_dynamic_symbol_size): Likewise.
849
850 2011-07-08  Ian Lance Taylor  <iant@google.com>
851
852         PR gold/12386
853         * options.h (class General_options): Add --unresolved-symbols.
854         * target-reloc.h (issue_undefined_symbol_error): Check
855         --unresolved-symbols.  Add comments.
856
857 2011-07-08  Ian Lance Taylor  <iant@google.com>
858
859         * testsuite/odr_violation2.cc (Ordering::operator()): Make
860         expression more complex.
861
862 2011-07-08  Ian Lance Taylor  <iant@google.com>
863
864         PR gold/11317
865         * target-reloc.h (issue_undefined_symbol_error): New inline
866         function, broken out of relocate_section.
867         (relocate_section): Call issue_undefined_symbol_error.
868         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
869         there is no TLS segment if we are about to issue an undefined
870         symbol error.
871         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
872
873 2011-07-08  Ian Lance Taylor  <iant@google.com>
874
875         PR gold/12279
876         * resolve.cc (Symbol_table::should_override): Add fromtype
877         parameter.  Change all callers.  Give error when linking together
878         TLS and non-TLS symbol.
879         (Symbol_table::should_override_with_special): Add fromtype
880         parameter.  Change all callers.
881         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
882         there is no TLS segment if we have reported some errors.
883         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
884
885 2011-07-08  Ian Lance Taylor  <iant@google.com>
886
887         PR gold/12372
888         * target.h (Target::plt_address_for_global): New function.
889         (Target::plt_address_for_local): New function.
890         (Target::plt_section_for_global): Remove.
891         (Target::plt_section_for_local): Remove.
892         (Target::do_plt_address_for_global): New virtual function.
893         (Target::do_plt_address_for_local): New virtual function.
894         (Target::do_plt_section_for_global): Remove.
895         (Target::do_plt_section_for_local): Remove.
896         (Target::register_global_plt_entry): Add Symbol_table and Layout
897         parameters.
898         * output.cc (Output_data_got::Got_entry::write): Use
899         plt_address_for_global and plt_address_for_local.
900         * layout.cc (Layout::add_target_dynamic_tags): Use size and
901         address of output section.
902         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
903         got_irelative_, and irelative_count_ fields.  Update
904         declarations.
905         (Output_data_plt_i386::has_irelative_section): New function.
906         (Output_data_plt_i386::entry_count): Add irelative_count_.
907         (Output_data_plt_i386::set_final_data_size): Likewise.
908         (class Target_i386): Add got_irelative_ and rel_irelative_
909         fields.  Update declarations.
910         (Target_i386::Target_i386): Initialize new fields.
911         (Target_i386::do_plt_address_for_global): New function replacing
912         do_plt_section_for_global.
913         (Target_i386::do_plt_address_for_local): New function replacing
914         do_plt_section_for_local.
915         (Target_i386::got_section): Create got_irelative_.
916         (Target_i386::rel_irelative_section): New function.
917         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
918         fields.  Don't define __rel_iplt_{start,end}.
919         (Output_data_plt_i386::add_entry): Add symtab and layout
920         parameters.  Change all callers.  Use different PLT and GOT for
921         IFUNC symbols.
922         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
923         layout parameters.  Change all callers.  Use different PLT and
924         GOT.
925         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
926         (Output_data_plt_i386::rel_irelative): New function.
927         (Output_data_plt_i386::address_for_global): New function.
928         (Output_data_plt_i386::address_for_local): New function.
929         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
930         IRELATIVE GOT when changing IFUNC GOT entries.
931         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
932         reloc.
933         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
934         if we didn't create an IRELATIVE GOT.
935         (Target_i386::Relocate::relocate): Use plt_address_for_global and
936         plt_address_for_local.
937         (Target_i386::do_dynsym_value): Use plt_address_for_global.
938         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
939         got_irelative_, and irelative_count_ fields.  Update
940         declarations.
941         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
942         Initialize new fields.  Remove symtab parameter.  Change all
943         callers.
944         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
945         irelative_count_.
946         (Output_data_plt_x86_64::has_irelative_section): New function.
947         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
948         (class Target_x86_64): Add got_irelative_ and rel_irelative_
949         fields.  Update declarations.
950         (Target_x86_64::Target_x86_64): Initialize new fields.
951         (Target_x86_64::do_plt_address_for_global): New function replacing
952         do_plt_section_for_global.
953         (Target_x86_64::do_plt_address_for_local): New function replacing
954         do_plt_section_for_local.
955         (Target_x86_64::got_section): Create got_irelative_.
956         (Target_x86_64::rela_irelative_section): New function.
957         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
958         all callers.  Don't create __rel_iplt_{start,end}.
959         (Output_data_plt_x86_64::add_entry): Add symtab and layout
960         parameters.  Change all callers.  Use different PLT and GOT for
961         IFUNC symbols.
962         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
963         layout parameters.  Change all callers.  Use different PLT and
964         GOT.
965         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
966         parameters.  Change all callers.  Use different PLT and GOT for
967         IFUNC symbols.
968         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
969         (Output_data_plt_x86_64::rela_irelative): New function.
970         (Output_data_plt_x86_64::address_for_global): New function.
971         (Output_data_plt_x86_64::address_for_local): New function.
972         (Output_data_plt_x86_64::set_final_data_size): Likewise.
973         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
974         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
975         (Target_x86_64::register_global_plt_entry): Add symtab and layout
976         parameters.
977         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
978         reloc.
979         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
980         symbols if we didn't create an IRELATIVE GOT.
981         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
982         plt_address_for_local.
983         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
984         * testsuite/ifuncvar1.c: New test file.
985         * testsuite/ifuncvar2.c: New test file.
986         * testsuite/ifuncvar3.c: New test file.
987         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
988         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
989         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
990         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
991         * testsuite/Makefile.in: Rebuild.
992
993 2011-07-07  Cary Coutant  <ccoutant@google.com>
994
995         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
996         (two_file_test_1_ndebug.o): Likewise.
997         (two_file_test_1b_ndebug.o): Likewise.
998         (two_file_test_2_ndebug.o): Likewise.
999         (two_file_test_main_ndebug.o): Likewise.
1000         (incremental_test_2): Link with no-debug versions.
1001
1002 2011-07-06  Cary Coutant  <ccoutant@google.com>
1003
1004         * gold/incremental.cc
1005         (Output_section_incremental_inputs::write_info_blocks): Check for
1006         hidden and internal symbols.
1007
1008 2011-07-06  Cary Coutant  <ccoutant@google.com>
1009
1010         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1011         Check disposition for startup file.
1012         (Incremental_inputs::report_command_line): Ignore
1013         --incremental-startup-unchanged option.
1014         * options.cc (General_options::parse_incremental_startup_unchanged):
1015         New function.
1016         (General_options::General_options): Initialize new data member.
1017         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1018         (General_options): Add --incremental-startup-unchanged option.
1019         (General_options::incremental_startup_disposition): New function.
1020         (General_options::incremental_startup_disposition_): New data member.
1021
1022 2011-07-06  Cary Coutant  <ccoutant@google.com>
1023
1024         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1025         input file index to Script_info ctor.
1026         (Sized_incremental_binary::do_file_has_changed): Find the
1027         command-line argument for files named in scripts.
1028         * incremental.h (Script_info::Script_info): New ctor
1029         with input file index.
1030         (Script_info::input_file_index): New function.
1031         (Script_info::input_file_index_): New data member.
1032         (Incremental_binary::get_library): Add const.
1033         (Incremental_binary::get_script_info): Add const.
1034         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1035         * testsuite/Makefile.am (incremental_test_5): New test case.
1036         (incremental_test_6): New test case.
1037         * testsuite/Makefile.in: Regenerate.
1038
1039 2011-07-06  Cary Coutant  <ccoutant@google.com>
1040
1041         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1042         debug output when command lines differ.
1043
1044 2011-07-06  Cary Coutant  <ccoutant@google.com>
1045
1046         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1047         --incremental-patch option.
1048         * layout.cc (Free_list::allocate): Extend allocation beyond original
1049         end if enabled.
1050         (Layout::make_output_section): Mark sections that should get
1051         patch space.
1052         * options.cc (parse_percent): New function.
1053         * options.h (parse_percent): New function.
1054         (DEFINE_percent): New macro.
1055         (General_options): Add --incremental-patch option.
1056         * output.cc (Output_section::Output_section): Initialize new data
1057         members.
1058         (Output_section::add_input_section): Print section name when out
1059         of patch space.
1060         (Output_section::add_output_section_data): Likewise.
1061         (Output_section::set_final_data_size): Add patch space when
1062         doing --incremental-full.
1063         (Output_section::do_reset_address_and_file_offset): Remove patch
1064         space.
1065         (Output_segment::set_section_list_addresses): Print debug output
1066         only if --incremental-update.
1067         * output.h (Output_section::set_is_patch_space_allowed): New function.
1068         (Output_section::is_patch_space_allowed_): New data member.
1069         (Output_section::patch_space_): New data member.
1070         * parameters.cc (Parameters::incremental_full): New function.
1071         * parameters.h (Parameters::incremental_full): New function
1072         * testsuite/Makefile.am (incremental_test_2): Add test for
1073         --incremental-patch option.
1074         * testsuite/Makefile.in: Regenerate.
1075         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1076         (t18): Remove function body.
1077
1078 2011-07-05  Doug Kwan  <dougkwan@google.com>
1079
1080         PR gold/12771
1081         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1082         Arm_Address type for relocation result.
1083         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1084         overflow check.
1085         (Arm_relocate_functions::abs32): Use unaligned access.
1086         (Arm_relocate_functions::rel32): Ditto.
1087         (Arm_relocate_functions::prel31): Ditto.
1088         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1089         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1090         static data relocations.
1091         * testsuite/Makefile.in: Regnerate.
1092         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1093
1094 2011-07-05  Ian Lance Taylor  <iant@google.com>
1095
1096         PR gold/12392
1097         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1098         symbols if necessary.
1099         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1100
1101 2011-07-05  Ian Lance Taylor  <iant@google.com>
1102
1103         PR gold/12952
1104         * resolve.cc (Symbol::override_base_with_special): Simply override
1105         version with special symbol version, ignoring previous version.
1106
1107 2011-07-05  Ian Lance Taylor  <iant@google.com>
1108
1109         * object.cc (Sized_relobj_file::include_section_group): Add
1110         information to comment about signature location.
1111
1112 2011-07-02  Ian Lance Taylor  <iant@google.com>
1113
1114         PR gold/12957
1115         * options.h (class General_options): Add -f and -F.
1116         * options.cc (General_options::finalize): Fatal error if -f/-F
1117         are used without -shared.
1118         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1119
1120 2011-07-02  Ian Lance Taylor  <iant@google.com>
1121
1122         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1123
1124 2011-07-01  Ian Lance Taylor  <iant@google.com>
1125
1126         PR gold/12525
1127         PR gold/12952
1128         * resolve.cc (Symbol::override_base_with_special): Don't override
1129         the version if the overriding symbol has a different name.
1130         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1131         all callers.  If we give an error about an undefined version,
1132         define the base version if necessary.
1133         * dynobj.h (class Versions): Update declaration.
1134         * testsuite/weak_alias_test_5.cc: New file.
1135         * testsuite/weak_alias_test.script: New file.
1136         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1137         and versioned_alias have the right value, and call t2.
1138         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1139         weak_alias_test_5.so.
1140         (weak_alias_test_LDADD): Likewise.
1141         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1142         * testsuite/Makefile.in: Rebuild.
1143
1144 2011-07-01  Ian Lance Taylor  <iant@google.com>
1145
1146         PR gold/12525
1147         * options.h (class General_options): Support -z notext.
1148         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1149         -Wl,-z,notext.
1150         (two_file_shared_nonpic.so): Likewise.
1151         (two_file_shared_mixed.so): Likewise.
1152         (two_file_shared_mixed_1.so): Likewise.
1153         (weak_undef_lib_nonpic.so): Likewise.
1154         (alt/weak_undef_lib_nonpic.so): Likewise.
1155         (tls_test_shared_nonpic.so): Likewise.
1156         * testsuite/Makefile.in: Rebuild.
1157
1158 2011-07-01  Ian Lance Taylor  <iant@google.com>
1159
1160         PR gold/12525
1161         * configure.ac: Test whether static linking works, setting
1162         the automake conditional HAVE_STATIC.
1163         * testsuite/Makefile.am: Disable tests using -static if
1164         HAVE_STATIC is not true.
1165         * configure, testsuite/Makefile.in: Rebuild.
1166
1167 2011-07-01  Ian Lance Taylor  <iant@google.com>
1168
1169         PR gold/12525
1170         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1171         Assert if we see DW_EH_PE_indirect.
1172         * target.h (Target::ehframe_datarel_base): New function.
1173         (Target::do_ehframe_datarel_base): New target function.
1174         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1175         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1176         function.
1177
1178 2011-07-01  Ian Lance Taylor  <iant@google.com>
1179
1180         PR gold/12571
1181         * options.h (class General_options): Add
1182         --ld-generated-unwind-info.
1183         * ehframe.cc (Fde::write): Add address parameter.  Change all
1184         callers.  If associated with PLT, fill in address and size.
1185         (Cie::set_output_offset): Only add merge mapping if there is an
1186         object.
1187         (Cie::write): Add address parameter.  Change all callers.
1188         (Eh_frame::add_ehframe_for_plt): New function.
1189         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1190         input_offset_ fields into union u_, with new plt field.
1191         (Fde::Fde): Adjust for new union field.
1192         (Fde::Fde) [Output_data version]: New constructor.
1193         (Fde::add_mapping): Only add merge mapping if there is an object.
1194         (class Cie): Update declarations.
1195         (class Eh_frame): Declare add_ehframe_for_plt.
1196         * layout.cc (Layout::layout_eh_frame): Break out code into
1197         make_eh_frame_section, and call it.
1198         (Layout::make_eh_frame_section): New function.
1199         (Layout::add_eh_frame_for_plt): New function.
1200         * layout.h (class Layout): Update declarations.
1201         * merge.cc (Merge_map::add_mapping): Add assertion.
1202         * i386.cc: Include "dwarf.h".
1203         (class Output_data_plt_i386): Make first_plt_entry,
1204         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1205         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1206         and plt_eh_frame_fde.
1207         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1208         boundary.  Call add_eh_frame_for_plt if appropriate.
1209         * x86_64.cc: Include "dwarf.h".
1210         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1211         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1212         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1213         and plt_eh_frame_fde.
1214         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1215         appropriate.
1216
1217 2011-06-29  Ian Lance Taylor  <iant@google.com>
1218
1219         PR gold/12629
1220         * object.cc (Sized_relobj_file::layout_section): Change shdr
1221         parameter to be const.
1222         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1223         out of do_layout.
1224         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1225         appropriate.  Call layout_eh_frame_section.
1226         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1227         sections.
1228         * object.h (class Sized_relobj_file): Update declarations.
1229
1230 2011-06-29  Ian Lance Taylor  <iant@google.com>
1231
1232         PR gold/12652
1233         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1234         modifier.
1235         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1236
1237 2011-06-29  Ian Lance Taylor  <iant@google.com>
1238
1239         PR gold/12675
1240         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1241         SHT_X86_64_UNWIND.
1242         * layout.cc (Layout::layout_eh_frame): Likewise.
1243
1244 2011-06-29  Ian Lance Taylor  <iant@google.com>
1245
1246         PR gold/12695
1247         * layout.cc (Layout::symtab_section_shndx): New function.
1248         * layout.h (class Layout): Declare symtab_section_shndx.
1249         * output.cc (Output_section::write_header): Call it.
1250
1251 2011-06-29  Ian Lance Taylor  <iant@google.com>
1252
1253         PR gold/12818
1254         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1255         symbols which are not used in a relocation.
1256
1257 2011-06-28  Ian Lance Taylor  <iant@google.com>
1258
1259         PR gold/12898
1260         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1261         script create indistinguishable segments.
1262         (Layout::set_segment_offsets): Use stable_sort when sorting
1263         segments.  Pass this to Compare_segments constructor.
1264         * layout.h (class Layout): Make segment_precedes non-static.
1265         (class Compare_segments): Change from struct to class.  Add
1266         layout_ field.  Add constructor.
1267         * script-sections.cc
1268         (Script_sections::attach_sections_using_phdrs_clause): Rename
1269         local orphan to is_orphan.  Don't report failure to put empty
1270         section in segment.  On attachment failure, report name of
1271         section, and attach to first PT_LOAD segment.
1272
1273 2011-06-28  Ian Lance Taylor  <iant@google.com>
1274
1275         PR gold/12934
1276         * target-select.cc (Target_selector::Target_selector): Add
1277         emulation parameter.  Change all callers.
1278         (select_target_by_bfd_name): Rename from select_target_by_name.
1279         Change all callers.
1280         (select_target_by_emulation): New function.
1281         (supported_emulation_names): New function.
1282         * target-select.h (class Target_selector): Add emulation_ field.
1283         Update declarations.
1284         (Target_selector::recognize_by_bfd_name): Rename from
1285         recognize_by_name.  Change all callers.
1286         (Target_selector::supported_bfd_names): Rename from
1287         supported_names.  Change all callers.
1288         (Target_selector::recognize_by_emulation): New function.
1289         (Target_selector::supported_emulations): New function.
1290         (Target_selector::emulation): New function.
1291         (Target_selector::do_recognize_by_bfd_name): Rename from
1292         do_recognize_by_name.  Change all callers.
1293         (Target_selector::do_supported_bfd_names): Rename from
1294         do_supported_names.  Change all callers.
1295         (Target_selector::do_recognize_by_emulation): New function.
1296         (Target_selector::do_supported_emulations): New function.
1297         (select_target_by_bfd_name): Change name in declaration.
1298         (select_target_by_emulation): Declare.
1299         (supported_emulation_names): Declare.
1300         * parameters.cc (parameters_force_valid_target): Try to find
1301         target based on emulation from -m option.
1302         * options.h (class General_options): Change doc string for -m.
1303         * options.cc (help): Print emulations.
1304         (General_options::parse_V): Likewise.
1305         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1306         Add emulation parameter.  Change all callers.
1307
1308 2011-06-28  Ian Lance Taylor  <iant@google.com>
1309
1310         * target.h (class Target): Add osabi_ field.
1311         (Target::osabi): New function.
1312         (Target::set_osabi): New function.
1313         (Target::Target): Initialize osabi_.
1314         (Target::do_adjust_elf_header): Make pure virtual.
1315         (Sized_target::do_adjust_elf_header): Declare.
1316         * target.cc (Sized_target::do_adjust_elf_header): New function.
1317         (class Sized_target): Instantiate all versions.
1318         * freebsd.h (class Target_freebsd): Remove.
1319         (Target_selector_freebsd::do_recognize): Call set_osabi on
1320         Target.
1321         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1322         (Target_selector_freebsd::set_osabi): Remove.
1323         * i386.cc (class Target_i386): Inherit from Sized_target rather
1324         than Target_freebsd.
1325         * x86_64.cc (class Target_x86_64): Likewise.
1326
1327 2011-06-28  Ian Lance Taylor  <iant@google.com>
1328
1329         * target.h (Target::can_check_for_function_pointers): Rewrite.
1330         Make non-virtual.
1331         (Target::can_icf_inline_merge_sections): Likewise.
1332         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1333         (Target::Target_info): Add can_icf_inline_merge_sections field.
1334         (Target::do_can_check_for_function_pointers): New virtual
1335         function.
1336         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1337         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1338         from can_check_for_function_pointers, move in file.
1339         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1340         section_may_have_icf_unsafe_poineters, move in file.
1341         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1342         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1343         Rename from can_check_for_function_pointers, move in file.
1344         (Target_i386::can_icf_inline_merge_sections): Remove.
1345         (Target_i386::i386_info): Initialize
1346         can_icf_inline_merge_sections.
1347         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1348         Initialize can_icf_inline_merge_sections.
1349         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1350         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1351         Rename from can_check_for_function_pointers, move in file.
1352         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1353         (Target_x86_64::x86_64_info): Initialize
1354         can_icf_inline_merge_sections.
1355         * testsuite/testfile.cc (Target_test::test_target_info):
1356         Likewise.
1357         * icf.cc (get_section_contents): Correct formatting.
1358
1359 2011-06-27  Ian Lance Taylor  <iant@google.com>
1360
1361         * symtab.cc (Symbol::versioned_name): New function.
1362         (Symbol_table::add_to_final_symtab): Use versioned_name when
1363         appropriate.
1364         (Symbol_table::sized_write_symbol): Likewise.
1365         * symtab.h (class Symbol): Declare versioned_name.
1366         * stringpool.h (class Stringpool_template): Add variant of add
1367         which takes a std::basic_string.
1368         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1369         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1370         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1371         (ver_test_12.o): New target.
1372         * testsuite/Makefile.in: Rebuild.
1373
1374 2011-06-27  Doug Kwan  <dougkwan@google.com>
1375
1376         * arm.cc (Arm_relocate_functions::thm_jump8,
1377         Arm_relocate_functions::thm_jump11): Use a wider signed
1378         type to compute offset.
1379         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1380         arm_thm_jump8.
1381         * testsuite/Makefile.in: Regenerate.
1382         * testsuite/arm_branch_in_range.sh: Check test results of
1383         arm_thm_jump11 and arm_thm_jump8.
1384         * testsuite/arm_thm_jump11.s: New test source file.
1385         * testsuite/arm_thm_jump11.t: New linker script.
1386         * testsuite/arm_thm_jump8.s: New test source file.
1387         * testsuite/arm_thm_jump8.t: New linker script.
1388
1389 2011-06-24  Ian Lance Taylor  <iant@google.com>
1390
1391         * layout.cc: Include "object.h".
1392         (ctors_sections_in_init_array): New static variable.
1393         (Layout::is_ctors_in_init_array): New function.
1394         (Layout::layout): Add entry to ctors_sections_in_init_array if
1395         appropriate.
1396         * layout.h (class Layout): Declare is_ctors_in_init_array.
1397         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1398         is_ctors_reverse_view is set.
1399         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1400         all callers.  Set is_ctors_reverse_view field of View_size.
1401         (Sized_relobj_file::reverse_words): New function.
1402         * object.h (Sized_relobj_file::View_size): Add
1403         is_ctors_reverse_view field.
1404         (class Sized_relobj_file): Update declarations.
1405         * testsuite/initpri3.c: New test.
1406         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1407         initpri3b.
1408         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1409         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1410         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1411         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1412         * testsuite/Makefile.in: Rebuild.
1413
1414 2011-06-24  Cary Coutant  <ccoutant@google.com>
1415
1416         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1417         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1418         (debug_msg_cdebug.err): New targets.
1419         * testsuite/Makefile.in: Regenerate.
1420         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1421         Fix checks for link with shared library.
1422
1423 2011-06-24  Doug Kwan  <dougkwan@google.com>
1424
1425         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1426         skip empty text sections.
1427         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1428
1429 2011-06-22  Ian Lance Taylor  <iant@google.com>
1430
1431         PR gold/12910
1432         * options.h (class General_options): Add --ctors-in-init-array.
1433         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1434         friends as SHT_PROGBITS for merging sections.
1435         (Layout::layout): Remove special handling of .init_array and
1436         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1437         and .dtors if ctors_in_init_array.
1438         (Layout::make_output_section): Force correct section types for
1439         .init_array and friends.  Don't sort if doing relocatable link,
1440         Don't sort .ctors and .dtors if ctors_in_init_array.
1441         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1442         (Layout::output_section_name): Add relobj parameter.  Change all
1443         callers.  Handle .ctors. and .dtors. in code rather than table.
1444         Handle .ctors and .dtors if ctors_in_init_array.
1445         (Layout::match_file_name): New function, moved from output.cc.
1446         * layout.h (class Layout): Update declarations.
1447         * output.cc: Include "layout.h".
1448         (Input_section_sort_entry::get_priority): New function.
1449         (Input_section_sort_entry::match_file_name): Just call
1450         Layout::match_file_name.
1451         (Output_section::Input_section_sort_init_fini_compare::operator()):
1452         Handle .ctors and .dtors.  Sort by explicit priority rather than
1453         by name.
1454         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1455         * testsuite/initpri2.c: New test.
1456         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1457         (check_PROGRAMS): Add initpri2.
1458         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1459         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1460         * configure, testsuite/Makefile.in: Rebuild.
1461
1462 2011-06-19  Ian Lance Taylor  <iant@google.com>
1463
1464         PR gold/12880
1465         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1466         .interp section to a PT_INTERP segment even if we have seen a
1467         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1468         clause in a linker script.
1469         (Layout::finalize): Don't create a .interp section if we've
1470         already create a PT_INTERP segment.
1471         (Layout::create_interp): Always call choose_output_section (revert
1472         patch of 2011-06-17).  Don't create PT_INTERP segment.
1473         * script-sections.cc
1474         (Script_sections::create_note_and_tls_segments): Add a .interp
1475         section to a PT_INTERP segment even if we have seen a
1476         --dynamic-linker option.
1477
1478 2011-06-18  Ian Lance Taylor  <iant@google.com>
1479
1480         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1481         merely because a non-PT_LOAD segment has a dynamic reloc.
1482
1483 2011-06-18  Ian Lance Taylor  <iant@google.com>
1484
1485         * layout.cc (Layout::finish_dynamic_section): Don't create
1486         DT_FLAGS entry if not needed.
1487
1488 2011-06-18  Ian Lance Taylor  <iant@google.com>
1489
1490         PR gold/12745
1491         * layout.cc (Layout::layout_eh_frame): Correct handling of
1492         writable .eh_frame section.
1493
1494 2011-06-17  Ian Lance Taylor  <iant@google.com>
1495
1496         PR gold/12893
1497         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1498         symbol is redefined with the exact same object and value.
1499
1500 2011-06-17  Ian Lance Taylor  <iant@google.com>
1501
1502         PR gold/12880
1503         * layout.h (class Layout): Add interp_segment_ field.
1504         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1505         (Layout::attach_allocated_section_to_segment): If making shared
1506         library, put .interp section in PT_INTERP segment.
1507         (Layout::finalize): Also call create_interp if -dynamic-linker
1508         option was used.
1509         (Layout::create_interp): Assert that there is no PT_INTERP
1510         segment.  If not using a SECTIONS clause, use make_output_section.
1511         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1512         * script-sections.cc
1513         (Script_sections::create_note_and_tls_segments): If making shared
1514         library, put .interp section in PT_INTERP segment.
1515
1516 2011-06-17  Ian Lance Taylor  <iant@google.com>
1517
1518         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1519         when making a shared library.
1520
1521 2011-06-17  Ian Lance Taylor  <iant@google.com>
1522
1523         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1524         parameter.  Change all callers.  Don't issue warning about PC32
1525         against locally defined symbol.
1526
1527 2011-06-16  Ian Lance Taylor  <iant@google.com>
1528
1529         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1530         occurs in same object.
1531
1532 2011-06-14  Alan Modra  <amodra@gmail.com>
1533
1534         * po/POTFILES.in: Regenerate.
1535
1536 2011-06-09  Ian Lance Taylor  <iant@google.com>
1537
1538         * script-sections.cc
1539         (Orphan_output_section::set_section_addresses): For a relocatable
1540         link set address to 0.
1541
1542 2011-06-09  Cary Coutant  <ccoutant@google.com>
1543
1544         PR gold/12804
1545         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1546         used with --compress-debug-sections.
1547         * gold/object.cc (Sized_relobj_file::do_layout): Report
1548         uncompressed size of compressed input sections.
1549
1550 2011-06-08  Cary Coutant  <ccoutant@google.com>
1551
1552         PR gold/12804
1553         * testsuite/two_file_test_2_v1.cc: Change initialization of
1554         v2 to keep it in .data.
1555
1556 2011-06-07  Cary Coutant  <ccoutant@google.com>
1557
1558         * common.cc (Symbol_table::do_allocate_commons_list): Call
1559         gold_fallback.
1560         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1561         (Errors::fallback): New function.
1562         (gold_fallback): New function.
1563         * errors.h (Errors::fallback): New function.
1564         * gold.cc (gold_exit): Change status parameter to enum; adjust
1565         all callers.
1566         (queue_initial_tasks): Call gold_fallback.
1567         * gold.h: Include cstdlib.
1568         (Exit_status): New enum type.
1569         (gold_exit): Change status parameter to enum.
1570         (gold_fallback): New function.
1571         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1572         (Layout::create_symtab_sections): Likewise.
1573         (Layout::create_shdrs): Likewise.
1574         * main.cc (main): Adjust call to gold_exit.
1575         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1576         (Output_data_got::add_got_entry_pair): Likewise.
1577         (Output_section::add_input_section): Likewise.
1578         (Output_section::add_output_section_data): Likewise.
1579         (Output_segment::set_section_list_addresses): Likewise.
1580         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1581
1582 2011-06-07  Cary Coutant  <ccoutant@google.com>
1583
1584         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1585         for incremental links.
1586         * output.cc (Output_segment::set_section_list_addresses): Remove
1587         FIXME and test for TLS or BSS.
1588
1589 2011-06-07  Cary Coutant  <ccoutant@google.com>
1590
1591         * testsuite/Makefile.am: Add incremental_copy_test,
1592         incremental_common_test_1.
1593         * testsuite/Makefile.in: Regenerate.
1594         * testsuite/common_test_1_v1.c: New source file.
1595         * testsuite/common_test_1_v2.c: New source file.
1596         * testsuite/copy_test_v1.cc: New source file.
1597
1598 2011-06-07  Cary Coutant  <ccoutant@google.com>
1599
1600         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1601         update, allocate common from bss section's free list.
1602         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1603         linker-defined symbols.
1604         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1605         Skip GOT and PLT entries that are no longer referenced.
1606         (Output_section_incremental_inputs::write_info_blocks): Mark
1607         linker-defined symbols.
1608         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1609         * output.cc (Output_section::allocate): New function.
1610         * output.h (Output_section::allocate): New function.
1611         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1612         linker-defined symbols.
1613         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1614         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1615         (Symbol::init_base_output_data): Likewise.
1616         (Symbol::init_base_output_segment): Likewise.
1617         (Symbol::init_base_constant): Likewise.
1618         (Sized_symbol::init_output_data): Likewise.
1619         (Sized_symbol::init_output_segment): Likewise.
1620         (Sized_symbol::init_constant): Likewise.
1621         (Symbol_table::do_define_in_output_data): Likewise.
1622         (Symbol_table::do_define_in_output_segment): Likewise.
1623         (Symbol_table::do_define_as_constant): Likewise.
1624         * symtab.h (Symbol::is_predefined): New function.
1625         (Symbol::init_base_output_data): Add is_predefined parameter.
1626         (Symbol::init_base_output_segment): Likewise.
1627         (Symbol::init_base_constant): Likewise.
1628         (Symbol::is_predefined_): New data member.
1629         (Sized_symbol::init_output_data): Add is_predefined parameter.
1630         (Sized_symbol::init_output_segment): Likewise.
1631         (Sized_symbol::init_constant): Likewise.
1632         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1633
1634 2011-06-07  Cary Coutant  <ccoutant@google.com>
1635
1636         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1637         instead of emit_copy_reloc.
1638         (Copy_relocs::emit_copy_reloc): Refactor.
1639         (Copy_relocs::make_copy_reloc): New function.
1640         (Copy_relocs::add_copy_reloc): Remove.
1641         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1642         section.
1643         (Copy_relocs::make_copy_reloc): New function.
1644         (Copy_relocs::add_copy_reloc): Remove.
1645         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1646         unchanged input files.
1647         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1648         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1649         Reserve BSS space for COPY relocations.
1650         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1651         (Output_section_incremental_inputs::write_info_blocks): Record
1652         whether a symbol is copied from a shared object.
1653         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1654         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1655         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1656         (Incremental_input_entry_reader::get_output_symbol_index): Add
1657         is_copy parameter.
1658         (Incremental_binary::emit_copy_relocs): New function.
1659         (Incremental_binary::do_emit_copy_relocs): New function.
1660         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1661         new data member.
1662         (Sized_incremental_binary::add_copy_reloc): New function.
1663         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1664         (Sized_incremental_binary::Copy_reloc): New struct.
1665         (Sized_incremental_binary::Copy_relocs): New typedef.
1666         (Sized_incremental_binary::copy_relocs_): New data member.
1667         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1668         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1669         * target.h (Sized_target::emit_copy_reloc): New function.
1670         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1671
1672 2011-06-02  Cary Coutant  <ccoutant@google.com>
1673
1674         PR gold/12163
1675         * gold/archive.cc (Archive::Archive): Initialize new data member.
1676         (Archive::include_all_members): Return if archive has already been
1677         included.
1678         * gold/archive.h (Archive::include_all_members_): New data member.
1679
1680 2011-06-02  Nick Clifton  <nickc@redhat.com>
1681
1682         * dynobj.h: Fix spelling mistake in comment.
1683         * output.cc: Likewise.
1684
1685 2011-05-31  Doug Kwan  <dougkwan@google.com>
1686             Asier Llano
1687
1688         PR gold/12826
1689         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1690         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1691         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1692         redundant arm_exidx_test.so.
1693         * testsuite/Makefile.in: Regenerate.
1694         (check_SCRIPTS): Add pr12826.sh
1695         (check_DATA): Add pr12826.stdout
1696         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1697         * testsuite/pr12826.sh: New file.
1698         * testsuite/pr12826_1.s: Ditto.
1699         * testsuite/pr12826_1.s: Ditto.
1700
1701 2011-05-30  Ian Lance Taylor  <iant@google.com>
1702
1703         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1704         sections.
1705
1706 2011-05-29  Ian Lance Taylor  <iant@google.com>
1707
1708         PR gold/12804
1709         * testsuite/Makefile.am: Use different file name for two_file_test
1710         temporary file for each incremental test.
1711         * testsuite/Makefile.in: Rebuild.
1712
1713 2011-05-29  Ian Lance Taylor  <iant@google.com>
1714
1715         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1716         binary input file is empty.
1717
1718 2011-05-27  Ian Lance Taylor  <iant@google.com>
1719
1720         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1721         (ver_test_9.so): Likewise.
1722         * testsuite/Makefile.in: Rebuild.
1723
1724 2011-05-26 Cary Coutant  <ccoutant@google.com>
1725
1726         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1727         * incremental.cc (Incremental_inputs::report_input_section): Fix
1728         comment, indentation.
1729         (Incremental_inputs::report_comdat_group): New function.
1730         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1731         of data for incremental input file entry.
1732         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1733         group count, COMDAT group signatures.
1734         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1735         an unchanged input file.
1736         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1737         Initialize new data member.
1738         (Incremental_object_entry::add_comdat_group): New function.
1739         (Incremental_object_entry::get_comdat_group_count): New function.
1740         (Incremental_object_entry::get_comdat_signature_key): New function.
1741         (Incremental_object_entry::groups_): New data member.
1742         (Incremental_inputs::report_comdat_group): New function.
1743         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1744         data for incremental input file entry.
1745         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1746         (Incremental_input_entry_reader::get_input_section): Adjust size of
1747         data for incremental input file entry.
1748         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1749         (Incremental_input_entry_reader::get_comdat_group_signature): New
1750         function.
1751         * object.cc (Sized_relobj::include_section_group): Report kept
1752         COMDAT groups for incremental links.
1753
1754 2011-05-24  David Meyer  <pdox@google.com>
1755
1756         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1757         with name parameter.  Add found_name parameter.
1758         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1759         * dirsearch.h (class Dirsearch): Update declaration.
1760
1761 2011-05-24  Ian Lance Taylor  <iant@google.com>
1762
1763         * archive.cc (Library_base::should_include_member): Pull in object
1764         from archive if it defines the entry symbol.
1765         * parameters.cc (Parameters::entry): New function.
1766         * parameters.h (class Parameters): Declare entry.
1767         * output.h (class Output_file_header): Remove entry_ field.
1768         * output.cc (Output_file_header::Output_file_header): Remove entry
1769         parameter.  Change all callers.
1770         (Output_file_header::entry): Use parameters->entry.
1771         * gold.cc (queue_middle_tasks): Likewise.
1772         * plugin.cc (Plugin_hook::run): Likewise.
1773
1774 2011-05-24 Cary Coutant  <ccoutant@google.com>
1775
1776         * gold.cc (queue_initial_tasks): Pass incremental base filename
1777         to Output_file::open_base_file; don't print error message.
1778         * incremental-dump.cc (main): Adjust call to
1779         Output_file::open_for_modification.
1780         * incremental-dump.cc (main): Likewise.
1781         * incremental.cc (Incremental_inputs::report_command_line):
1782         Ignore --incremental-base option when comparing command lines.
1783         Ignore parameter when given as separate argument.
1784         * options.h (class General_options): Add --incremental-base.
1785         * output.cc (Output_file::Output_file):
1786         (Output_file::open_base_file): Add base_name and writable parameters;
1787         read base file into new file; print error message here.
1788         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1789         callers.
1790         * output.h (Output_file::open_for_modification): Rename to...
1791         (Output_file::open_base_file): ...this; add base_name and
1792         writable parameters; adjust all callers.
1793         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1794         callers.
1795         * testsuite/Makefile.am (incremental_test_4): Test
1796         --incremental-base.
1797         * testsuite/Makefile.in: Regenerate.
1798
1799 2011-05-24 Cary Coutant  <ccoutant@google.com>
1800
1801         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1802         incremental_test_4.
1803         * testsuite/Makefile.in: Regenerate.
1804         * testsuite/two_file_test_1_v1.cc: New test source file.
1805         * testsuite/two_file_test_1b_v1.cc: New test source file.
1806         * testsuite/two_file_test_2_v1.cc: New test source file.
1807
1808 2011-05-24 Cary Coutant  <ccoutant@google.com>
1809
1810         * dynobj.h (Dynobj::do_dynobj): New function.
1811         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1812         flag and soname for shared objects.
1813         * incremental.cc (Incremental_inputs::report_object): Make
1814         either Incremental_object_entry or Incremental_dynobj_entry; add
1815         soname to string table.
1816         (Incremental_inputs::report_input_section): Add assertion.
1817         (Output_section_incremental_inputs::set_final_data_size): Adjust
1818         type of input file entry for shared libraries; adjust size of
1819         shared library info entry.
1820         (Output_section_incremental_inputs::write_input_files): Write
1821         as_needed flag for shared libraries.
1822         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1823         of input file entry for shared libraries; write soname.
1824         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1825         soname from incremental info.
1826         * incremental.h (enum Incremental_input_flags): Add
1827         INCREMENTAL_INPUT_AS_NEEDED.
1828         (Incremental_input_entry::Incremental_input_entry): Initialize new
1829         data member.
1830         (Incremental_input_entry::set_as_needed): New function.
1831         (Incremental_input_entry::as_needed): New function.
1832         (Incremental_input_entry::do_dynobj_entry): New function.
1833         (Incremental_input_entry::as_needed_): New data member.
1834         (Incremental_object_entry::Incremental_object_entry): Don't check
1835         for shared library.
1836         (Incremental_object_entry::do_type): Likewise.
1837         (class Incremental_dynobj_entry): New class.
1838         (Incremental_input_entry_reader::as_needed): New function.
1839         (Incremental_input_entry_reader::get_soname): New function.
1840         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1841         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1842         size of shared library info entry.
1843         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1844         incremental link when adding DT_NEEDED entries.
1845         * object.h (Object::Object): Initialize new data member.
1846         (Object::dynobj): New function.
1847         (Object::set_as_needed): New function.
1848         (Object::as_needed): New function.
1849         (Object::do_dynobj): New function.
1850         (Object::as_needed_): New data member.
1851
1852 2011-05-24 Cary Coutant  <ccoutant@google.com>
1853
1854         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1855         info; adjust display of GOT entries.
1856         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1857         vector of input objects; remove file_status_.
1858         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1859         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1860         got_plt reader; call target hooks to reserve GOT entries.
1861         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1862         of input file info header and GOT info entry.
1863         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1864         relocation info.
1865         (Got_plt_view_info::got_descriptor): Remove.
1866         (Got_plt_view_info::sym_index): New data member.
1867         (Got_plt_view_info::input_index): New data member.
1868         (Local_got_offset_visitor::visit): Write input file index.
1869         (Global_got_offset_visitor::visit): Write 0 for input file index.
1870         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1871         with sym_index and input_index.
1872         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1873         incremental info GOT entry; replace got_descriptor with input_index.
1874         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1875         map from input file index to object.
1876         (Sized_relobj_incr::do_layout): Replace direct data member reference
1877         with accessor function.
1878         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1879         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1880         Adjust size of input file info header.
1881         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1882         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1883         (Incremental_input_entry_reader::get_input_section): Adjust size of
1884         input file info header.
1885         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1886         of incremental info GOT entry.
1887         (Incremental_got_plt_reader::get_got_desc): Remove.
1888         (Incremental_got_plt_reader::get_got_symndx): New function.
1889         (Incremental_got_plt_reader::get_got_input_index): New function.
1890         (Sized_incremental_binary::Sized_incremental_binary): Remove
1891         file_status_; add input_objects_.
1892         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1893         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1894         (Sized_incremental_binary::file_is_unchanged): Remove.
1895         (Sized_incremental_binary::set_input_object): New function.
1896         (Sized_incremental_binary::input_object): New function.
1897         (Sized_incremental_binary::file_status_): Remove.
1898         (Sized_incremental_binary::input_objects_): New data member.
1899         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1900         references.
1901         (Sized_relobj_incr::invalid_address): Move to base class.
1902         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1903         class.
1904         (Sized_relobj_incr::do_output_section_offset): Likewise.
1905         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1906         (Sized_relobj_incr::section_offsets_): Likewise.
1907         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1908         function.
1909         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1910         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1911         with accessor function.
1912         (Sized_relobj_file::do_layout): Likewise.
1913         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1914         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1915         (Sized_relobj_file::compute_final_local_value): Replace refs to
1916         section_offsets_ with accessor function.
1917         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1918         * object.h (Relobj::Relobj): Initialize new data members.
1919         (Relobj::add_dyn_reloc): New function.
1920         (Relobj::first_dyn_reloc): New function.
1921         (Relobj::dyn_reloc_count): New function.
1922         (Relobj::first_dyn_reloc_): New data member.
1923         (Relobj::dyn_reloc_count_): New data member.
1924         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1925         references.
1926         (Sized_relobj::Address): New typedef.
1927         (Sized_relobj::invalid_address): Move here from child class.
1928         (Sized_relobj::Sized_relobj): Initialize new data members.
1929         (Sized_relobj::sized_relobj): New function.
1930         (Sized_relobj::is_output_section_offset_invalid): Move here from
1931         child class.
1932         (Sized_relobj::get_output_section_offset): Likewise.
1933         (Sized_relobj::local_has_got_offset): Likewise.
1934         (Sized_relobj::local_got_offset): Likewise.
1935         (Sized_relobj::set_local_got_offset): Likewise.
1936         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1937         (Sized_relobj::clear_got_offsets): New function.
1938         (Sized_relobj::section_offsets): Move here from child class.
1939         (Sized_relobj::do_output_section_offset): Likewise.
1940         (Sized_relobj::do_set_section_offset): Likewise.
1941         (Sized_relobj::Local_got_offsets): Likewise.
1942         (Sized_relobj::local_got_offsets_): Likewise.
1943         (Sized_relobj::section_offsets_): Likewise.
1944         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1945         references.
1946         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1947         class.
1948         (Sized_relobj_file::sized_relobj): New function
1949         (Sized_relobj_file::local_has_got_offset): Move to base class.
1950         (Sized_relobj_file::local_got_offset): Likewise.
1951         (Sized_relobj_file::set_local_got_offset): Likewise.
1952         (Sized_relobj_file::get_output_section_offset): Likewise.
1953         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1954         (Sized_relobj_file::do_output_section_offset): Likewise.
1955         (Sized_relobj_file::do_set_section_offset): Likewise.
1956         (Sized_relobj_file::Local_got_offsets): Likewise.
1957         (Sized_relobj_file::local_got_offsets_): Likewise.
1958         (Sized_relobj_file::section_offsets_): Likewise.
1959         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1960         (all constructors).
1961         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1962         (Output_reloc::get_symbol_index): Likewise.
1963         (Output_reloc::local_section_offset): Likewise.
1964         (Output_reloc::get_address): Likewise.
1965         (Output_reloc::symbol_value): Likewise.
1966         (Output_data_got::reserve_slot): Move to class definition.
1967         (Output_data_got::reserve_local): New function.
1968         (Output_data_got::reserve_slot_for_global): Remove.
1969         (Output_data_got::reserve_global): New function.
1970         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1971         (all constructors, two instantiations).
1972         (Output_reloc::get_relobj): New function (two instantiations).
1973         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1974         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1975         (Output_data_reloc::add_global): Adjust type of relobj.
1976         (Output_data_reloc::add_global_relative): Likewise.
1977         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1978         (Output_data_reloc::add_local): Likewise.
1979         (Output_data_reloc::add_local_relative): Likewise.
1980         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1981         (Output_data_reloc::add_local_section): Likewise.
1982         (Output_data_reloc::add_output_section): Likewise.
1983         (Output_data_reloc::add_absolute): Likewise.
1984         (Output_data_reloc::add_target_specific): Likewise.
1985         (Output_data_got::reserve_slot): Move definition here.
1986         (Output_data_got::reserve_local): New function.
1987         (Output_data_got::reserve_global): New function.
1988         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1989         section_offsets_ with accessor function.
1990         (Sized_relobj_file::write_sections): Likewise.
1991         (Sized_relobj_file::do_relocate_sections): Likewise.
1992         * target.h (Sized_target::reserve_local_got_entry): New function.
1993         (Sized_target::reserve_global_got_entry): New function.
1994         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1995         (Target_x86_64::reserve_global_got_entry): New function.
1996         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1997
1998 2011-05-23 Cary Coutant  <ccoutant@google.com>
1999
2000         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2001         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2002         bit when checking got_type.
2003         * incremental.cc (Sized_incremental_binary::setup_readers):
2004         Store symbol table and string table locations; initialize bit vector
2005         of file status flags.
2006         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2007         unchanged files.
2008         (Sized_incremental_binary::do_process_got_plt): New function.
2009         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2010         (Output_section_incremental_inputs::set_final_data_size): Record
2011         file index for each input file.
2012         (Output_section_incremental_inputs::write_got_plt): Store file index
2013         instead of input entry offset for each GOT entry.
2014         * incremental.h
2015         (Incremental_input_entry::Incremental_input_entry): Initialize new
2016         data member.
2017         (Incremental_input_entry::set_offset): Store file index.
2018         (Incremental_input_entry::get_file_index): New function.
2019         (Incremental_input_entry::file_index_): New data member.
2020         (Incremental_binary::process_got_plt): New function.
2021         (Incremental_binary::do_process_got_plt): New function.
2022         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2023         data members.
2024         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2025         (Sized_incremental_binary::set_file_is_unchanged): New function.
2026         (Sized_incremental_binary::file_is_unchanged): New function.
2027         (Sized_incremental_binary::do_process_got_plt): New function.
2028         (Sized_incremental_binary::file_status_): New data member.
2029         (Sized_incremental_binary::main_symtab_loc_): New data member.
2030         (Sized_incremental_binary::main_strtab_loc_): New data member.
2031         * output.cc (Output_data_got::Got_entry::write): Add case
2032         RESERVED_CODE.
2033         (Output_data_got::add_global): Call add_got_entry.
2034         (Output_data_got::add_global_plt): Likewise.
2035         (Output_data_got::add_global_with_rel): Likewise.
2036         (Output_data_got::add_global_with_rela): Likewise.
2037         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2038         (Output_data_got::add_global_pair_with_rela): Likewise.
2039         (Output_data_got::add_local): Call add_got_entry.
2040         (Output_data_got::add_local_plt): Likewise.
2041         (Output_data_got::add_local_with_rel): Likewise.
2042         (Output_data_got::add_local_with_rela): Likewise.
2043         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2044         (Output_data_got::add_local_pair_with_rela): Likewise.
2045         (Output_data_got::reserve_slot): New function.
2046         (Output_data_got::reserve_slot_for_global): New function.
2047         (Output_data_got::add_got_entry): New function.
2048         (Output_data_got::add_got_entry_pair): New function.
2049         (Output_section::add_output_section_data): Edit FIXME.
2050         * output.h
2051         (Output_section_data_build::Output_section_data_build): New
2052         constructor with size parameter.
2053         (Output_data_space::Output_data_space): Likewise.
2054         (Output_data_got::Output_data_got): Initialize new data member; new
2055         constructor with size parameter.
2056         (Output_data_got::add_constant): Call add_got_entry.
2057         (Output_data_got::reserve_slot): New function.
2058         (Output_data_got::reserve_slot_for_global): New function.
2059         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2060         (Output_data_got::add_got_entry): New function.
2061         (Output_data_got::add_got_entry_pair): New function.
2062         (Output_data_got::free_list_): New data member.
2063         * target.h (Sized_target::init_got_plt_for_update): New function.
2064         (Sized_target::register_global_plt_entry): New function.
2065         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2066         Initialize new data member; call init; add constructor with PLT count.
2067         (Output_data_plt_x86_64::init): New function.
2068         (Output_data_plt_x86_64::add_relocation): New function.
2069         (Output_data_plt_x86_64::reserve_slot): New function.
2070         (Output_data_plt_x86_64::free_list_): New data member.
2071         (Target_x86_64::init_got_plt_for_update): New function.
2072         (Target_x86_64::register_global_plt_entry): New function.
2073         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2074         incremental updates.
2075         (Output_data_plt_x86_64::add_relocation): New function.
2076         * testsuite/object_unittest.cc (Object_test): Set default options.
2077
2078 2011-05-16  Ian Lance Taylor  <iant@google.com>
2079
2080         * options.h (class General_options): Make -i a synonym for -r.
2081
2082 2011-05-16  Ian Lance Taylor  <iant@google.com>
2083
2084         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2085
2086 2011-05-10 Cary Coutant  <ccoutant@google.com>
2087
2088         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2089         strip_all (-s).
2090
2091 2011-05-06  Ian Lance Taylor  <iant@google.com>
2092
2093         * layout.cc (Layout::layout): If the output section flags change,
2094         update the ordering.
2095
2096 2011-04-25 Cary Coutant  <ccoutant@google.com>
2097
2098         * incremental-dump.cc (dump_incremental_inputs): Print local
2099         symbol info for each input file.
2100         * incremental.cc
2101         (Output_section_incremental_inputs::set_final_data_size): Add local
2102         symbol info to input file entries in incremental info.
2103         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2104         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2105         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2106         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2107         implementation.
2108         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2109         (Sized_incr_relobj::do_relocate): Write the local symbols.
2110         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2111         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2112         Adjust size of input file header.
2113         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2114         (Incremental_inputs_reader::get_local_symbol_count): New function.
2115         (Incremental_inputs_reader::get_input_section): Adjust size of input
2116         file header.
2117         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2118         (Sized_incr_relobj::This): New typedef.
2119         (Sized_incr_relobj::sym_size): New const data member.
2120         (Sized_incr_relobj::Local_symbol): New struct.
2121         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2122         (Sized_incr_relobj::do_local_symbol_offset): New function.
2123         (Sized_incr_relobj::local_symbol_count_): New data member.
2124         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2125         (Sized_incr_relobj::local_symbol_index_): New data member.
2126         (Sized_incr_relobj::local_symbol_offset_): New data member.
2127         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2128         (Sized_incr_relobj::local_symbols_): New data member.
2129         * object.h (Relobj::output_local_symbol_count): New function.
2130         (Relobj::local_symbol_offset): New function.
2131         (Relobj::do_output_local_symbol_count): New function.
2132         (Relobj::do_local_symbol_offset): New function.
2133         (Sized_relobj::do_output_local_symbol_count): New function.
2134         (Sized_relobj::do_local_symbol_offset): New function.
2135
2136 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2137
2138         * descriptors.cc (set_close_on_exec): New function.
2139         (Descriptors::open): Use set_close_on_exec.
2140         * output.cc (S_ISLNK): Define if not defined.
2141
2142 2011-04-22 Cary Coutant  <ccoutant@google.com>
2143
2144         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2145         global symbol map.
2146         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2147         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2148         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2149         relocations.
2150         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2151         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2152         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2153         * incremental.h
2154         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2155         function.
2156         (Incremental_binary::apply_incremental_relocs): New function.
2157         (Incremental_binary::do_apply_incremental_relocs): New function.
2158         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2159         data member.
2160         (Sized_incremental_binary::add_global_symbol): New function.
2161         (Sized_incremental_binary::global_symbol): New function.
2162         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2163         (Sized_incremental_binary::symbol_map_): New data member.
2164         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2165         * target.h (Sized_target::apply_relocation): New function.
2166         * target-reloc.h (apply_relocation): New function.
2167         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2168
2169 2011-04-22  Doug Kwan  <dougkwan@google.com>
2170
2171         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2172         flag of a SHT_ARM_EXIDX section.
2173         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2174         * testsuite/Makefile.in: Regenerate.
2175         * testsuite/arm_exidx_test.s: New file.
2176         * testsuite/arm_exidx_test.sh: Same.
2177
2178 2011-04-20 Cary Coutant  <ccoutant@google.com>
2179
2180         PR gold/12689
2181         * archive.h (Incremental_archive_entry::Archive_member):
2182         Initialize arg_serial_ (second constructor).
2183
2184 2011-04-17  Ian Lance Taylor  <iant@google.com>
2185
2186         * object.cc (Relocate_info::location): Simplify location string.
2187         * errors.cc (Errors::error_at_location): Don't print program
2188         name.
2189         (Errors::warning_at_location): Likewise.
2190         (Errors::undefined_symbol): Likewise.
2191         * testsuite/debug_msg.sh: Update accordingly.
2192
2193 2011-04-14 Cary Coutant  <ccoutant@google.com>
2194
2195         * gold/layout.cc (Layout::symtab_section_offset): New function.
2196         * gold/layout.h (Layout::symtab_section_offset): New function.
2197         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2198
2199 2011-04-12  Ian Lance Taylor  <iant@google.com>
2200
2201         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2202         with MREMAP_MAYMOVE.
2203         * output.h (class Output_file): Add map_is_allocated_ field.
2204         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2205         not available, provide stubs.  If mremap is not available, #define
2206         it to gold_mremap.
2207         (MREMAP_MAYMOVE): Define if not defined.
2208         (Output_file::Output_file): Initialize map_is_allocated_.
2209         (Output_file::resize): Check map_is_allocated_.
2210         (Output_file::map_anonymous): If mmap fails, use malloc.
2211         (Output_file::unmap): Don't do anything for an anonymous map.
2212         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2213         is not available, provide stubs.
2214         (File_read::View::~View): Use free rather than delete[].
2215         (File_read::make_view): Use malloc rather than new[].  If mmap
2216         fails, use malloc.
2217         (File_read::find_or_make_view): Use malloc rather than new[].
2218         * gold.h: Remove HAVE_REMAP code.
2219         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2220         exists.  Rename mremap to gold_mremap.  If mmap is not available
2221         don't do anything.
2222         * configure, config.in: Rebuild.
2223
2224 2011-04-11  Ian Lance Taylor  <iant@google.com>
2225
2226         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2227         initialize local variable v.
2228
2229 2011-04-11  Cary Coutant  <ccoutant@google.com>
2230
2231         * archive.cc (Archive::include_member): Adjust call to
2232         report_object.
2233         (Add_archive_symbols::run): Track argument serial numbers.
2234         (Lib_group::include_member): Likewise.
2235         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2236         * archive.h (Incremental_archive_entry::Archive_member):
2237         Initialize arg_serial_.
2238         (Archive_member::arg_serial_): New data member.
2239         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2240         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2241         incremental link.
2242         (Sized_dynobj::do_for_all_local_got_entries): New function.
2243         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2244         function.
2245         * fileread.cc (get_mtime): New function.
2246         * fileread.h (get_mtime): New function.
2247         * gold.cc (queue_initial_tasks): Check for incremental update.
2248         (process_incremental_input): New function.
2249         (queue_middle_tasks): Don't force valid target for incremental
2250         update.
2251         * incremental-dump.cc (find_input_containing_global): Adjust
2252         size of symbol info entry.
2253         (dump_incremental_inputs): Dump argument serial number and
2254         in_system_directory flag; bias shndx by 1; print symbol names
2255         when dumping per-file symbol lists; use new symbol info readers.
2256         * incremental.cc
2257         (Output_section_incremental_inputs:update_data_size): New function.
2258         (Sized_incremental_binary::setup_readers): Setup input readers
2259         for each input file; build maps for files added from libraries
2260         and scripts.
2261         (Sized_incremental_binary::check_input_args): New function.
2262         (Sized_incremental_binary::do_check_inputs): Build map of argument
2263         serial numbers to input arguments.
2264         (Sized_incremental_binary::do_file_has_changed): Rename
2265         do_file_is_unchanged to this; compare file modification times.
2266         (Sized_incremental_binary::do_init_layout): New function.
2267         (Sized_incremental_binary::do_reserve_layout): New function.
2268         (Sized_incremental_binary::do_get_input_reader): Remove.
2269         (Sized_incremental_binary::get_symtab_view): New function.
2270         (Incremental_checker::can_incrementally_link_output_file): Remove.
2271         (Incremental_inputs::report_command_line): Exclude --debug options.
2272         (Incremental_inputs::report_archive_begin): Add parameter; track
2273         argument serial numbers; don't put input file entry for archive
2274         before archive members.
2275         (Incremental_inputs::report_archive_end): Put input file entry
2276         for archive after archive members.
2277         (Incremental_inputs::report_object): Add parameter; track argument
2278         serial numbers and in_system_directory flag.
2279         (Incremental_inputs::report_script): Add parameter; track argument
2280         serial numbers.
2281         (Output_section_incremental_inputs::set_final_data_size): Adjust
2282         size of symbol info entry; check for forwarding symbols.
2283         (Output_section_incremental_inputs::write_input_files): Write
2284         in_system_directory flag and argument serial number.
2285         (Output_section_incremental_inputs::write_info_blocks): Map section
2286         indices between incremental info and original input file; store
2287         input section index for each symbol.
2288         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2289         change operator() to visit().
2290         (class Global_got_offset_visitor): Likewise.
2291         (class Global_symbol_visitor_got_plt):
2292         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2293         classes.
2294         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2295         (Sized_incr_relobj::do_read_symbols): New function.
2296         (Sized_incr_relobj::do_layout): New function.
2297         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2298         (Sized_incr_relobj::do_add_symbols): New function.
2299         (Sized_incr_relobj::do_should_include_member): New function.
2300         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2301         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2302         (Sized_incr_relobj::do_section_size): New function.
2303         (Sized_incr_relobj::do_section_name): New function.
2304         (Sized_incr_relobj::do_section_contents): New function.
2305         (Sized_incr_relobj::do_section_flags): New function.
2306         (Sized_incr_relobj::do_section_entsize): New function.
2307         (Sized_incr_relobj::do_section_address): New function.
2308         (Sized_incr_relobj::do_section_type): New function.
2309         (Sized_incr_relobj::do_section_link): New function.
2310         (Sized_incr_relobj::do_section_info): New function.
2311         (Sized_incr_relobj::do_section_addralign): New function.
2312         (Sized_incr_relobj::do_initialize_xindex): New function.
2313         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2314         (Sized_incr_relobj::do_read_relocs): New function.
2315         (Sized_incr_relobj::do_gc_process_relocs): New function.
2316         (Sized_incr_relobj::do_scan_relocs): New function.
2317         (Sized_incr_relobj::do_count_local_symbols): New function.
2318         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2319         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2320         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2321         (Sized_incr_relobj::do_relocate): New function.
2322         (Sized_incr_relobj::do_set_section_offset): New function.
2323         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2324         (Sized_incr_dynobj::do_read_symbols): New function.
2325         (Sized_incr_dynobj::do_layout): New function.
2326         (Sized_incr_dynobj::do_add_symbols): New function.
2327         (Sized_incr_dynobj::do_should_include_member): New function.
2328         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2329         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2330         (Sized_incr_dynobj::do_section_size): New function.
2331         (Sized_incr_dynobj::do_section_name): New function.
2332         (Sized_incr_dynobj::do_section_contents): New function.
2333         (Sized_incr_dynobj::do_section_flags): New function.
2334         (Sized_incr_dynobj::do_section_entsize): New function.
2335         (Sized_incr_dynobj::do_section_address): New function.
2336         (Sized_incr_dynobj::do_section_type): New function.
2337         (Sized_incr_dynobj::do_section_link): New function.
2338         (Sized_incr_dynobj::do_section_info): New function.
2339         (Sized_incr_dynobj::do_section_addralign): New function.
2340         (Sized_incr_dynobj::do_initialize_xindex): New function.
2341         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2342         (make_sized_incremental_object): New function.
2343         (Incremental_library::copy_unused_symbols): New function.
2344         (Incremental_library::do_for_all_unused_symbols): New function.
2345         * incremental.h (enum Incremental_input_flags): New type.
2346         (class Incremental_checker): Remove.
2347         (Incremental_input_entry::Incremental_input_entry): Add argument
2348         serial number.
2349         (Incremental_input_entry::arg_serial): New function.
2350         (Incremental_input_entry::set_is_in_system_directory): New function.
2351         (Incremental_input_entry::is_in_system_directory): New function.
2352         (Incremental_input_entry::arg_serial_): New data member.
2353         (Incremental_input_entry::is_in_system_directory_): New data member.
2354         (class Script_info): Move here from script.h.
2355         (Script_info::Script_info): Add filename parameter.
2356         (Script_info::filename): New function.
2357         (Script_info::filename_): New data member.
2358         (Incremental_script_entry::Incremental_script_entry): Add argument
2359         serial number.
2360         (Incremental_object_entry::Incremental_object_entry): Likewise.
2361         (Incremental_object_entry::add_input_section): Build list of input
2362         sections with map to original shndx.
2363         (Incremental_object_entry::get_input_section_index): New function.
2364         (Incremental_object_entry::shndx_): New data member.
2365         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2366         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2367         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2368         serial number.
2369         (Incremental_inputs::report_archive_begin): Likewise.
2370         (Incremental_inputs::report_object): Likewise.
2371         (Incremental_inputs::report_script): Likewise.
2372         (class Incremental_global_symbol_reader): New class.
2373         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2374         and store flags and input file type.
2375         (Incremental_input_entry_reader::arg_serial): New function.
2376         (Incremental_input_entry_reader::type): Extract type from flags.
2377         (Incremental_input_entry_reader::is_in_system_directory): New function.
2378         (Incremental_input_entry_reader::get_input_section_count): Call
2379         accessor function for type.
2380         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2381         function for type; adjust size of global symbol entry.
2382         (Incremental_input_entry_reader::get_global_symbol_count): Call
2383         accessor function for type.
2384         (Incremental_input_entry_reader::get_object_count): Likewise.
2385         (Incremental_input_entry_reader::get_object_offset): Likewise.
2386         (Incremental_input_entry_reader::get_member_count): Likewise.
2387         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2388         (Incremental_input_entry_reader::get_member_offset): Likewise.
2389         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2390         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2391         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2392         (Incremental_input_entry_reader::get_global_symbol_reader): New
2393         function.
2394         (Incremental_input_entry_reader::get_output_symbol_index): New
2395         function.
2396         (Incremental_input_entry_reader::type_): Remove.
2397         (Incremental_input_entry_reader::flags_): New data member.
2398         (Incremental_inputs_reader::input_file_offset): New function.
2399         (Incremental_inputs_reader::input_file_index): New function.
2400         (Incremental_inputs_reader::input_file): Call input_file_offset.
2401         (Incremental_inputs_reader::input_file_at_offset): New function.
2402         (Incremental_relocs_reader::get_r_type): Reformat.
2403         (Incremental_relocs_reader::get_r_shndx): Reformat.
2404         (Incremental_relocs_reader::get_r_offset): Reformat.
2405         (Incremental_relocs_reader::data): New function.
2406         (Incremental_binary::Incremental_binary): Initialize new data members.
2407         (Incremental_binary::check_inputs): Add cmdline parameter.
2408         (Incremental_binary::file_is_unchanged): Remove.
2409         (Input_reader::arg_serial): New function.
2410         (Input_reader::get_unused_symbol_count): New function.
2411         (Input_reader::get_unused_symbol): New function.
2412         (Input_reader::do_arg_serial): New function.
2413         (Input_reader::do_get_unused_symbol_count): New function.
2414         (Input_reader::do_get_unused_symbol): New function.
2415         (Incremental_binary::input_file_count): New function.
2416         (Incremental_binary::get_input_reader): Change signature to use
2417         index instead of filename.
2418         (Incremental_binary::file_has_changed): New function.
2419         (Incremental_binary::get_input_argument): New function.
2420         (Incremental_binary::get_library): New function.
2421         (Incremental_binary::get_script_info): New function.
2422         (Incremental_binary::init_layout): New function.
2423         (Incremental_binary::reserve_layout): New function.
2424         (Incremental_binary::output_file): New function.
2425         (Incremental_binary::do_check_inputs): New function.
2426         (Incremental_binary::do_file_is_unchanged): Remove.
2427         (Incremental_binary::do_file_has_changed): New function.
2428         (Incremental_binary::do_init_layout): New function.
2429         (Incremental_binary::do_reserve_layout): New function.
2430         (Incremental_binary::do_input_file_count): New function.
2431         (Incremental_binary::do_get_input_reader): Change signature.
2432         (Incremental_binary::input_args_map_): New data member.
2433         (Incremental_binary::library_map_): New data member.
2434         (Incremental_binary::script_map_): New data member.
2435         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2436         new data members.
2437         (Sized_incremental_binary::output_section): New function.
2438         (Sized_incremental_binary::inputs_reader): Add const.
2439         (Sized_incremental_binary::symtab_reader): Add const.
2440         (Sized_incremental_binary::relocs_reader): Add const.
2441         (Sized_incremental_binary::got_plt_reader): Add const.
2442         (Sized_incremental_binary::get_symtab_view): New function.
2443         (Sized_incremental_binary::Inputs_reader): New typedef.
2444         (Sized_incremental_binary::Input_entry_reader): New typedef.
2445         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2446         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2447         (Sized_incremental_binary::do_file_has_changed): New function.
2448         (Sized_incremental_binary::do_init_layout): New function.
2449         (Sized_incremental_binary::do_reserve_layout): New function.
2450         (Sized_input_reader::Inputs_reader): Remove.
2451         (Sized_input_reader::Input_entry_reader): Remove.
2452         (Sized_input_reader::do_arg_serial): New function.
2453         (Sized_input_reader::do_get_unused_symbol_count): New function.
2454         (Sized_input_reader::do_get_unused_symbol): New function.
2455         (Sized_incremental_binary::do_input_file_count): New function.
2456         (Sized_incremental_binary::do_get_input_reader): Change signature;
2457         use index instead of filename.
2458         (Sized_incremental_binary::section_map_): New data member.
2459         (Sized_incremental_binary::input_entry_readers_): New data member.
2460         (class Sized_incr_relobj): New class.
2461         (class Sized_incr_dynobj): New class.
2462         (make_sized_incremental_object): New function.
2463         (class Incremental_library): New class.
2464         * layout.cc (Free_list::num_lists): New static data member.
2465         (Free_list::num_nodes): New static data member.
2466         (Free_list::num_removes): New static data member.
2467         (Free_list::num_remove_visits): New static data member.
2468         (Free_list::num_allocates): New static data member.
2469         (Free_list::num_allocate_visits): New static data member.
2470         (Free_list::init): New function.
2471         (Free_list::remove): New function.
2472         (Free_list::allocate): New function.
2473         (Free_list::dump): New function.
2474         (Free_list::print_stats): New function.
2475         (Layout_task_runner::run): Resize output file for incremental updates.
2476         (Layout::Layout): Initialize new data members.
2477         (Layout::set_incremental_base): New function.
2478         (Layout::init_fixed_output_section): New function.
2479         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2480         incremental updates.
2481         (Layout::create_gold_note): Do not create gold note section for
2482         incremental updates.
2483         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2484         for incremental updates.
2485         (Layout::set_section_offsets): For incremental updates, allocate space
2486         from free list.
2487         (Layout::create_symtab_sections): Layout with offsets relative to
2488         start of section; for incremental updates, allocate space from free
2489         list.
2490         (Layout::create_shdrs): For incremental updates, allocate space from
2491         free list.
2492         (Layout::finish_dynamic_section): For incremental updates, do not
2493         check --as-needed (fixed in subsequent patch).
2494         * layout.h (class Free_list): New class.
2495         (Layout::set_incremental_base): New function.
2496         (Layout::incremental_base): New function.
2497         (Layout::init_fixed_output_section): New function.
2498         (Layout::allocate): New function.
2499         (Layout::incremental_base_): New data member.
2500         (Layout::free_list_): New data member.
2501         * main.cc (main): Print Free_list statistics.
2502         * object.cc (Relobj::finalize_incremental_relocs): Add
2503         clear_counts parameter; clear counts only when clear_counts is set.
2504         (Sized_relobj::Sized_relobj): Initialize new base class.
2505         (Sized_relobj::do_layout): Don't report special sections.
2506         (Sized_relobj::do_for_all_local_got_entries): New function.
2507         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2508         symtab_off to all symbol table offsets.
2509         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2510         * object.h (class Got_offset_list): Move to top of file.
2511         (Object::Object): Allow case where input_file == NULL.
2512         (Object::~Object): Likewise.
2513         (Object::input_file): Assert that input_file != NULL.
2514         (Object::lock): Allow case where input_file == NULL.
2515         (Object::unlock): Likewise.
2516         (Object::is_locked): Likewise.
2517         (Object::token): Likewise.
2518         (Object::release): Likewise.
2519         (Object::is_incremental): New function.
2520         (Object::get_mtime): New function.
2521         (Object::for_all_local_got_entries): New function.
2522         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2523         (Object::set_is_in_system_directory): New function.
2524         (Object::is_in_system_directory): New function.
2525         (Object::do_is_incremental): New function.
2526         (Object::do_get_mtime): New function.
2527         (Object::do_for_all_local_got_entries): New function.
2528         (Object::is_in_system_directory_): New data member.
2529         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2530         (class Sized_relobj_base): New class.
2531         (class Sized_relobj): Derive from Sized_relobj_base.
2532         (class Sized_relobj::Symbols): Redeclare from base class.
2533         (class Sized_relobj::local_got_offset_list): Remove.
2534         (class Sized_relobj::Output_sections): Redeclare from base class.
2535         (class Sized_relobj::do_for_all_local_got_entries): New function.
2536         (class Sized_relobj::write_local_symbols): Add offset parameter.
2537         (class Sized_relobj::local_symbol_offset_): Update comment.
2538         (class Sized_relobj::local_dynsym_offset_): Update comment.
2539         * options.cc (Input_arguments::add_file): Remove const.
2540         * options.h (Input_file_argument::Input_file_argument):
2541         Initialize arg_serial_ (all constructors).
2542         (Input_file_argument::set_arg_serial): New function.
2543         (Input_file_argument::arg_serial): New function.
2544         (Input_file_argument::arg_serial_): New data member.
2545         (Input_arguments::Input_arguments): Initialize file_count_.
2546         (Input_arguments::add_file): Remove const.
2547         (Input_arguments::number_of_input_files): New function.
2548         (Input_arguments::file_count_): New data member.
2549         (Command_line::number_of_input_files): Call
2550         Input_arguments::number_of_input_files.
2551         * output.cc (Output_segment_headers::Output_segment_headers):
2552         Set current size.
2553         (Output_section::Input_section::current_data_size): New function.
2554         (Output_section::Output_section): Initialize new data members.
2555         (Output_section::add_input_section): Don't do merge sections for
2556         an incremental link; allocate space from free list for an
2557         incremental update.
2558         (Output_section::add_output_section_data): Allocate space from
2559         free list for an incremental update.
2560         (Output_section::update_data_size): New function.
2561         (Output_section::set_fixed_layout): New function.
2562         (Output_section::reserve): New function.
2563         (Output_segment::set_section_addresses): Remove const.
2564         (Output_segment::set_section_list_addresses): Remove const; allocate
2565         space from free list for an incremental update.
2566         (Output_segment::set_offset): Adjust size of RELRO segment for an
2567         incremental update.
2568         * output.h (Output_data::current_data_size): Move here from
2569         child classes.
2570         (Output_data::pre_finalize_data_size): New function.
2571         (Output_data::update_data_size): New function.
2572         (Output_section_headers::update_data_size): new function.
2573         (Output_section_data_build::current_data_size): Move to Output_data.
2574         (Output_data_strtab::update_data_size): New function.
2575         (Output_section::current_data_size): Move to Output_data.
2576         (Output_section::set_fixed_layout): New function.
2577         (Output_section::has_fixed_layout): New function.
2578         (Output_section::reserve): New function.
2579         (Output_section::update_data_size): New function.
2580         (Output_section::has_fixed_layout_): New data member.
2581         (Output_section::free_list_): New data member.
2582         (Output_segment::set_section_addresses): Remove const.
2583         (Output_segment::set_section_list_addresses): Remove const.
2584         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2585         New function.
2586         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2587         New function.
2588         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2589         parameter when calling Add_symbols constructor; store argument
2590         serial number for members of a lib group.
2591         (Add_symbols::locks): Allow case where token == NULL.
2592         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2593         (Read_member::~Read_member): New function.
2594         (Read_member::is_runnable): New function.
2595         (Read_member::locks): New function.
2596         (Read_member::run): New function.
2597         (Check_script::~Check_script): New function.
2598         (Check_script::is_runnable): New function.
2599         (Check_script::locks): New function.
2600         (Check_script::run): New function.
2601         (Check_library::~Check_library): New function.
2602         (Check_library::is_runnable): New function.
2603         (Check_library::locks): New function.
2604         (Check_library::run): New function.
2605         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2606         (Add_symbols::library_): New data member.
2607         (class Read_member): New class.
2608         (class Check_script): New class.
2609         (class Check_library): New class.
2610         * reloc.cc (Read_relocs::is_runnable): Allow case where
2611         token == NULL.
2612         (Read_relocs::locks): Likewise.
2613         (Scan_relocs::locks): Likewise.
2614         (Relocate_task::locks): Likewise.
2615         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2616         to clear counters.
2617         (Sized_relobj::incremental_relocs_scan): Fix comment.
2618         (Sized_relobj::do_relocate): Pass output file offset to
2619         write_local_symbols.
2620         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2621         from class declaration.
2622         * script.cc (read_input_script): Allocate Script_info; pass
2623         argument serial number to report_script.
2624         * script.h (class Script_info): Move to incremental.h.
2625         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2626         * symtab.h (Symbol_table::add_from_incrobj): New function.
2627         (Symbol_table::set_file_offset): New function.
2628
2629 2011-04-05  Cary Coutant  <ccoutant@google.com>
2630
2631         * incremental-dump.cc (dump_incremental_inputs): Change signature
2632         to take a Sized_incremental_binary; change caller.  Use readers
2633         in Sized_incremental_binary.
2634         * incremental.cc
2635         (Sized_incremental_binary::find_incremental_inputs_sections):
2636         Rename do_find_incremental_inputs_sections to this.
2637         (Sized_incremental_binary::setup_readers): New function.
2638         (Sized_incremental_binary::do_check_inputs): Check
2639         has_incremental_info_ flag; move setup code to setup_readers;
2640         use input readers.
2641         (Sized_incremental_binary::do_file_is_unchanged): New function.
2642         (Sized_incremental_binary::do_get_input_reader): New function.
2643         * incremental.h (class Incremental_binary): Move to end of file.
2644         (Incremental_binary::file_is_unchanged): New function.
2645         (Incremental_binary::do_file_is_unchanged): New function.
2646         (Incremental_binary::Input_reader): New class.
2647         (Incremental_binary::get_input_reader): New function.
2648         (class Sized_incremental_binary): Move to end of file.
2649         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2650         input section reader classes.
2651         (Sized_incremental_binary::has_incremental_info): New function.
2652         (Sized_incremental_binary::inputs_reader): New function.
2653         (Sized_incremental_binary::symtab_reader): New function.
2654         (Sized_incremental_binary::relocs_reader): New function.
2655         (Sized_incremental_binary::got_plt_reader): New function.
2656         (Sized_incremental_binary::do_file_is_unchanged): New function.
2657         (Sized_incremental_binary::Sized_input_reader): New class.
2658         (Sized_incremental_binary::get_input_reader): New function.
2659         (Sized_incremental_binary::find_incremental_inputs_sections):
2660         Rename do_find_incremental_inputs_sections to this.
2661         (Sized_incremental_binary::setup_readers): New function.
2662         (Sized_incremental_binary::has_incremental_info_): New data member.
2663         (Sized_incremental_binary::inputs_reader_): New data member.
2664         (Sized_incremental_binary::symtab_reader_): New data member.
2665         (Sized_incremental_binary::relocs_reader_): New data member.
2666         (Sized_incremental_binary::got_plt_reader_): New data member.
2667         (Sized_incremental_binary::current_input_file_): New data member.
2668
2669 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2670
2671         PR gold/12640
2672         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2673         violation.
2674
2675 2011-03-30  Cary Coutant  <ccoutant@google.com>
2676
2677         * archive.cc (Archive::include_member): Adjust call to report_object.
2678         (Add_archive_symbols::run): Add script_info to call to
2679         report_archive_begin.
2680         (Lib_group::include_member): Adjust call to report_object.
2681         (Add_lib_group_symbols::run): Adjust call to report_object.
2682         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2683         blocks.  Add object count for script input files.
2684         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2685         script_info parameter; change all callers.
2686         (Incremental_inputs::report_object): Add script_info parameter;
2687         change all callers.
2688         (Incremental_inputs::report_script): Store backpointer to
2689         incremental info entry.
2690         (Output_section_incremental_inputs::set_final_data_size): Record
2691         additional information for scripts.
2692         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2693         * incremental.h (Incremental_script_entry::add_object): New function.
2694         (Incremental_script_entry::get_object_count): New function.
2695         (Incremental_script_entry::get_object): New function.
2696         (Incremental_script_entry::objects_): New data member; adjust
2697         constructor.
2698         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2699         (Incremental_inputs::report_object): Add script_info parameter.
2700         (Incremental_inputs_reader::get_object_count): New function.
2701         (Incremental_inputs_reader::get_object_offset): New function.
2702         * options.cc (Input_arguments::add_file): Return reference to
2703         new input argument.
2704         * options.h (Input_argument::set_script_info): New function.
2705         (Input_argument::script_info): New function.
2706         (Input_argument::script_info_): New data member; adjust all
2707         constructors.
2708         (Input_file_group::add_file): Return reference to new input argument.
2709         (Input_file_lib::add_file): Likewise.
2710         (Input_arguments::add_file): Likewise.
2711         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2712         * script.cc (Parser_closure::Parser_closure): Add script_info
2713         parameter; adjust all callers.
2714         (Parser_closure::script_info): New function.
2715         (Parser_closure::script_info_): New data member.
2716         (read_input_script): Report scripts earlier to incremental info.
2717         (script_add_file): Set script_info in Input_argument.
2718         (script_add_library): Likewise.
2719         * script.h (Script_options::Script_info): Rewrite class.
2720
2721 2011-03-29  Cary Coutant  <ccoutant@google.com>
2722
2723         * archive.cc (Library_base::should_include_member): Move
2724         method here from class Archive.
2725         (Archive::Archive): Initialize base class.
2726         (Archive::should_include_member): Move to base class.
2727         (Archive::do_for_all_unused_symbols): New function.
2728         (Add_archive_symbols::run): Remove redundant access to
2729         incremental_inputs.
2730         (Lib_group::Lib_group): Initialize base class.
2731         (Lib_group::do_filename): New function.
2732         (Lib_group::include_member): Pass pointer to Lib_group to
2733         report_object.
2734         (Lib_group::do_for_all_unused_symbols): New function.
2735         (Add_lib_group_symbols::run): Report archive information for
2736         incremental links.
2737         * archive.h (class Library_base): New base class.
2738         (class Archive): Derive from Library_base.
2739         (Archive::filename): Move to base class.
2740         (Archive::set_incremental_info): Likewise.
2741         (Archive::incremental_info): Likewise.
2742         (Archive::Should_include): Likewise.
2743         (Archive::should_include_member): Likewise.
2744         (Archive::Armap_entry): Remove.
2745         (Archive::Unused_symbol_iterator): Remove.
2746         (Archive::unused_symbols_begin): Remove.
2747         (Archive::unused_symbols_end): Remove.
2748         (Archive::do_filename): New function.
2749         (Archive::do_get_mtime): New function.
2750         (Archive::do_for_all_unused_symbols): New function.
2751         (Archive::task_): Move to base class.
2752         (Archive::incremental_info_): Likewise.
2753         (class Lib_group): Derive from Library_base.
2754         (Lib_group::do_filename): New function.
2755         (Lib_group::do_get_mtime): New function.
2756         (Lib_group::do_for_all_unused_symbols): New function.
2757         (Lib_group::task_): Move to base class.
2758         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2759         function.
2760         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2761         function.
2762         * incremental.cc (Incremental_inputs::report_archive_begin):
2763         Use Library_base; call library's get_mtime; add incremental inputs
2764         entry before members.
2765         (class Unused_symbol_visitor): New class.
2766         (Incremental_inputs::report_archive_end): Use Library_base; use
2767         visitor class to record unused symbols; don't add incremental inputs
2768         entry after members.
2769         (Incremental_inputs::report_object): Use Library_base.
2770         * incremental.h
2771         (Incremental_archive_entry::Incremental_archive_entry): Remove
2772         unused Archive parameter.
2773         (Incremental_inputs::report_archive_begin): Use Library_base.
2774         (Incremental_inputs::report_archive_end): Likewise.
2775         (Incremental_inputs::report_object): Likewise.
2776         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2777         function.
2778         * object.h (Object::for_all_global_symbols): New function.
2779         (Object::do_for_all_global_symbols): New function.
2780         (Sized_relobj::do_for_all_global_symbols): New function.
2781         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2782         function.
2783         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2784         function.
2785
2786 2011-03-27  Ian Lance Taylor  <iant@google.com>
2787
2788         * archive.cc (Archive::interpret_header): Return -1 if something
2789         goes wrong.  Change callers accordingly.
2790
2791 2011-03-25  Cary Coutant  <ccoutant@google.com>
2792
2793         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2794         * testsuite/Makefile.in: Regenerate.
2795
2796 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2797
2798         * plugin.cc (get_view): New.
2799         (Plugin::load): Pass get_view to the plugin.
2800         (Plugin_manager::get_view): New.
2801
2802 2011-03-21  Ian Lance Taylor  <iant@google.com>
2803
2804         * testsuite/final_layout.sh: Rewrite to not use dc.
2805         * testsuite/relro_test.sh: Fail if dc is not present.
2806
2807 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2808
2809         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2810         Change == to -eq.
2811         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2812         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2813         Change == to -eq.
2814         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2815         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2816
2817 2011-03-14  Ian Lance Taylor  <iant@google.com>
2818
2819         * script-sections.cc (Sort_output_sections::script_compare):
2820         Rename from is_before, change return type.
2821         (Sort_output_sections::operator()): Adjust accordingly.
2822
2823 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2824
2825         PR gold/12572
2826         * testsuite/odr_violation2.cc: Add comment to make all error line
2827         numbers double digits.
2828         * testsuite/debug_msg.sh: Adjust expected errors.
2829
2830 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2831
2832         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2833         but mark earlier ones as non-canonical
2834         (offset_to_iterator): Update search target and example
2835         (do_addr2line): Return extra lines in a vector*
2836         (format_file_lineno): Extract from do_addr2line
2837         (one_addr2line): Add vector* out-param
2838         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2839         when a lineno entry appeared last for its instruction
2840         (Dwarf_line_info): Add vector* out-param
2841         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2842         * symtab.cc (Odr_violation_compare): Include the lineno in the
2843         comparison again.
2844         (linenos_from_loc): New. Combine the canonical line for an
2845         address with its other lines.
2846         (True_if_intersect): New. Helper functor to make
2847         std::set_intersection a query.
2848         (detect_odr_violations): Compare sets of lines instead of just
2849         one line for each function. This became less deterministic, but
2850         has fewer false positives.
2851         * symtab.h: Declarations.
2852         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2853         mix an optimized and non-optimized object in the same binary
2854         (odr_violation2.so): Same.
2855         * testsuite/Makefile.in: Regenerate from Makefile.am.
2856         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2857         * testsuite/debug_msg.sh: Update line numbers and add
2858         assertions.
2859         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2860         non-optimized context.
2861         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2862         isn't inlined, and use OdrDerived in an optimized context.
2863         * testsuite/odr_header1.h: Defines OdrDerived, where
2864         optimization will change the
2865         first-instruction-in-the-destructor's file and line number.
2866         * testsuite/odr_header2.h: Defines OdrBase.
2867
2868 2011-03-09  Ian Lance Taylor  <iant@google.com>
2869
2870         * fileread.cc (File_read::clear_views): Don't delete the whole
2871         file view.
2872
2873 2011-03-08  Ian Lance Taylor  <iant@google.com>
2874
2875         PR gold/12525
2876         * fileread.cc: #include <climits>.
2877         (GOLD_IOV_MAX): Define.
2878         (File_read::read_multiple): Limit number of entries by iov_max.
2879         * fileread.h (class File_read): Always set max_readv_entries to
2880         128.
2881
2882 2011-03-07  Ian Lance Taylor  <iant@google.com>
2883
2884         PR gold/12525
2885         * options.h (class General_options): Add -dy and -dn.
2886
2887 2011-03-02  Cary Coutant  <ccoutant@google.com>
2888
2889         * testsuite/script_test_9.t: Add TLS segment.
2890
2891 2011-03-02  Simon Baldwin  <simonb@google.com>
2892
2893         * configure.ac: Add check for gnu_indirect_function support in
2894         the toolchain building binutils.
2895         * configure: Rebuild.
2896
2897 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2898
2899         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2900         plugin only symbols.
2901         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2902         in plugin files as not needed in the symbol table.
2903
2904 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2905
2906         * output.cc (Output_section::add_input_section): Delay fill
2907         generation for section ordering.
2908
2909 2011-02-09  Ian Lance Taylor  <iant@google.com>
2910
2911         PR gold/12316
2912         * object.h (class Sized_relobj): Remove clear_local_symbols.
2913         * reloc.cc (Sized_relobj::do_relocate): Don't call
2914         clear_local_symbols.
2915
2916 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2917
2918         * plugin.cc (is_visible_from_outside): Return true for symbols
2919         in the -u option.
2920
2921 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2922
2923         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2924         filename.
2925
2926 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2927
2928         * icf.h (is_section_foldable_candidate): Change type of parameter
2929         to std::string.
2930         * icf.cc (Icf::find_identical_sections): Change type of local variable
2931         section_name to be std::string.
2932         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2933
2934 2011-01-25  Ian Lance Taylor  <iant@google.com>
2935
2936         * script.cc (script_add_extern): Rewrite to use
2937         add_symbol_reference.
2938
2939 2011-01-25  Doug Kwan  <dougkwan@google.com>
2940
2941         * icf.cc (get_section_contents): Always lock section's object.
2942
2943 2011-01-24  Ian Lance Taylor  <iant@google.com>
2944
2945         * options.h (class General_options): Accept
2946         --no-detect-odr-violations.
2947
2948 2011-01-24  Ian Lance Taylor  <iant@google.com>
2949
2950         * version.cc (version_string): Bump to 1.11.
2951
2952 2011-01-24  Ian Lance Taylor  <iant@google.com>
2953
2954         * plugin.cc (class Plugin_rescan): Define new class.
2955         (Plugin_manager::claim_file): Set any_claimed_.
2956         (Plugin_manager::save_archive): New function.
2957         (Plugin_manager::save_input_group): New function.
2958         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2959         necessary.
2960         (Plugin_manager::new_undefined_symbol): New function.
2961         (Plugin_manager::rescan): New function.
2962         (Plugin_manager::rescannable_defines): New function.
2963         (Plugin_manager::add_input_file): Set any_added_.
2964         * plugin.h (class Plugin_manager): define new fields rescannable_,
2965         undefined_symbols_, any_claimed_, and any_added_.  Declare
2966         Plugin_rescan as friend.  Declare new functions.
2967         (Plugin_manager::Rescannable): Define type.
2968         (Plugin_manager::Rescannable_list): Define type.
2969         (Plugin_manager::Undefined_symbol_list): Define type.
2970         (Plugin_manager::Plugin_manager): Initialize new fields.
2971         * archive.cc (Archive::defines_symbol): New function.
2972         (Add_archive_symbols::run): Pass archive to plugins if any.
2973         * archive.h (class Archive): Declare defines_symbol.
2974         * readsyms.cc (Input_group::~Input_group): New function.
2975         (Finish_group::run): Pass input_group to plugins if any.
2976         * readsyms.h (class Input_group): Declare destructor.
2977         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2978         any.
2979
2980 2011-01-10  Ian Lance Taylor  <iant@google.com>
2981
2982         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2983         section as relro.
2984         (Layout::set_segment_offsets): Reset increase_relro before calling
2985         set_section_addresses a second time.
2986
2987 2011-01-04  Cary Coutant  <ccoutant@google.com>
2988
2989         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2990         sections before NOBITS sections.
2991
2992 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2993
2994         * version.cc (print_version): Update copyright to 2011.
2995
2996 2010-12-23  Cary Coutant  <ccoutant@google.com>
2997
2998         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2999         of OS to this->add.  Add OD parameter to second form of the function.
3000
3001 2010-12-20  Ian Lance Taylor  <iant@google.com>
3002
3003         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3004         second of two consecutive entries with same offset.
3005
3006 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3007
3008         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3009         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3010         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3011         to avoid unneeded links against $(LDADD).
3012         * testsuite/Makefile.in: Regenerate.
3013
3014 2010-12-15  Ian Lance Taylor  <iant@google.com>
3015
3016         PR gold/12324
3017         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3018         for R_X86_64_32 and R_X86_64_PC32.
3019         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3020         ver_matching_def_pic.o.
3021         (ver_matching_def_pic.o): New target.
3022
3023 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3024
3025         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3026         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3027         Move definition before File_read::View member definitions.
3028         (File_read::View::~View): Initialize and hold lock before
3029         updating current_mapped_bytes.
3030
3031 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3032
3033         * dwarf_reader.cc: Remove outdated comment.
3034         * gold-threads.cc: Fix typo in error message.
3035         * archive.cc: Fix typos in comments.
3036         * archive.h: Likewise.
3037         * arm-reloc-property.cc: Likewise.
3038         * arm-reloc-property.h: Likewise.
3039         * arm-reloc.def: Likewise.
3040         * arm.cc: Likewise.
3041         * attributes.h: Likewise.
3042         * cref.cc: Likewise.
3043         * ehframe.cc: Likewise.
3044         * fileread.h: Likewise.
3045         * gold.h: Likewise.
3046         * i386.cc: Likewise.
3047         * icf.cc: Likewise.
3048         * incremental.h: Likewise.
3049         * int_encoding.cc: Likewise.
3050         * layout.h: Likewise.
3051         * main.cc: Likewise.
3052         * merge.h: Likewise.
3053         * object.cc: Likewise.
3054         * object.h: Likewise.
3055         * options.cc: Likewise.
3056         * readsyms.cc: Likewise.
3057         * reduced_debug_output.cc: Likewise.
3058         * reloc.cc: Likewise.
3059         * script-sections.cc: Likewise.
3060         * sparc.cc: Likewise.
3061         * symtab.h: Likewise.
3062         * target-reloc.h: Likewise.
3063         * target.cc: Likewise.
3064         * target.h: Likewise.
3065         * timer.cc: Likewise.
3066         * timer.h: Likewise.
3067         * x86_64.cc: Likewise.
3068
3069 2010-12-09  Cary Coutant  <ccoutant@google.com>
3070
3071         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3072         stack.
3073         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3074         parameter; change all callers.
3075         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3076         * options.h (warn_execstack): New option.
3077
3078 2010-12-07  Doug Kwan  <dougkwan@google.com>
3079
3080         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3081         like function call relocations.
3082
3083 2010-12-07  Ian Lance Taylor  <iant@google.com>
3084
3085         * archive.cc (Archive::get_elf_object_for_member): Permit
3086         punconfigured to be NULL.
3087         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3088         (Archive::include_member): Pass NULL to get_elf_object_for_member
3089         if we searched for the archive and this is the first included
3090         object.
3091
3092 2010-12-01  Ian Lance Taylor  <iant@google.com>
3093
3094         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3095         track_relocs_type_ field.
3096         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3097         Set track_relocs_type_.
3098         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3099         contents when using RELA relocs.
3100         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3101         reloc_map_.
3102         * reloc.cc (Track_relocs::next_addend): New function.
3103         * reloc.h (class Track_relocs): Declare next_addend.
3104
3105 2010-12-01  Ian Lance Taylor  <iant@google.com>
3106
3107         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3108         virtual destructor.
3109
3110 2010-12-01  Ian Lance Taylor  <iant@google.com>
3111
3112         * README: Update compilers known to work and fail.
3113
3114 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3115
3116         * configure.in: For --enable-gold, handle value `default' instead of
3117         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3118         not the default.
3119         * configure: Regenerate.
3120
3121 2010-11-18  Doug Kwan  <dougkwan@google.com>
3122
3123         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3124         and right_alignment to be zero.  Store result alignment only if it is
3125         greater than existing alignment.
3126
3127 2010-11-16  Cary Coutant  <ccoutant@google.com>
3128
3129         PR gold/12220
3130         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3131         Check for ".zdebug_line".
3132
3133 2010-11-16  Doug Kwan  <dougkwan@google.com>
3134             Cary Coutant  <ccoutant@google.com>
3135
3136         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3137         by reference; adjust all callers.
3138         * output.cc (Output_segment::set_section_addresses): Adjust references
3139         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3140         list is empty.
3141         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3142         end at page boundary.
3143
3144 2010-11-16  Cary Coutant  <ccoutant@google.com>
3145
3146         PR gold/12220
3147         * layout.cc (Layout::choose_output_section): Transform names of
3148         compressed sections even when using a script with a SECTIONS clause.
3149         (Layout::output_section_name): Remove code to transform
3150         compressed debug section names.
3151         * output.cc (Output_section::add_input_section): Use uncompressed
3152         section size when tracking input sections.
3153
3154 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3155
3156         * symtab.h (Symbol::NON_PIC_REF): Remove.
3157         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3158         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3159         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3160         (Symbol::use_plt_offset): Take a flags argument and pass it
3161         directly to needs_dynamic_reloc.  Restrict check for undefined
3162         weak symbols to function calls.
3163         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3164         (Target_arm::Scan::global): Use it.
3165         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3166         (Target_arm::Relocate::relocate): Likewise.
3167         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3168         parameter with an r_type parameter.  Use get_reference_flags
3169         to get the flags.
3170         (Target_arm::Relocate::relocate): Update accordingly.
3171         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3172         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3173         (Target_i386::Scan::global): Likewise.
3174         (Target_i386::Relocate::relocate): Likewise.
3175         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3176         parameter with an r_type parameter.  Use get_reference_flags
3177         to get the flags.
3178         (Target_i386::Relocate::relocate): Update accordingly.
3179         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3180         (Target_powerpc::Scan::global): Use it.
3181         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3182         (Target_powerpc::Relocate::relocate): Likewise.
3183         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3184         (Target_sparc::Scan::global): Use it.
3185         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3186         (Target_sparc::Relocate::relocate): Likewise.
3187         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3188         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3189         (Target_x86_64::Scan::global): Likewise.
3190         (Target_x86_64::Relocate::relocate): Likewise.
3191
3192 2010-11-08  Doug Kwan  <dougkwan@google.com>
3193             Cary Coutant  <ccoutant@google.com>
3194
3195         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3196         (Arm_exidx_merge_section::section_contents_): New data member.
3197         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3198         (Arm_input_section::~Arm_input_section): De-allocate memory.
3199         (Arm_input_section::original_contents_): New data member.       
3200         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3201         in parameters instead of calling Object::section_contents without
3202         locking.
3203         (Arm_output_section::group_section): New parameter TASK.  Pass it
3204         to callees that need locking objects.
3205         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3206         to lock EXIDX input sections.  Fix a formatting issue.  Call
3207         Arm_exidx_merged_section::build_contents to create merged section
3208         contents.
3209         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3210         to lock object of stub table owner.
3211         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3212         TEXT_SIZE to initialize data member TEXT_SIZE_.
3213         (Arm_exidx_input_section::addralign): Fix typo in comment.
3214         (Arm_exidx_input_section::text_size): New method.
3215         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3216         that require locking objects.  Lock objects before scanning for stubs
3217         and updating local symbols.
3218         (Arm_input_section<big_endian>::init): Copy contents of original
3219         input section.
3220         (Arm_input_section<big_endian>::do_write): Use saved contents of
3221         original input section instead of calling Object::section_contents
3222         without locking.
3223         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3224         size without calling Object::section_size().
3225         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3226         for size.  Allocate a buffer for merged EXIDX entries.
3227         (Arm_exidx_merged_section::build_contents): New method.
3228         (Arm_exidx_merged_section::do_write): Move merge section contents
3229         building code to Arm_exidx_merged_section::build_contetns.  Write
3230         out contetns in buffer instead of building it on the fly.
3231         (Arm_relobj::make_exidx_input_section): Also pass text section size
3232         to Arm_exidx_input_section constructor.
3233         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3234         (Arm_dynobj::do_read_symbols): Fix memory leak.
3235         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3236         * target.h: (class Task): Add forward declaration.
3237         (Target::relax): Add new parameter TASK and pass it to
3238         Target::do_relax().
3239         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3240
3241 2010-11-05  Cary Coutant  <ccoutant@google.com>
3242
3243         PR gold/10708
3244         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3245         object when reading from the file.
3246         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3247         second layout pass.
3248         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3249         when reading section contents.
3250         (get_section_contents): Likewise.
3251         (icf::find_identical_sections): Likewise.
3252         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3253         object when reading from the file.
3254         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3255         the object when doing deferred section layout.
3256
3257 2010-11-03  Nick Clifton  <nickc@redhat.com>
3258
3259         PR gold/12001
3260         * script.h (class Symbol_assignment: name): New member.  Returns
3261         the name of the symbol.
3262         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3263         Returns true if the given symbol name is on the list of
3264         assignments wating to be processed.
3265         * archive.cc (should_incldue_member): If the symbol is undefined,
3266         check to see if it is on the list of symbols pending assignment.
3267
3268 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3269
3270         * script-sections.cc (Script_sections::find_memory_region): Check
3271         for a NULL output section pointer.
3272
3273 2010-10-29  Doug Kwan  <dougkwan@google.com>
3274
3275         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3276         Output_section::add_relaxed_input_section.
3277         * output.cc (Output_section::add_relaxed_input_section): Add new
3278         arguments LAYOUT and NAME.  Set section order index.
3279         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3280         Copy section order index.
3281         * output.h (Output_section::add_relaxed_input_section): Add new
3282         arguments LAYOUT and NAME.
3283
3284 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3285
3286         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3287         NATIVE_OR_CROSS_LINKER.
3288         * testsuite/Makefile.in: Regenerate.
3289
3290 2010-10-20  Doug Kwan  <dougkwan@google.com>
3291
3292         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3293         without SHF_LINK_ORDER flags.
3294         * layout.cc (Layout::choose_output_section): Do not filter
3295         SHF_LINK_ORDER flag in a relocatable link.
3296
3297 2010-10-17  Cary Coutant  <ccoutant@google.com>
3298
3299         * output.h (Output_segment::set_section_addresses): Change function
3300         signature.  Update all callers.
3301         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3302         sections.
3303         (Output_segment::set_section_addresses): Align after last TLS
3304         section.  Add padding before last relro section instead of after.
3305
3306 2010-10-17  Doug Kwan  <dougkwan@google.com>
3307
3308         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3309         GOT output section to be writable.
3310
3311 2010-10-14  Cary Coutant  <ccoutant@google.com>
3312
3313         * debug.h (DEBUG_INCREMENTAL): New flag.
3314         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3315         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3316         mode.
3317         * incremental.cc (report_command_line): Ignore all forms of
3318         --incremental.
3319         * layout.cc (Layout::Layout): Check parameters for incremental link
3320         mode.
3321         * options.cc (General_options::parse_incremental): New function.
3322         (General_options::parse_no_incremental): New function.
3323         (General_options::parse_incremental_full): New function.
3324         (General_options::parse_incremental_update): New function.
3325         (General_options::incremental_mode_): New data member.
3326         (General_options::finalize): Check incremental_mode_.
3327         * options.h (General_options): Update help text for --incremental.
3328         Add --no-incremental, --incremental-full, --incremental-update.
3329         (General_options::Incremental_mode): New enum type.
3330         (General_options::incremental_mode): New function.
3331         (General_options::incremental_mode_): New data member.
3332         * parameters.cc (Parameters::incremental_mode_): New data member.
3333         (Parameters::set_options): Set incremental_mode_.
3334         (Parameters::set_incremental_full): New function.
3335         (Parameters::incremental): New function.
3336         (Parameters::incremental_update): New function.
3337         (set_parameters_incremental_full): New function.
3338         * parameters.h (Parameters::set_incremental_full): New function.
3339         (Parameters::incremental): New function.
3340         (Parameters::incremental_update): New function.
3341         (Parameters::incremental_mode_): New data member.
3342         (set_parameters_incremental_full): New function.
3343         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3344         incremental link mode.
3345         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3346         (Sized_relobj::do_relocate_sections): Likewise.
3347         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3348         option.
3349         * testsuite/Makefile.in: Regenerate.
3350         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3351
3352 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3353
3354         * script-sections.h (class Script_sections): Make
3355         Sections_elements typedef public.
3356         * script-sections.cc (class Sort_output_sections): Add elements_
3357         field.  Add constructor which sets it; change all callers.
3358         (Sort_output_sections::is_before): New function.
3359         (Sort_output_sections::operator()): Call is_before.
3360         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3361         conditional.
3362         * testsuite/script_test_10.sh: New test. Test script section
3363         order.
3364         * testsuite/script_test_10.t: Likewise.
3365         * testsuite/script_test_10.s: Likewise.
3366         * testsuite/Makefile.am: Wrap the cross linker tests and the
3367         common tests into NATIVE_OR_CROSS_LINKER.
3368         (check_SCRIPTS): Add script_test_10.sh.
3369         (check_DATA): Add script_test_10.stdout.
3370         (script_test_10.o, script_test_10): New targets.
3371         (script_test_10.stdout): New target.
3372         * configure, testsuite/Makefile.in: Regenerate.
3373
3374 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3375
3376         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3377         error for the deprecated relocations.
3378         (Target_arm::Scan::global): Likewise.
3379         (Target_arm::Relocate::relocate): Likewise.
3380
3381 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3382
3383         * fileread.cc (Input_file::find_file): Initialize *found_name
3384         and *namep when using the fallback search for case 4.
3385
3386 2010-10-11  Cary Coutant  <ccoutant@google.com>
3387
3388         * options.h (class General_options): Redefine -z lazy as an alias for
3389         the negation of -z now.
3390
3391 2010-10-11  Ian Lance Taylor  <iant@google.com>
3392
3393         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3394         binding.
3395
3396 2010-10-06  Nick Clifton  <nickc@redhat.com>
3397
3398         * script-sections.cc(class Memory_region): Remove
3399         current_lma_offset_ field.  Rename current_vma_offset_ to
3400         current_offset_.  Add last_section_ field.
3401         (Memory_region::get_current_vma_address): Rename to
3402         get_current_address.
3403         (Memory_region::get_current_lma_address): Delete.
3404         (Memory_region::increment_vma_offset): Rename to
3405         increment_offset.
3406         (Memory_region::increment_lma_offset): Delete.
3407         (Memory_region::attributes_compatible): New method.  Returns
3408         true if the provided section is compatible with the region.
3409         (Memory_region::get_last_section): New method.  Returns the last
3410         section to use the region.
3411         (Memory_region::set_last_section): New method.  Stores the last
3412         section to use the region.
3413         (Script_sections::block_in_region): New method.  Returns true if
3414         a block of memory is contained within a region.
3415         (Script_sections::find_memory_region): New method.  Locates a
3416         memory region to be used to set a VMA or LMA address.
3417         (Output_section_definition::set_section_addresses): Add code to
3418         check for addresses set by memory regions.
3419         (Output_segment::set_section_addresses): Remove memory region
3420         walking code.
3421         (Script_sections::create_segment): Add a warning if a header
3422         segment is created outside of any region.
3423         * script-sections.h (class Script_sections): Add prototypes for
3424         find_memory_region and block_in_region methods.
3425         * testsuite/memory_test.s: Use .long instead of .word.
3426         * testsuite/memory_test.t: Add some more output sections.
3427         * testsuite/memory_test.sh: Update expected output.
3428
3429 2010-10-02  Doug Kwan  <dougkwan@google.com>
3430
3431         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3432         defintion to symtab.h
3433         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3434         declaration to defintion.
3435
3436 2010-10-01  Nick Clifton  <nickc@redhat.com>
3437
3438         * expression.cc (eval): Replace dummy argument with NULL.
3439         (eval_maybe_dot): Check for a NULL result section pointer.
3440         (Symbol_expression::value): Likewise.
3441         (Dot_expression::value): Likewise.
3442         (BINARY_EXPRESSION): Likewise.
3443         (Max_expression::value): Likewise.
3444         (Min_expression::value): Likewise.
3445         (Absolute_expression::value): Likewise.
3446         (Addr_expression::value_from_output_section): Likewise.
3447         (Loaddddr_expression::value_from_output_section): Likewise.
3448         (Segment_start_expression::value): Likewise.
3449         * script-sections.cc
3450         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3451         argument with NULL.
3452         (Sections_elememt_dot_assignment::set_section_addresses):
3453         Likewise.
3454         (Output_data_expression::do_write_to_buffer): Likewise.
3455         (Output_section_definition::finalize_symbols): Likewise.
3456         (Output_section_definition::set_section_addresses): Likewise.
3457
3458 2010-09-30  Doug Kwan  <dougkwan@google.com>
3459
3460         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3461
3462 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3463
3464         * target.h (Target::can_icf_inline_merge_sections): New virtual
3465         function.
3466         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3467         virtual function.
3468         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3469         virtual function.
3470         * icf.cc (get_section_contents): Inline merge sections only when
3471         target allows it.
3472
3473 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3474
3475         * configure: Regenerate.
3476
3477 2010-09-17  Ian Lance Taylor  <iant@google.com>
3478
3479         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3480         * testsuite/Makefile.am (memory_test.o): New target.
3481         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3482         memory_test.t.
3483         * testsuite/Makefile.in: Rebuild.
3484
3485 2010-09-17  Doug Kwan  <dougkwan@google.com>
3486
3487         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3488         defintion if relocation uses GOT entries of the symbol.
3489         * testsuite/icf_safe_test.sh: Fix test.
3490         * testsuite/icf_safe_so_test.sh: Fix test.
3491
3492 2010-09-16  Cary Coutant  <ccoutant@google.com>
3493
3494         * script_sections.cc (class Memory_region): Remove "NULL" from
3495         vector initializations.
3496
3497 2010-09-15  Cary Coutant  <ccoutant@google.com>
3498
3499         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3500         Resolve forwarding symbols.
3501
3502 2010-09-15  Doug Kwan  <dougkwan@google.com>
3503
3504         * gold/testsuite/script_test_3.t: Add ARM special sections.
3505         * gold/testsuite/script_test_4.t: Same.
3506         * gold/testsuite/script_test_5.t: Same.
3507         * gold/testsuite/script_test_6.t: Same.
3508         * gold/testsuite/script_test_7.t: Same.
3509         * gold/testsuite/script_test_7.t: Same.
3510         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3511
3512 2010-09-14  Cary Coutant  <ccoutant@google.com>
3513
3514         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3515         (Target_x86_64::Relocate::relocate_tls): Replace check for
3516         saw_tls_block_reloc_ with test for executable section.
3517
3518 2010-09-12  Cary Coutant  <ccoutant@google.com>
3519
3520         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3521         position-independent executables to shared libraries need dynamic
3522         relocations.
3523         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3524         position-independent executables.
3525         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3526         * testsuite/Makefile.in: Regenerate.
3527
3528 2010-09-10  Nick Clifton  <nickc@redhat.com>
3529
3530         PR gold/11997
3531         * testsuite/memory_test.t: Discard any sections that are not
3532         needed.
3533
3534 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3535
3536         PR gold/11996
3537         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3538         "This::" to work around a bug in gcc 4.2.
3539
3540         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3541
3542 2010-09-09  Rafael Espindola  <espindola@google.com>
3543
3544         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3545         sections with different PF_X flags in the same segment.
3546         (Layout::find_first_load_seg): Search all segments to find the first
3547         one.
3548         * options.h (rosegment): New.
3549
3550 2010-09-08  Rafael Espindola  <espindola@google.com>
3551
3552         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3553
3554 2010-09-08  Doug Kwan  <dougkwan@google.com>
3555
3556         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3557         (Arm_relobj::do_relocate_sections): Add new parameter for output
3558         file to match the parent.
3559         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3560         of local symbols instead of input values.  Update code to track
3561         changes in gold::relocate_section.
3562         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3563         (Sized_relobj::compute_final_local_value_internal): New methods.
3564         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3565         body into private version of Sized_relobj::compute_final_local_value.
3566         Call the inline method.
3567         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3568         merged symbol value if there is one.
3569         (Symbol_value::has_output_value): New method defintiion.
3570         (Sized_relobj::Compute_final_local_value_status): New enum type.
3571         (Sized_relobj::compute_final_local_value): New methods.
3572         (Sized_relobj::compute_final_local_value_internal): New methods.
3573         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3574         and arm_cortex_a8.sh.
3575         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3576         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3577         New tests.
3578         * Makefile.in: Regenerate.
3579         * testsuite/arm_bl_out_of_range.s: Update test.
3580         * testsuite/thumb_bl_out_of_range.s: Ditto.
3581         * testsuite/thumb_blx_out_of_range.s: Ditto.
3582         * testsuite/arm_branch_out_of_range.sh: New file.
3583         * testsuite/arm_cortex_a8.sh: Ditto.
3584         * testsuite/arm_cortex_a8_b.s: Ditto.
3585         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3586         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3587         * testsuite/arm_cortex_a8_bl.s: Ditto.
3588         * testsuite/arm_cortex_a8_blx.s: Ditto.
3589         * testsuite/arm_cortex_a8_local.s: Ditto.
3590         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3591         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3592
3593 2010-09-08  Rafael Espindola  <espindola@google.com>
3594
3595         * Makefile.am (memory_test.stdout): Run readelf with -W.
3596         * Makefile.in: Regenerate.
3597         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3598         64 bit output.
3599
3600 2010-09-08  Rafael Espindola  <espindola@google.com>
3601
3602         * script-sections.cc (Script_sections::add_memory_region): Convert
3603         field precision to int.
3604         * script.cc (script_set_section_region, script_set_section_region):
3605         Convert field precision to int.
3606
3607 2010-09-08  Rafael Espindola  <espindola@google.com>
3608
3609         * arm.cc (do_finalize_sections): Create the __exidx_start and
3610         __exdix_end symbols even when the section is missing.
3611
3612 2010-09-08  Nick Clifton  <nickc@redhat.com>
3613
3614         * README: Remove claim that MEMORY is not supported.
3615         * expression.cc (script_exp_function_origin)
3616         (script_exp_function_length): Move from here to ...
3617         * script.cc: ... here.
3618         (script_set_section_region, script_add_memory)
3619         (script_parse_memory_attr, script_include_directive): New
3620         functions.
3621         * script-sections.cc
3622         (class Memory_region): New class.
3623         (class Output_section_definition): Add set_memory_region,
3624         set_section_vma, set_section_lma and get_section_name methods.
3625         (class Script_Sections): Add add_memory_region,
3626         find_memory_region, find_memory_region_origin,
3627         find_memory_region_length and set_memory_region methods.
3628         Have set_section_addresses method walk the list of set memory
3629         regions.
3630         Extend the print methos to display memory regions.
3631         * script-sections.h: Add prototypes for new methods.
3632         Add enum for MEMORY region attributes.
3633         * yyscript.y: Add support for parsing MEMORY regions.
3634         * script-c.h: Add prototypes for new functions.
3635         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3636         * testsuite/Makefile.in: Regenerate.
3637         * testsuite/memory_test.sh: New script.
3638         * testsuite/memory_test.s: New assembler source file.
3639         * testsuite/memory_test.t: New linker script.
3640
3641 2010-08-27  Doug Kwan  <dougkwan@google.com>
3642
3643         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3644         reference override an existing dynamic weak reference.
3645         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3646         * testsuite/Makefile.in: Regenerate.
3647         * testsuite/dyn_weak_ref.sh: New file.
3648         * testsuite/dyn_weak_ref_1.c: Ditto.
3649         * testsuite/dyn_weak_ref_2.c: Ditto.
3650
3651 2010-08-27  Ian Lance Taylor  <iant@google.com>
3652
3653         * incremental.h (class Incremental_input_entry): Add virtual
3654         destructor.
3655
3656 2010-08-27  Ian Lance Taylor  <iant@google.com>
3657
3658         * testsuite/start_lib_test_3.c: Mark t3 as used.
3659
3660 2010-08-27  Nick Clifton  <nickc@redhat.com>
3661
3662         * options.cc (version_script): Fix small typo in previous
3663         whitespace tidyup.
3664
3665 2010-08-25  Nick Clifton  <nickc@redhat.com>
3666
3667         * archive.cc: Formatting fixes: Remove whitespace between
3668         typename and following asterisk.  Remove whitespace between
3669         function name and opening parenthesis.
3670         * archive.h: Likewise.
3671         * arm.cc: Likewise.
3672         * attributes.cc: Likewise.
3673         * attributes.h: Likewise.
3674         * common.cc: Likewise.
3675         * copy-relocs.cc: Likewise.
3676         * dirsearch.h: Likewise.
3677         * dynobj.cc: Likewise.
3678         * ehframe.cc: Likewise.
3679         * ehframe.h: Likewise.
3680         * expression.cc: Likewise.
3681         * fileread.cc: Likewise.
3682         * fileread.h: Likewise.
3683         * gc.h: Likewise.
3684         * gold-threads.cc: Likewise.
3685         * gold.cc: Likewise.
3686         * i386.cc: Likewise.
3687         * icf.h: Likewise.
3688         * incremental-dump.cc: Likewise.
3689         * incremental.cc: Likewise.
3690         * layout.cc: Likewise.
3691         * layout.h: Likewise.
3692         * main.cc: Likewise.
3693         * merge.cc: Likewise.
3694         * merge.h: Likewise.
3695         * object.cc: Likewise.
3696         * object.h: Likewise.
3697         * options.cc: Likewise.
3698         * options.h: Likewise.
3699         * output.cc: Likewise.
3700         * output.h: Likewise.
3701         * plugin.cc: Likewise.
3702         * plugin.h: Likewise.
3703         * powerpc.cc: Likewise.
3704         * reloc.cc: Likewise.
3705         * script-c.h: Likewise.
3706         * script-sections.cc: Likewise.
3707         * script.cc: Likewise.
3708         * stringpool.cc: Likewise.
3709         * symtab.cc: Likewise.
3710         * symtab.h: Likewise.
3711         * target.cc: Likewise.
3712         * timer.cc: Likewise.
3713         * timer.h: Likewise.
3714         * version.cc: Likewise.
3715         * x86_64.cc: Likewise.
3716
3717 2010-08-24  Nick Clifton  <nickc@redhat.com>
3718
3719         PR 11899
3720         * layout.cc (segment_precedes): Sort segments by their physical
3721         addresses, if they have been set.
3722
3723 2010-08-23  Cary Coutant  <ccoutant@google.com>
3724
3725         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3726         symbols data.
3727         (Lib_group::include_member): Unlock object after deleting its
3728         symbols data.
3729         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3730         the bug fixed here.
3731
3732 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3733             Cary Coutant  <ccoutant@google.com>
3734
3735         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3736         constructor, and set_blocker.
3737         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3738         readsyms_blocker_.
3739         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3740         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3741         * testsuite/Makefile.am (start_lib_test): New test case.
3742         * testsuite/Makefile.in: Regenerate.
3743         * testsuite/start_lib_test_main.c: New file.
3744         * testsuite/start_lib_test_1.c: New file.
3745         * testsuite/start_lib_test_2.c: New file.
3746         * testsuite/start_lib_test_3.c: New file.
3747
3748 2010-08-19  Ian Lance Taylor  <iant@google.com>
3749
3750         * Makefile.in: Rebuild with automake 1.11.1.
3751         * aclocal.m4: Likewise.
3752         * testsuite/Makefile.in: Likewise.
3753
3754 2010-08-19  Ian Lance Taylor  <iant@google.com>
3755
3756         PR 10893
3757         * i386.cc (class Output_data_plt_i386): Update declarations.
3758         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3759         local_ifuncs_ fields.
3760         (Target_i386::do_plt_section_for_global): New function.
3761         (Target_i386::do_plt_section_for_local): New function.
3762         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3763         parameter; change all callers.  Initialize global_ifuncs_ and
3764         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3765         __rel_iplt_end.
3766         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3767         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3768         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3769         symbols.
3770         (Target_i386::make_plt_section): New function, broken out of
3771         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3772         (Target_i386::make_plt_entry): Call make_plt_section.
3773         (Target_i386::make_local_ifunc_plt_entry): New function.
3774         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3775         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3776         R_386_IRELATIVE to switch.
3777         (Target_i386::Scan::global): Likewise.
3778         (Target_i386::Relocate::relocate): Likewise.
3779         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3780         switch.
3781         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3782         (Target_x86_64::do_plt_section_for_global): New function.
3783         (Target_x86_64::do_plt_section_for_local): New function.
3784         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3785         parameter; change all callers.  If doing a static link define
3786         __rela_iplt_start and __rela_iplt_end.
3787         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3788         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3789         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3790         to point to .plt.
3791         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3792         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3793         switch.
3794         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3795         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3796         R_X86_64_IRELATIVE to switch.
3797         (Target_x86_64::Scan::global): Likewise.
3798         (Target_x86_64::Relocate::relocate): Likewise.
3799         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3800         switch.
3801         * target.h (class Target): Add plt_section_for_global and
3802         plt_section_for_local functions.  Add do_plt_section_for_global
3803         and do_plt_section_for_local virtual functions.
3804         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3805         clarifying comments.
3806         (Symbol::use_plt_offset): Handle IFUNC symbol.
3807         * object.cc (Sized_relobj::Sized_relobj): Initialize
3808         local_plt_offsets_.
3809         (Sized_relobj::local_has_plt_offset): New function.
3810         (Sized_relobj::local_plt_offset): New function.
3811         (Sized_relobj::set_local_plt_offset): New function.
3812         (Sized_relobj::do_count): Handle IFUNC symbol.
3813         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3814         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3815         is_ifunc_symbol functions.
3816         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3817         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3818         local_plt_offsets_ field.
3819         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3820         * output.h (class Output_section_data): Add non-const
3821         output_section function.
3822         (class Output_data_got): Update declarations.
3823         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3824         Add use_plt_offset parameter to global and local constructors.
3825         Change all callers.  Change local_sym_index_ field to 31 bits.
3826         Change GSYM_CODE and CONSTANT_CODE accordingly.
3827         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3828         doing a static link don't set sh_link field.
3829         (Output_data_got::Got_entry::write): Use PLT offset if
3830         appropriate.
3831         (Output_data_got::add_global_plt): New function.
3832         (Output_data_got::add_local_plt): New function.
3833         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3834         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3835         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3836         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3837         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3838         IFUNC conditional.
3839         * testsuite/ifunc-sel.h: New file.
3840         * testsuite/ifuncmain1.c: New file.
3841         * testsuite/ifuncmain1vis.c: New file.
3842         * testsuite/ifuncmod1.c: New file.
3843         * testsuite/ifuncdep2.c: New file.
3844         * testsuite/ifuncmain2.c: New file.
3845         * testsuite/ifuncmain3.c: New file.
3846         * testsuite/ifuncmod3.c: New file.
3847         * testsuite/ifuncmain4.c: New file.
3848         * testsuite/ifuncmain5.c: New file.
3849         * testsuite/ifuncmod5.c: New file.
3850         * testsuite/ifuncmain6pie.c: New file.
3851         * testsuite/ifuncmod6.c: New file.
3852         * testsuite/ifuncmain7.c: New file.
3853         * configure, testsuite/Makefile.in: Rebuild.
3854
3855 2010-08-18  Ian Lance Taylor  <iant@google.com>
3856
3857         * incremental.cc
3858         (Output_section_incremental_inputs::write_input_files): Add cast
3859         to avoid signed/unsigned comparison warning.
3860         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3861
3862 2010-08-12  Cary Coutant  <ccoutant@google.com>
3863
3864         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3865
3866 2010-08-13  Ian Lance Taylor  <iant@google.com>
3867
3868         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3869
3870 2010-08-12  Cary Coutant  <ccoutant@google.com>
3871             Doug Kwan  <dougkwan@google.com>
3872
3873         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3874         defintion overrides non-weak undef, remember that the original undef
3875         is not weak.
3876         * symtab.cc (Symbol_table::sized_write_global): For undef without
3877         an original weak binding, set binding to global in output.
3878         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3879         * testsuite/Makefile.in: Regenerate.
3880         * testsuite/strong_ref_weak_def.sh: New file.
3881         * testsuite/strong_ref_weak_def_1.c: Ditto.
3882         * testsuite/strong_ref_weak_def_2.c: Ditto.
3883
3884 2010-08-12  Cary Coutant  <ccoutant@google.com>
3885
3886         * testsuite/incremental_test.sh: Rewrite.
3887         * testsuite/incremental_test_1.c: Rewrite.
3888         * testsuite/incremental_test_2.c: Rewrite.
3889
3890 2010-08-12  Cary Coutant  <ccoutant@google.com>
3891
3892         * arm.cc (Target_arm::got_size): Add const.
3893         (Target_arm::got_entry_count): New function.
3894         (Target_arm::plt_entry_count): New function.
3895         (Target_arm::first_plt_entry_offset): New function.
3896         (Target_arm::plt_entry_size): New function.
3897         (Output_data_plt_arm::entry_count): New function.
3898         (Output_data_plt_arm::first_plt_entry_offset): New function.
3899         (Output_data_plt_arm::get_plt_entry_size): New function.
3900         * i386.cc (Target_i386::got_size): Add const.
3901         (Target_i386::got_entry_count): New function.
3902         (Target_i386::plt_entry_count): New function.
3903         (Target_i386::first_plt_entry_offset): New function.
3904         (Target_i386::plt_entry_size): New function.
3905         (Output_data_plt_i386::entry_count): New function.
3906         (Output_data_plt_i386::first_plt_entry_offset): New function.
3907         (Output_data_plt_i386::get_plt_entry_size): New function.
3908         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3909         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3910         * incremental.cc: Include target.h.
3911         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3912         parameter.  Adjust all callers.  Find incremental_got_plt section.
3913         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3914         section.
3915         (Output_section_incremental_inputs::set_final_data_size): Calculate
3916         size of incremental_got_plt section.
3917         (Output_section_incremental_inputs::do_write): Write the
3918         incremental_got_plt section.
3919         (Got_plt_view_info): New struct.
3920         (Local_got_offset_visitor): New class.
3921         (Global_got_offset_visitor): New class.
3922         (Global_symbol_visitor_got_plt): New class.
3923         (Output_section_incremental_inputs::write_got_plt): New function.
3924         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3925         Add parameter.  Adjust all callers.
3926         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3927         (Incremental_inputs::got_plt_section): New function.
3928         (Incremental_inputs::got_plt_section_): New data member.
3929         (Incremental_got_plt_reader): New class.
3930         * layout.cc (Layout::create_incremental_info_sections): Add the
3931         incremental_got_plt section.
3932         * object.h (Got_offset_list::get_list): New function.
3933         (Got offset_list::for_all_got_offsets): New function.
3934         (Sized_relobj::local_got_offset_list): New function.
3935         * powerpc.cc (Target_powerpc::got_size): Add const.
3936         (Target_powerpc::got_entry_count): New function.
3937         (Target_powerpc::plt_entry_count): New function.
3938         (Target_powerpc::first_plt_entry_offset): New function.
3939         (Target_powerpc::plt_entry_size): New function.
3940         (Output_data_plt_powerpc::entry_count): New function.
3941         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3942         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3943         * sparc.cc (Target_sparc::got_size): Add const.
3944         (Target_sparc::got_entry_count): New function.
3945         (Target_sparc::plt_entry_count): New function.
3946         (Target_sparc::first_plt_entry_offset): New function.
3947         (Target_sparc::plt_entry_size): New function.
3948         (Output_data_plt_sparc::entry_count): New function.
3949         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3950         (Output_data_plt_sparc::get_plt_entry_size): New function.
3951         * symtab.h (Symbol::got_offset_list): New function.
3952         (Symbol_table::for_all_symbols): New function.
3953         * target.h (Sized_target::got_entry_count): New function.
3954         (Sized_target::plt_entry_count): New function.
3955         (Sized_target::plt_entry_size): New function.
3956         * x86_64.cc (Target_x86_64::got_size): Add const.
3957         (Target_x86_64::got_entry_count): New function.
3958         (Target_x86_64::plt_entry_count): New function.
3959         (Target_x86_64::first_plt_entry_offset): New function.
3960         (Target_x86_64::plt_entry_size): New function.
3961         (Output_data_plt_x86_64::entry_count): New function.
3962         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3963         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3964
3965 2010-08-12  Cary Coutant  <ccoutant@google.com>
3966
3967         * archive.cc: Include incremental.h.
3968         (Archive::Archive): Initialize incremental_info_.
3969         (Archive::include_member): Record archive members in incremental info.
3970         (Add_archive_symbols::run): Record begin and end of an archive in
3971         incremental info.
3972         (Lib_group::include_member): Record objects in incremental info.
3973         * archive.h (Incremental_archive_entry): Forward declaration.
3974         (Archive::set_incremental_info): New member function.
3975         (Archive::incremental_info): New member function.
3976         (Archive::Unused_symbol_iterator): New class.
3977         (Archive::unused_symbols_begin): New member function.
3978         (Archive::unused_symbols_end): New member function.
3979         (Archive::incremental_info_): New data member.
3980         * incremental-dump.cc (find_input_containing_global): New function.
3981         (dump_incremental_inputs): Dump new incremental info sections.
3982         * incremental.cc: Include symtab.h.
3983         (Output_section_incremental_inputs): New class.
3984         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3985         new incremental info sections.
3986         (Sized_incremental_binary::do_check_inputs): Likewise.
3987         (Incremental_inputs::report_archive): Remove.
3988         (Incremental_inputs::report_archive_begin): New function.
3989         (Incremental_inputs::report_archive_end): New function.
3990         (Incremental_inputs::report_object): New function.
3991         (Incremental_inputs::finalize_inputs): Remove.
3992         (Incremental_inputs::report_input_section): New function.
3993         (Incremental_inputs::report_script): Rewrite.
3994         (Incremental_inputs::finalize): Do nothing but finalize string table.
3995         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3996         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3997         (Incremental_inputs::create_data_sections): New function.
3998         (Incremental_inputs::relocs_entsize): New function.
3999         (Output_section_incremental_inputs::set_final_data_size): New function.
4000         (Output_section_incremental_inputs::do_write): New function.
4001         (Output_section_incremental_inputs::write_header): New function.
4002         (Output_section_incremental_inputs::write_input_files): New function.
4003         (Output_section_incremental_inputs::write_info_blocks): New function.
4004         (Output_section_incremental_inputs::write_symtab): New function.
4005         * incremental.h (Incremental_script_entry): Forward declaration.
4006         (Incremental_object_entry): Forward declaration.
4007         (Incremental_archive_entry): Forward declaration.
4008         (Incremental_inputs): Forward declaration.
4009         (Incremental_inputs_header_data): Remove.
4010         (Incremental_inputs_header): Remove.
4011         (Incremental_inputs_header_write): Remove.
4012         (Incremental_inputs_entry_data): Remove.
4013         (Incremental_inputs_entry): Remove.
4014         (Incremental_inputs_entry_write): Remove.
4015         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4016         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4017         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4018         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4019         Likewise.
4020         (Incremental_input_entry): New class.
4021         (Incremental_script_entry): New class.
4022         (Incremental_object_entry): New class.
4023         (Incremental_archive_entry): New class.
4024         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4025         (Incremental_inputs::report_inputs): Remove.
4026         (Incremental_inputs::report_archive): Remove.
4027         (Incremental_inputs::report_archive_begin): New function.
4028         (Incremental_inputs::report_archive_end): New function.
4029         (Incremental_inputs::report_object): Change prototype.
4030         (Incremental_inputs::report_input_section): New function.
4031         (Incremental_inputs::report_script): Change prototype.
4032         (Incremental_inputs::get_reloc_count): New function.
4033         (Incremental_inputs::set_reloc_count): New function.
4034         (Incremental_inputs::create_data_sections): New function.
4035         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4036         (Incremental_inputs::inputs_section): New function.
4037         (Incremental_inputs::symtab_section): New function.
4038         (Incremental_inputs::relocs_section): New function.
4039         (Incremental_inputs::get_stringpool): Add const.
4040         (Incremental_inputs::command_line): Add const.
4041         (Incremental_inputs::inputs): Remove.
4042         (Incremental_inputs::command_line_key): New function.
4043         (Incremental_inputs::input_file_count): New function.
4044         (Incremental_inputs::input_files): New function.
4045         (Incremental_inputs::relocs_entsize): New function.
4046         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4047         (Incremental_inputs::finalize_inputs): Remove.
4048         (Incremental_inputs::Input_info): Remove.
4049         (Incremental_inputs::lock_): Remove.
4050         (Incremental_inputs::inputs_): Change type.
4051         (Incremental_inputs::inputs_map_): Remove.
4052         (Incremental_inputs::current_object_entry_): New data member.
4053         (Incremental_inputs::inputs_section_): New data member.
4054         (Incremental_inputs::symtab_section_): New data member.
4055         (Incremental_inputs::relocs_section_): New data member.
4056         (Incremental_inputs::reloc_count_): New data member.
4057         (Incremental_inputs_reader): New class.
4058         (Incremental_symtab_reader): New class.
4059         (Incremental_relocs_reader): New class.
4060         * layout.cc (Layout::finalize): Move finalization of incremental info
4061         and creation of incremental info sections to follow finalization of
4062         symbol table.  Set offsets for postprocessing sections.
4063         (Layout::create_incremental_info_sections): Call
4064         Incremental_inputs::create_data_sections.  Add incremental symtab
4065         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4066         sections to layout after input sections.
4067         * layout.h (struct Timespec): Forward declaration.
4068         (Layout::incremental_inputs): Add const.
4069         (Layout::create_incremental_info_sections): Add parameter.
4070         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4071         * object.cc: Include incremental.h.
4072         (Relobj::finalize_incremental_relocs): New function.
4073         (Sized_relobj::do_layout): Record input sections in incremental info.
4074         * object.h (Object::output_section): New function.
4075         (Object::output_section_offset): Moved from Relobj.
4076         (Object::get_incremental_reloc_base): New function.
4077         (Object::get_incremental_reloc_count): New function.
4078         (Object::do_output_section): New function.
4079         (Object::do_output_section_offset): Moved from Relobj.
4080         (Object::do_get_incremental_reloc_base): New function.
4081         (Object::do_get_incremental_reloc_count): New function.
4082         (Object::Object): Initialize new data members.
4083         (Relobj::output_section): Renamed do_output_section and moved to
4084         protected.
4085         (Relobj::output_section_offset): Moved to Object.
4086         (Relobj::do_get_incremental_reloc_base): New function.
4087         (Relobj::do_get_incremental_reloc_count): New function.
4088         (Relobj::allocate_incremental_reloc_counts): New function.
4089         (Relobj::count_incremental_reloc): New function.
4090         (Relobj::finalize_incremental_relocs): New function.
4091         (Relobj::next_incremental_reloc_index): New function.
4092         (Relobj::reloc_counts_): New data member.
4093         (Relobj::reloc_bases_): New data member.
4094         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4095         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4096         (Sized_relobj::incremental_relocs_scan): New function.
4097         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4098         (Sized_relobj::incremental_relocs_write): New function.
4099         (Sized_relobj::incremental_relocs_write_reltype): New function.
4100         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4101         incremental link.
4102         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4103         archives and object files elsewhere.
4104         (Add_symbols::run): Report object files here.
4105         (Finish_group::run): Report end of archive at end of group.
4106         * reloc.cc: Include layout.h, incremental.h.
4107         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4108         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4109         (Sized_relobj::incremental_relocs_scan): New function.
4110         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4111         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4112         (Sized_relobj::incremental_relocs_write): New function.
4113         (Sized_relobj::incremental_relocs_write_reltype): New function.
4114         * script.cc (read_input_script): Rewrite test for incremental link.
4115         Change call to Incremental_inputs::report_script.
4116         * symtab.h (Symbol_table::first_global_index): New function.
4117         (Symbol_table::output_count): New function.
4118
4119 2010-08-12  Doug Kwan  <dougkwan@google.com>
4120
4121         * arm.cc (Target_arm::merge_object_attributes): Check command line
4122         options --no-wchar-size-warning and --no-enum-size-warning.
4123         * options.h (General_options): Add ld-compatible options
4124         --no-enum-size-warning and --no-wchar-size-warning.
4125
4126 2010-08-04  Ian Lance Taylor  <iant@google.com>
4127
4128         * x86_64.cc (Target_x86_64::Scan::local): Use
4129         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4130         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4131         (Target_x86_64::Scan::global): Likewise.
4132         (Target_x86_64::Relocate::relocate): Likewise.
4133         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4134         Likewise.
4135
4136 2010-08-03  Cary Coutant  <ccoutant@google.com>
4137
4138         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4139         to reserve space in merged_strings vector. Keep total input size
4140         for stats.
4141         (Output_merge_string::do_print_merge_stats): Print total input size.
4142         * merge.h (Output_merge_string): Add input_size_ field.
4143         * stringpool.cc (Stringpool_template::string_length): Move
4144         implementations out of Stringpool_template class and place in
4145         stringpool.h.
4146         * stringpool.h (string_length): Move out of Stringpool_template.
4147
4148 2010-08-03  Ian Lance Taylor  <iant@google.com>
4149
4150         PR 11712
4151         * layout.cc (relaxation_loop_body): If address of load segment is
4152         set, adjust address to include headers if possible.
4153
4154 2010-08-03  Ian Lance Taylor  <iant@google.com>
4155
4156         * version.cc (version_string): Bump to 1.10.
4157
4158 2010-08-03  Ian Lance Taylor  <iant@google.com>
4159
4160         PR 11805
4161         * layout.h (enum Output_section_order): Define.
4162         (class Layout): Update declarations.
4163         * layout.cc (Layout::get_output_section): Add order parameter.
4164         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4165         is_first_non_relro parameters.  Change all callers.
4166         (Layout::choose_output_section): Likewise.
4167         (Layout::add_output_section_data): Likewise.
4168         (Layout::make_output_section): Likewise.  Set order.
4169         (Layout::default_section_order): New function.
4170         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4171         * output.cc (Output_section::Output_section): Initialize order_.
4172         Don't initialize deleted fields.
4173         (Output_segment::Output_segment): Don't initialize deleted
4174         fields.
4175         (Output_segment::add_output_section_to_load): New function
4176         replacing add_output_section.  Change all callers to call this or
4177         add_output_section_to_nonload.
4178         (Output_segment::add_output_section_to_nonload): New function.
4179         (Output_segment::remove_output_section): Rewrite.
4180         (Output_segment::add_initial_output_data): Likewise.
4181         (Output_segment::has_any_data_sections): Likewise.
4182         (Output_segment::is_first_section_relro): Likewise.
4183         (Output_segment::maximum_alignment): Likewise.
4184         (Output_segment::has_dynamic_reloc): New function replacing
4185         dynamic_reloc_count.  Change all callers.
4186         (Output_segment::has_dynamic_reloc_list): New function replacing
4187         dynamic_reloc_count_list.  Change all callers.
4188         (Output_segment::set_section_addresses): Rewrite.
4189         (Output_segment::set_offset): Rewrite.
4190         (Output_segment::find_first_and_last_list): Remove.
4191         (Output_segment::set_tls_offsets): Rewrite.
4192         (Output_segment::first_section_load_address): Likewise.
4193         (Output_segment::output_section_count): Likewise.
4194         (Output_segment::section_with_lowest_load_address): Likewise.
4195         (Output_segment::write_section_headers): Likewise.
4196         (Output_segment::print_sections_to_map): Likewise.
4197         * output.h (class Output_data): Remove dynamic_reloc_count_
4198         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4199         (Output_data::add_dynamic_reloc): Rewrite.
4200         (Output_data::has_dynamic_reloc): New function.
4201         (Output_data::dynamic_reloc_count): Remove.
4202         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4203         is_last_relro_, is_first_non_relro_, is_interp_,
4204         is_dynamic_linker_section_ fields.  Add order and set_order
4205         functions.  Remove is_relro_local, set_is_relro_local,
4206         is_last_relro, set_is_last_relro, is_first_non_relro,
4207         set_is_first_non_relro functions, is_interp, set_is_interp,
4208         is_dynamic_linker_section, and set_is_dynamic_linker_section
4209         functions.
4210         (class Output_segment): Change Output_data_list from std::list to
4211         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4212         output_bss_ fields.  Update declarations.
4213
4214 2010-08-02  Ian Lance Taylor  <iant@google.com>
4215
4216         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4217         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4218         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4219
4220 2010-08-02  Ian Lance Taylor  <iant@google.com>
4221
4222         PR 11855
4223         * script.cc (Script_options::Script_options): Initialize
4224         symbol_definitions_ and symbol_references_.
4225         (Script_options::add_symbol_assignment): Update
4226         symbol_definitions_ and symbol_references_.
4227         (Script_options::add_symbol_reference): New function.
4228         (script_symbol): New function.
4229         * script.h (class Script_options): Add symbol_definitions_ and
4230         symbol_references_ fields.
4231         (Script_options::referenced_const_iterator): New type.
4232         (Script_options::referenced_begin): New function.
4233         (Script_options::referenced_end): New function.
4234         (Script_options::is_referenced): New function.
4235         (Script_options::any_unreferenced): New function.
4236         * script-c.h (script_symbol): Declare.
4237         * yyscript.y (exp): Call script_symbol.
4238         * symtab.cc: Include "script.h".
4239         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4240         Change all callers.  Check symbols referenced by scripts.
4241         (Symbol_table::add_undefined_symbols_from_command_line): Add
4242         layout parameter.  Change all callers.
4243         (Symbol_table::do_add_undefined_symbols_from_command_line):
4244         Likewise.  Break out loop body.  Check symbols referenced by
4245         scripts.
4246         (Symbol_table::add_undefined_symbol_from_command_line): New
4247         function broken out of
4248         do_add_undefined_symbols_from_command_line.
4249         * symtab.h (class Symbol_table): Update declarations.
4250         * archive.cc: Include "layout.h".
4251         (Archive::should_include_member): Add layout parameter.  Change
4252         all callers.  Check for symbol mentioned in expression.
4253         * archive.h (class Archive): Update declaration.
4254         * object.cc (Sized_relobj::do_should_include_member): Add layout
4255         parameter.
4256         * object.h (Object::should_include_member): Add layout parameter.
4257         Change all callers.
4258         (Object::do_should_include_member): Add layout parameter.
4259         (class Sized_relobj): Update declaration.
4260         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4261         parameter.
4262         * dynobj.h (class Sized_dynobj): Update declaration.
4263         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4264         layout parameter.
4265         * plugin.h (class Sized_pluginobj): Update declaration.
4266
4267 2010-08-02  Ian Lance Taylor  <iant@google.com>
4268
4269         PR 11866
4270         * output.cc (Output_segment::set_offset): Search for the first and
4271         last sections rather than assuming that the list is in order.
4272         (Output_segment::find_first_and_last_list): New function.
4273         * output.h (class Output_segment): Update declarations.
4274         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4275         (relro_strip_test_SOURCES): New variable.
4276         (relro_strip_test_DEPENDENCIES): New variable.
4277         (relro_strip_test_LDFLAGS): New variable.
4278         (relro_strip_test_LDADD): New variable.
4279         (relro_strip_test.so): New target.
4280
4281 2010-08-02  Ian Lance Taylor  <iant@google.com>
4282
4283         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4284         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4285         (Target_i386::got_tlsdesc_section): New function.
4286         (Target_i386::got_section): Create space for GOT entries for
4287         TLSDESC relocations.
4288         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4289         R_386_TLS_GOTDESC.
4290         (Target_i386::Scan::global): Likewise.
4291         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4292         using TLSDESC GOT.
4293         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4294         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4295         (Target_x86_64::got_tlsdesc_section): New function.
4296         (Target_x86_64::got_section): Create space for GOT entries for
4297         TLSDESC relocations.
4298         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4299         R_386_TLS_GOTDESC.
4300         (Target_x86_64::Scan::global): Likewise.
4301         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4302         using TLSDESC GOT.
4303
4304 2010-08-02  Ian Lance Taylor  <iant@google.com>
4305
4306         * testsuite/final_layout.sh: Use dc to convert from hex to
4307         decimal.
4308
4309 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4310
4311         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4312         paramter to the call to gold::gc_process_relocs.
4313         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4314         paramter to the call to gold::gc_process_relocs.
4315         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4316         parameter to the call to gold::gc_process_relocs.
4317         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4318         template parameter to the call to gold::gc_process_relocs.
4319         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4320         paramter to the call to gold::gc_process_relocs.
4321         * gc.h (get_embedded_addend_size): New function.
4322         (gc_process_relocs): Save the size of the reloc for use by ICF.
4323         * icf.cc (get_section_contents): Get the addend from the text section
4324         for SHT_REL relocation sections.
4325         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4326         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4327         * int_encoding.h (read_from_pointer): New overloaded function.
4328         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4329         * testsuite/icf_sht_rel_addend_test.sh: New file.
4330         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4331         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4332
4333 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4334
4335         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4336         * Makefile.in: Regenerate.
4337         * testsuite/Makefile.in: Regenerate.
4338
4339 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4340
4341         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4342         * gold/testsuite/debug_msg.cc: Likewise.
4343         * gold/testsuite/odr_violation1.cc
4344         * gold/testsuite/odr_violation2.cc
4345
4346 2010-07-21  Cary Coutant  <ccoutant@google.com>
4347
4348         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4349         string, and length fields.
4350         (Output_merge_string::Merged_strings_list): New type.
4351         (Output_merge_string::Merged_strings_lists): New typedef.
4352         (Output_merge_string): Replace merged_strings_ with
4353         merged_strings_lists_.
4354         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4355         Merged_strings_list per input object and section.  Don't store pointer
4356         to the string.  Don't store length with each merged string entry.
4357         (Output_merge_string::finalize_merged_data): Loop over list of merged
4358         strings lists.  Recompute length of each merged string.
4359
4360 2010-07-15  Cary Coutant  <ccoutant@google.com>
4361
4362         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4363         here.
4364
4365 2010-07-14  Ian Lance Taylor  <iant@google.com>
4366
4367         * descriptors.cc (Descriptors::open): Report correct name in error
4368         message.
4369
4370 2010-07-13  Doug Kwan  <dougkwan@google.com>
4371
4372         * arm.cc (Arm_input_section::Arm_input_section): For a
4373         SHT_ARM_EXIDX section, always keeps the input sections.
4374         (Arm_input_section::set_exidx_section_link): New method.
4375         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4376         has_errors_ to false.
4377         (Arm_exidx_input_section::has_errors,
4378         Arm_exidx_input_section::set_has_errors): New methods.
4379         (Arm_exidx_input_section::has_errors_): New data member.
4380         (Arm_relobj::get_exidx_shndx_list): New method.
4381         (Arm_output_section::append_text_sections_to_list): Do not skip
4382         section without SHF_EXECINSTR.
4383         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4384         errors.
4385         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4386         section header.  Make error messages more verbose.  Check for
4387         a non-executable section linked to an EXIDX section.
4388         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4389         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4390         check that there is no deferred EXIDX section if we exit early.
4391         Instead of not making an EXIDX section in case of an error, make one
4392         and set the has_errors flag of it.
4393         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4394         in a relocatable link.
4395         (Target_arm::do_relax): Look for the EXIDX output section instead of
4396         assuming that it is called .ARM.exidx.
4397         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4398         section list.  Do not check for SHF_EXECINSTR section flags but
4399         skip any input section with errors.
4400         * output.cc (Output_section::Output_section): Initialize
4401         always_keeps_input_sections_ to false.
4402         (Output_section::add_input_section): Check for
4403         always_keeps_input_sections_.
4404         *  output.h (Output_section::always_keeps_input_sections,
4405         Output_section::set_always_keeps_input_sections): New methods.
4406         (Output_section::always_keeps_input_sections): New data member.
4407
4408 2010-07-13  Rafael Espindola  <espindola@google.com>
4409
4410         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4411         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4412
4413 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4414             Ian Lance Taylor  <iant@google.com>
4415
4416         * output.h (Output_section_lookup_maps::add_merge_section):
4417         Correct check of whether value was inserted.
4418         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4419         (Output_section_lookup_maps::add_relaxed_input_section):
4420         Likewise.
4421         * arm.cc (Target_arm::got_section): Remove used local os.
4422         * i386.cc (Target_i386::got_section): Likewise.
4423         * x86_64.cc (Target_x86_64::got_section): Likewise.
4424         * sparc.cc (Target_sparc::got_section): Likewise.
4425         (Target_sparc::relocate): Remove unused local have_got_offset.
4426         * powerpc.cc (Target_powerpc::relocate): Likewise.
4427
4428 2010-07-13  Ian Lance Taylor  <iant@google.com>
4429
4430         * compressed_output.cc (zlib_decompress): Fix signature in
4431         !HAVE_ZLIB_H case.
4432
4433         * archive.cc (Archive::include_member): Unlock an external member
4434         of a thin archive.  Don't bother to delete an object we know is
4435         NULL.
4436
4437 2010-07-12  Cary Coutant  <ccoutant@google.com>
4438
4439         * compressed_output.cc (zlib_decompress): New function.
4440         (get_uncompressed_size): New function.
4441         (decompress_input_section): New function.
4442         * compressed_output.h (get_uncompressed_size): New function.
4443         (decompress_input_section): New function.
4444         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4445         Handle compressed debug sections.
4446         * layout.cc (is_compressed_debug_section): New function.
4447         (Layout::output_section_name): Map compressed section names to
4448         canonical names.
4449         * layout.h (is_compressed_debug_section): New function.
4450         (is_debug_info_section): Recognize compressed debug sections.
4451         * merge.cc: Include compressed_output.h.
4452         (Output_merge_data::do_add_input_section): Handle compressed
4453         debug sections.
4454         (Output_merge_string::do_add_input_section): Handle compressed
4455         debug sections.
4456         * object.cc: Include compressed_output.h.
4457         (Sized_relobj::Sized_relobj): Initialize new data members.
4458         (build_compressed_section_map): New function.
4459         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4460         * object.h (Object::section_is_compressed): New method.
4461         (Object::do_section_is_compressed): New method.
4462         (Sized_relobj::Compressed_section_map): New type.
4463         (Sized_relobj::do_section_is_compressed): New method.
4464         (Sized_relobj::compressed_sections_): New data member.
4465         * output.cc (Output_section::add_input_section): Handle compressed
4466         debug sections.
4467         * reloc.cc: Include compressed_output.h.
4468         (Sized_relobj::write_sections): Handle compressed debug sections.
4469
4470 2010-07-08  Cary Coutant  <ccoutant@google.com>
4471
4472         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4473         weak when resolving to a dynamic def.
4474         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4475         for weak undef/dynamic def cases. Adjust callers.
4476         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4477         undef_binding_weak_.
4478         (Symbol_table::sized_write_globals): Adjust symbol binding.
4479         (Symbol_table::sized_write_symbol): Add binding parameter.
4480         * symtab.h (Symbol::set_undef_binding): New method.
4481         (Symbol::is_undef_binding_weak): New method.
4482         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4483         (Symbol_table::should_override): Add new parameter.
4484         (Symbol_table::sized_write_symbol): Add new parameter.
4485
4486         * testsuite/weak_undef_file1.cc: Add new test case.
4487         * testsuite/weak_undef_file2.cc: Fix header comment.
4488         * testsuite/weak_undef_test.cc: Add new test case.
4489
4490 2010-06-29  Doug Kwan  <dougkwan@google.com>
4491
4492         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4493         Initialize USE_SYMBOL_.
4494         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4495         definition.
4496         (Arm_reloc_property::uses_symbol_): New data member declaration.
4497         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4498         uses symbol value and symbol is undefined but not weakly undefined.
4499
4500 2010-06-28  Rafael Espindola  <espindola@google.com>
4501
4502         * plugin.cc (Plugin::load): Use dlerror.
4503
4504 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4505
4506         * symtab.cc (detect_odr_violations): When reporting an ODR
4507         violation, report an object where the symbol is defined.
4508
4509 2010-06-25  Doug Kwan  <dougkwan@google.com>
4510
4511         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4512         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4513         definition.
4514         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4515         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4516         target hook to detect function points.
4517         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4518         * icf.h (Icf::check_section_for_function_pointers): Change type of
4519         parameter SECTION_NAME to const reference to std::string.  Use
4520         target hook to determine if section may have unsafe pointers.
4521         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4522         method definition.
4523
4524 2010-06-21  Rafael Espindola  <espindola@google.com>
4525
4526         * fileread.cc (Input_file::find_fie): New
4527         (Input_file::open): Use Input_file::find_fie.
4528         * fileread.h (Input_file::find_fie): New
4529         * plugin.cc (set_extra_library_path): New.
4530         (Plugin::load): Add set_extra_library_path to the transfer vector.
4531         (Plugin_manager::set_extra_library_path): New.
4532         (Plugin_manager::add_input_file): Use the extra search path if set.
4533         (set_extra_library_path(): New.
4534         * plugin.h (Plugin_manager): Add set_extra_library_path and
4535         extra_search_path_.
4536
4537 2010-06-19  Cary Coutant  <ccoutant@google.com>
4538
4539         * layout.cc (gdb_sections): Add .debug_types.
4540         (lines_only_debug_sections): Likewise.
4541
4542 2010-06-18  Rafael Espindola  <espindola@google.com>
4543
4544         * plugin.cc (add_input_file,add_input_library)
4545         (Plugin_manager::add_input_file): Make filename arguments const.
4546         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4547         const.
4548
4549 2010-06-16  Doug Kwan  <dougkwan@google.com>
4550
4551         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4552         .ARM.attributes section if we have not merged any input
4553         attributes sections.
4554
4555 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4556
4557         * arm.cc: Allow combining objects with no EABI version
4558         information.
4559
4560 2010-06-15  Rafael Espindola  <espindola@google.com>
4561
4562         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4563
4564 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4565
4566         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4567         (struct iovec): Correct !HAVE_READV definition.
4568
4569 2010-06-10  Cary Coutant  <ccoutant@google.com>
4570
4571         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4572         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4573         reloc sections.
4574         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4575
4576         PR 11683
4577         * symtab.h (Symbol::is_placeholder): New member function.
4578         * target-reloc.h (relocate_section): Check for placeholder symbols.
4579
4580         * testsuite/Makefile.am (plugin_test_8): New test.
4581         (plugin_test_9): New test.
4582         * testsuite/Makefile.in: Regenerate.
4583
4584 2010-06-09  Nick Clifton  <nickc@redhat.com>
4585
4586         * yyscript.y (input_list_element): Allow strings prefixed with
4587         the '-' character.  Treat these as libraries.
4588         * script.cc (script_add_library): New function.  Adds a library
4589         specified by "-l<name>" found in an input script.
4590         * script-c.h: Add prototype for script_add_library.
4591
4592 2010-06-07  Doug Kwan  <dougkwan@google.com>
4593
4594         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4595         Restrict stub-group size to be within long conditional branch
4596         range when working around cortex-A8 erratum.
4597
4598 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4599
4600         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4601         #ifdef typo.
4602
4603 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4604
4605         PR gold/11658
4606         * output.cc
4607         (Output_section::Input_section_sort_entry::compare_section_ordering):
4608         Change to return non-zero correctly.
4609         (Output_section::Input_section_sort_section_order_index_compare
4610         ::operator()): Change to fix ambiguity in comparisons.
4611
4612 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4613
4614         * gold.h (is_wildcard_string): New function.
4615         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4616         (Layout::layout_eh_frame): Ditto.
4617         (Layout::find_section_order_index): New method.
4618         (Layout::read_layout_from_file): New method.
4619         * layout.h (Layout::find_section_order_index): New method.
4620         (Layout::read_layout_from_file): New method.
4621         (Layout::input_section_position_): New private member.
4622         (Layout::input_section_glob_): New private member.
4623         * main.cc (main): Call read_layout_from_file here.
4624         * options.h (--section-ordering-file): New option.
4625         * output.cc (Output_section::input_section_order_specified_): New
4626         member.
4627         (Output_section::Output_section): Initialize new member.
4628         (Output_section::add_input_section): Add new parameter.
4629         Keep input sections when --section-ordering-file is used.
4630         (Output_section::set_final_data_size): Sort input sections when
4631         section ordering file is specified.
4632         (Output_section::Input_section_sort_entry): Add new parameter.
4633         Check sorting type.
4634         (Output_section::Input_section_sort_entry::compare_section_ordering):
4635         New method.
4636         (Output_section::Input_section_sort_compare::operator()): Change to
4637         consider section_order_index.
4638         (Output_section::Input_section_sort_init_fini_compare::operator()):
4639         Change to consider section_order_index.
4640         (Output_section::Input_section_sort_section_order_index_compare
4641         ::operator()): New method.
4642         (Output_section::sort_attached_input_sections): Change to sort
4643         according to section order when specified.
4644         (Output_section::add_input_section<32, true>): Add new parameter.
4645         (Output_section::add_input_section<64, true>): Add new parameter.
4646         (Output_section::add_input_section<32, false>): Add new parameter.
4647         (Output_section::add_input_section<64, false>): Add new parameter.
4648         * output.h (Output_section::add_input_section): Add new parameter.
4649         (Output_section::input_section_order_specified): New
4650         method.
4651         (Output_section::set_input_section_order_specified): New method.
4652         (Input_section::Input_section): Initialize section_order_index_.
4653         (Input_section::section_order_index): New method.
4654         (Input_section::set_section_order_index): New method.
4655         (Input_section::section_order_index_): New member.
4656         (Input_section::Input_section_sort_section_order_index_compare): New
4657         struct.
4658         (Output_section::input_section_order_specified_): New member.
4659         * script-sections.cc (is_wildcard_string): Delete and move modified
4660         method to gold.h.
4661         (Output_section_element_input::Output_section_element_input): Modify
4662         call to is_wildcard_string.
4663         (Output_section_element_input::Input_section_pattern
4664         ::Input_section_pattern): Ditto.
4665         (Output_section_element_input::Output_section_element_input): Ditto.
4666         * testsuite/Makefile.am (final_layout): New test case.
4667         * testsuite/Makefile.in: Regenerate.
4668         * testsuite/final_layout.cc: New file.
4669         * testsuite/final_layout.sh: New file.
4670
4671 2010-06-01  Rafael Espindola  <espindola@google.com>
4672
4673         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4674
4675 2010-06-01  Rafael Espindola  <espindola@google.com>
4676
4677         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4678         visibility of symbols.
4679
4680 2010-05-27  Doug Kwan  <dougkwan@google.com>
4681
4682         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4683         from start of output section instead of address for a local symbol
4684         in a merged or relaxed section when doing a relocatable link.
4685
4686 2010-05-26  Rafael Espindola  <espindola@google.com>
4687
4688        PR 11604
4689         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4690         adding sections the garbage collector removed.
4691         * gold/testsuite/Makefile.am: Add test.
4692         * gold/testsuite/Makefile.in: Regenerate.
4693         * gold/testsuite/plugin_test_7.sh: New.
4694         * gold/testsuite/plugin_test_7_1.c: New.
4695         * gold/testsuite/plugin_test_7_2.c: New.
4696
4697 2010-05-26  Rafael Espindola  <espindola@google.com>
4698
4699         * script-sections.cc (Output_section_definition::set_section_addresses):
4700         Check for --section-start.
4701
4702 2010-05-26  Doug Kwan  <dougkwan@google.com>
4703
4704         * arm.cc (Arm_scan_relocatable_relocs): New class.
4705         (Target_arm::relocate_special_relocatable): New method.
4706         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4707         (Arm_relocate_functions::thumb_branch_common): Same.
4708         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4709         instead of Default_scan_relocatable_relocs.
4710         * target-reloc.h (relocate_for_relocatable): Let target handle
4711         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4712         * target.h (Sized_target::relocate_special_relocatable): New method.
4713
4714 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4715
4716         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4717
4718 2010-05-23  Doug Kwan  <dougkwan@google.com>
4719
4720         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4721         instead of a cast.
4722         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4723         with a direct branch, not a conditional branch, to a stub.
4724         * merge.cc (Output_merge_base::record_input_section): New method
4725         defintion.
4726         (Output_merge_data::do_add_input_section): Record input section if
4727         keeps-input-sections flag is set.
4728         (Output_merge_string::do_add_input_section): Ditto.
4729         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4730         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4731         INPUT_SECTIONS_.
4732         (Output_merge_base::keeps_input_sections,
4733         Output_merge_base::set_keeps_input_sections,
4734         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4735         method definitions.
4736         (Output_merge_base::Input_sections): New type declaration.
4737         (Output_merge_base::input_sections_begin,
4738         Output_merge_base::input_sections_end,
4739         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4740         (Output_merge_base::bool keeps_input_sections_,
4741         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4742         Output_merge_base::input_sections_): New data members.
4743         (Output_merge_data::do_set_keeps_input_sections): New method
4744         defintion.
4745         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4746         * output.cc (Output_section::Input_section::relobj): Move method
4747         defintion from class declaration to here and handle merge sections.
4748         (Output_section::Input_section::shndx): Ditto.
4749         (Output_section::Output_section): Remove initializations of removed
4750         data members and initialize new data member LOOKUP_MAPS_.
4751         (Output_section::add_input_section): Set keeps-input-sections flag
4752         for a newly created merge output section as appropriate.  Adjust code
4753         to use Output_section_lookup_maps class.
4754         (Output_section::add_relaxed_input_section): Adjst code for lookup
4755         maps code refactoring.
4756         (Output_section::add_merge_input_section): Add a new parameter
4757         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4758         class.  If adding input section to a newly created merge output
4759         section fails, remove the new merge section.
4760         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4761         Adjust code for use of the Output_section_lookup_maps class.
4762         (Output_section::find_merge_section): Ditto.
4763         (Output_section::build_lookup_maps): New method defintion.
4764         (Output_section::find_relaxed_input_section): Adjust code to use
4765         Output_section_lookup_maps class.
4766         (Output_section::get_input_sections): Export merge sections.  Adjust
4767         code to use Output_section_lookup_maps class.
4768         (Output_section:::add_script_input_section): Adjust code to use
4769         Output_section_lookup_maps class.  Update lookup maps for merge
4770         sections also.
4771         (Output_section::discard_states): Use Output_section_lookup_maps.
4772         (Output_section::restore_states): Same.
4773         * output.h (Merge_section_properties): Move class defintion out of
4774         Output_section.
4775         (Output_section_lookup_maps): New class.
4776         (Output_section::Input_section::is_merge_section): New method
4777         defintion.
4778         (Output_section::Input_section::relobj): Move defintion out of class
4779         defintion.  Declare method only.
4780         (Output_section::Input_section::shndx): Ditto.
4781         (Output_section::Input_section::output_merge_base): New method defintion.
4782         (Output_section::Input_section::u2_.pomb): New union field.
4783         (Output_section::Merge_section_by_properties_map,
4784         Output_section::Output_section_data_by_input_section_map,
4785         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4786         Remove types.
4787         (Output_section::add_merge_input_section): Add new parameter
4788         KEEPS_INPUT_SECTIONS.
4789         (Output_section::build_lookup_maps): New method declaration.
4790         (Output_section::merge_section_map_,
4791         Output_section::merge_section_by_properties_map_,
4792         Output_section::relaxed_input_section_map_,
4793         Output_section::is_relaxed_input_section_map_valid_): Remove data
4794         members.
4795         (Output_section::lookup_maps_): New data member.
4796
4797 2010-05-21  Doug Kwan  <dougkwan@google.com>
4798
4799         PR gold/11619
4800         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4801         avoid a compilation error.
4802
4803 2010-05-19  Rafael Espindola  <espindola@google.com>
4804
4805         * script-sections.cc (Output_section_definition::allocate_to_segment):
4806         Update the phdrs_list even when the output section is NULL.
4807         * testsuite/Makefile.am: Add test.
4808         * testsuite/Makefile.in: Regenerate.
4809         * testsuite/script_test_9.cc: New.
4810         * testsuite/script_test_9.sh: New.
4811         * testsuite/script_test_9.t: New.
4812
4813 2010-05-19  Doug Kwan  <dougkwan@google.com>
4814
4815         * arm.cc (Arm_input_section::original_size): New method.
4816         (Arm_input_section::do_addralign): Add a cast.
4817         (Arm_input_section::do_output_offset): Remove static cast.
4818         (Arm_input_section::original_addralign,
4819          Arm_input_section::original_size_): Change type to uint32_t.
4820         (Arm_input_section::init): Add safe casts for section alignment
4821         and size.
4822         (Arm_input_section::set_final_data_size): Do not set address and
4823         offset of stub table.
4824         (Arm_output_section::fix_exidx_coverage): Change use of of
4825         Output_section::Simple_input_section to that of
4826         Output_section::Input_section.
4827         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4828         except for the first pass.
4829         * output.cc (Output_section::get_input_sections): Change type of
4830         input_sections to std::list<Input_section>.
4831         (Output_section::add_script_input_section): Rename from
4832         Output_section::add_simple_input_section.  Change type of SIS
4833         parameter from Simple_input_section to Input_section.
4834         * output.h (Output_section::Simple_input_section): Remove class.
4835         (Output_section::Input_section): Change class visibility to public.
4836         (Output_section::Input_section::addralign): Use stored alignments
4837         for special input sections if set.
4838         (Output_section::Input_section::set_addralign): New method.
4839         (Output_section::get_input_sections): Change parameter type from
4840         list of Simple_input_section to list of Input_section.
4841         (Output_section::add_script_input_section): Rename from
4842         Output_section::add_simple_input_section. Change first parameter's
4843         type from Simple_input_section to Input_section and remove the
4844         second and third parameters.
4845         * script-sections.cc (Input_section::Input_section_list): Change
4846         type to list of Output_section::Input_section/
4847         (Input_section_info::Input_section_info): Change parameter type of
4848         INPUT_SECTION to Output_section::Input_section.
4849         (Input_section_info::input_section): Change return type.
4850         (Input_section_info::input_section_): Change type to
4851         Output_section::Input_section.
4852         (Output_section_element_input::set_section_addresses): Adjust code
4853         to use Output_section::Input_section instead of
4854         Output_section::Simple_input_section.  Adjust code for renaming
4855         of Output_section::add_simple_input_section.
4856         (Orphan_output_section::set_section_addresses): Ditto.
4857
4858 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4859
4860         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4861         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4862
4863 2010-05-18  Rafael Espindola  <espindola@google.com>
4864
4865         * options.cc (General_options::finalize): Handle -nostdlib.
4866         * options.h (nostdlib): New option.
4867         * script.cc (script_add_search_dir): Handle -nostdlib.
4868
4869 2010-05-12  Doug Kwan  <dougkwan@google.com>
4870
4871         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4872         attributes section only if there no attributes section after merging.
4873         (Target_arm::merge_object_attributes): Move value of
4874         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4875         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4876         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4877         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4878         and arm_attr_merge_7.stdout.
4879         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4880         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4881         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4882         arm_attr_merge_7b.o): New rules.
4883         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4884         arm_attr_merge_7
4885         * testsuite/Makefile.in: Regenerate.
4886         * testsuite/arm_attr_merge.sh: New file.
4887         * testsuite/arm_attr_merge_[67][ab].s: Same.
4888
4889 2010-05-05  Nick Clifton  <nickc@redhat.com>
4890
4891         * po/es.po: Updated Spanish translation.
4892
4893 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4894
4895         * Makefile.am (install-exec-local): Properly install gold as
4896         default cross linker.
4897         * Makefile.in: Regenerated.
4898
4899 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4900             Nick Clifton  <nickc@redhat.com>
4901
4902         * configure.ac (install_as_default): Define and set to false
4903         unless --enable-gold or --enable-gold=both/gold has been
4904         specified.
4905         * configure: Regenerate.
4906
4907         * Makefile.am (install-exec-local): Install the executable as
4908         'ld.gold'.  If install_as_default is true then also install it as
4909         'ld'.
4910         * Makefile.in: Regenerated.
4911
4912 2010-04-24  Ian Lance Taylor  <iant@google.com>
4913
4914         * layout.cc (Layout::layout_reloc): In relocatable link don't
4915         combine reloc sections for grouped sections.
4916
4917 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4918
4919         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4920         sections that are not ordinary to icf.
4921         * icf.cc (get_section_contents): Handle relocation pointing to section
4922         with no object or shndx information.
4923         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4924         * testsuite/Makefile.in: Regenerate.
4925         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4926         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4927
4928 2010-04-22  Ian Lance Taylor  <iant@google.com>
4929
4930         * expression.cc (Expression::Expression_eval_info): Add
4931         result_alignment_pointer field.
4932         (Expression::eval_with_dot): Add result_alignment_pointer
4933         parameter.  Change all callers.
4934         (Expression::eval_maybe_dot): Likewise.
4935         (class Binary_expression): Add alignment_pointer parameter to
4936         left_value and right_value.  Change all callers.
4937         (BINARY_EXPRESSION): Set result alignment.
4938         (class Trinary_expression): Add alignment_pointer parameter to
4939         arg2_value and arg3_value.  Change all callers.
4940         (Trinary_cond::value): Set result alignment.
4941         (Max_expression::value, Min_expression::value): Likewise.
4942         (Align_expression::value): Likewise.
4943         * script-sections.cc (class Sections_element): Add dot_alignment
4944         parameter to set_section_addresses virtual function.  Update
4945         instantiations.
4946         (class Output_section_element): Likewise.
4947         (Script_sections::create_segments): Add dot_alignment parameter.
4948         Change all callers.
4949         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4950         (Script_sections::set_phdrs_clause_addresses): Likewise.
4951         * script-sections.h: Update declarations.
4952         * script.h: Update declarations.
4953         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4954         min_p_align.
4955         * testsuite/script_test_3.t: Set large alignment.
4956         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4957         segment has expected alignment.
4958
4959 2010-04-22  Nick Clifton  <nickc@redhat.com>
4960
4961         * po/gold.pot: Updated by the Translation project.
4962         * po/vi.po: Updated Vietnamese translation.
4963
4964 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4965
4966         * testsuite/Makefile.am (check_PROGRAMS): Add
4967         icf_virtual_function_folding_test.
4968         * testsuite/Makefile.in: Regenerated.
4969
4970 2010-04-15  Andrew Haley  <aph@redhat.com>
4971
4972         * options.h (merge_exidx_entries): New option.
4973         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4974         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4975         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4976         (Target_arm::merge_exidx_entries): New function.
4977         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4978         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4979         to Arm_exidx_fixup constructor.
4980         Add new arg, merge_exidx_entries.
4981         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4982         Arm_output_section::fix_exidx_coverage.
4983
4984 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4985
4986         * icf.cc (get_section_contents): Check for preemptible functions.
4987         Ignore addend when appropriate.
4988         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4989         section folded.
4990         (add_from_relobj): Check for section folded.
4991         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4992         * symtab.h (should_add_dynsym_entry): Add new parameter.
4993         * target-reloc.h (scan_relocs): Check for section folded.
4994         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4995         Check reloc types for function pointers in shared objects.
4996         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4997         case.
4998         (icf_preemptible_functions_test): New test case.
4999         (icf_string_merge_test): New test case.
5000         * testsuite.Makefile.in: Regenerate.
5001         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5002         bar_glob.  Refactor code.
5003         * testsuite/icf_preemptible_functions_test.cc: New file.
5004         * testsuite/icf_preemptible_functions_test.sh: New file.
5005         * testsuite/icf_string_merge_test.cc: New file.
5006         * testsuite/icf_string_merge_test.sh: New file.
5007         * testsuite/icf_virtual_function_folding_test.cc: New file.
5008         * testsuite/icf_virtual_function_folding_test.sh: New file.
5009
5010 2010-04-14  Doug Kwan  <dougkwan@google.com>
5011
5012         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5013         for local symbol recounting if we remove a section due to ICF.
5014         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5015         there are no regular objects in input.
5016
5017 2010-04-13  Doug Kwan  <dougkwan@google.com>
5018
5019         * arm.cc (Arm_input_section::set_final_data_size): Compute
5020         accurate final data size instead of using current data size.
5021
5022 2010-04-09  Doug Kwan  <dougkwan@google.com>
5023
5024         * layout.cc (Layout::choose_output_section): Handle script section
5025         types.
5026         (Layout::make_output_section_for_script): Add section type parameter.
5027         Handle script section types.
5028         * layout.h (Layout::make_output_section_for_script): Add section
5029         type parameter.
5030         * output.cc (Output_section::Output_section): Initialize data member
5031         is_noload_.
5032         (Output_section::do_reset_address_and_file_offset): Do not set address
5033         to 0 if section is a NOLOAD section.
5034         * output.h (Output_section::is_noload): New method.
5035         (Output_section::set_is_noload): Ditto.
5036         (Output_section::is_noload_): New data member.
5037         * script-c.h (Script_section_type): New enum type.
5038         (struct Parser_output_section_header): Add new file section_type.
5039         * script-sections.cc (Sections_element::output_section_name): Add
5040         parameter for returning script section type.
5041         (Output_section_definition::output_section_name): Ditto.
5042         (Output_section_definition::section_type)P; New method.
5043         (Output_section_definiton::script_section_type_name): Ditto.
5044         (Output_section_definition::script_section_type_): New data member.
5045         (Output_section_definition::Output_section_definition): Initialize
5046         data member Output_section_definition::script_section_type_.
5047         (Output_section_definition::create_sections): Pass script section type
5048         to Layout::make_output_section_for_script.
5049         (Output_section_definition::output_section_name): Return script
5050         section type to caller.
5051         (Output_section_definition::set_section_address): Do not advance
5052         dot value and load address if section type is NOLOAD.  Set address
5053         of NOLOAD sections regardless of section flags.
5054         (Output_section_definition::print): Print section type if it is
5055         not SCRIPT_SECTION_TYPE_NONE.
5056         (Output_section_definition::section_type): New method.
5057         (Output_section_definition::script_section_type_name): Ditto.
5058         (Script_sections::output_section_name): Add new parameter
5059         PSECTION_TYPE for returning script section type.  Pass it to
5060         section elements.  Handle discard sections.
5061         (Sort_output_sections::operator()): Handle NOLOAD sections.
5062         * script-sections.h (Script_sections::Section_type): New enum type.
5063         (Script_sections::output_section_name): Add a new parameter for
5064         returning script section type.
5065         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5066         INFO and NOLOAD.
5067         * yyscript.y (union): Add new field SECTION_TYPE.
5068         (COPY, DSECT, INFO, NOLOAD): New tokens.
5069         (opt_address_and_section_type): Change type to output_section_header.
5070         (section_type): New non-terminal
5071         (section_header): Handle section type.
5072         (opt_address_and_section_type): Return section type value.
5073
5074 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5075
5076         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5077         * testsuite/plugin_common_test_2.c (foo): Likewise.
5078
5079 2010-04-08  Doug Kwan  <dougkwan@google.com>
5080
5081         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5082         Output_merge_data.
5083         * output.cc (Output_section::add_merge_input_section): Simplify
5084         code and return status of Output_merge_base::add_input_section.
5085         Update merge section map only if Output_merge_base::add_input_section
5086         returns true.
5087
5088 2010-04-07  Doug Kwan  <dougkwan@google.com>
5089
5090         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5091         if section is marked as containing instructions but has no mapping
5092         symbols.
5093         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5094         correct section index.
5095         (Arm_relobj::find_linked_text_section): Ditto.
5096
5097 2010-04-07  Cary Coutant  <ccoutant@google.com>
5098
5099         * archive.cc (include_member): Destroy Read_symbols_data object before
5100         releasing file.
5101         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5102         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5103         (Read_symbols_data::~Read_symbols_data) New destructor.
5104         (Section_relocs::Section_relocs) New constructor.
5105         (Section_relocs::~Section_relocs) New destructor.
5106         (Read_relocs_data::Read_relocs_data) New constructor.
5107         (Read_relocs_data::~Read_relocs_data) New destructor.
5108         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5109         pointers to NULL after deleting.
5110
5111 2010-04-07  Doug Kwan  <dougkwan@google.com>
5112
5113         * arm.cc: Replace "endianity" with "endianness" in comments.
5114         (Arm_exidx_cantunwind): Ditto.
5115         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5116         (Arm_relobj::merge_flags_and_attributes): New method.
5117         (Arm_relobj::merge_flags_and_attributes_): New data member.
5118         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5119         (Arm_relobj::scan_sections_for_stubs): Ditto.
5120         (Arm_relobj::do_read_symbols): Check to see if we really want to
5121         merge processor-specific flags and attributes.  Exit early if
5122         an object is empty except for section names and the undefined symbol.
5123         (Target_arm::do_finalize_sections): Move check for ELF format to
5124         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5125         attributes from a regular object only when we have determined that
5126         it is aapropriate.  Do not create an .ARM.attributes section in
5127         output if there is no regular input object.
5128         (Target_arm::merge_processor_specific_flags): Check
5129         --warn-mismatch before printing any error.
5130         (Target_arm::merge_object_attributes): Ditto.
5131         * gold.cc (queue_middle_tasks): Handle the case in which there is
5132         no regular object in input.
5133         * options.cc (General_options::parse_EB): New method.
5134         (General_options::parse_EL): Same.
5135         (General_options::General_options): Initialize endianness_.
5136         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5137         New options.
5138         (General_options::Endianness): New enum.
5139         (General_options::endianness): New method.
5140         (General_options::endianness_): New data member.
5141         * parameters.cc (Parameters::set_options): Check target endianness.
5142         (Parameters::set_target_once): Ditto.
5143         (Parameters::check_target_endianness): New method.
5144         (parameters_force_valid_target): If either -EL or -EB is specified,
5145         use it to define endianness of default target.
5146         * parameters.h (Parameters::check_target_endianness): New method
5147         declaration.
5148         * target.h (class Target): Change "endianity" to "endianness"
5149         in comments.
5150
5151 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5152
5153         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5154         * configure: Regenerate.
5155         * Makefile.in: Regenerate.
5156         * testsuite/Makefile.in: Regenerate.
5157
5158 2010-04-06  Cary Coutant  <ccoutant@google.com>
5159
5160         gcc PR lto/42757
5161         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5162         prevailing definitions of common symbols.
5163         * testsuite/plugin_test_6.sh: New test case.
5164         * testsuite/plugin_common_test_1.c: New test case.
5165         * testsuite/plugin_common_test_2.c: New test case.
5166         * testsuite/Makefile.am (plugin_test_6): New test case.
5167         * testsuite/Makefile.in: Regenerate.
5168
5169 2010-04-06  Nick Clifton  <nickc@redhat.com>
5170
5171         * po/vi.po: New Vietnamese translation.
5172
5173 2010-03-30  Doug Kwan  <dougkwan@google.com>
5174
5175         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5176
5177 2010-03-25  Doug Kwan  <dougkwan@google.com>
5178
5179         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5180         to avoid a conversion warning on a 32-bit host.
5181
5182 2010-03-24  Ian Lance Taylor  <iant@google.com>
5183
5184         * testsuite/script_test_3.t: Add a TLS segment.
5185         * testsuite/Makefile.am (check_PROGRAMS): Add
5186         tls_phdrs_script_test.
5187         (tls_phdrs_script_test_SOURCES): Define.
5188         (tls_phdrs_script_test_DEPENDENCIES): Define.
5189         (tls_phdrs_script_test_LDFLAGS): Define.
5190         (tls_phdrs_script_test_LDADD): Define.
5191         * testsuite/Makefile.in: Rebuild.
5192
5193 2010-03-23  Cary Coutant  <ccoutant@google.com>
5194
5195         * fileread.cc (find_or_make_view): Fix comment.
5196
5197 2010-03-23  Ian Lance Taylor  <iant@google.com>
5198
5199         * script-sections.cc (class Orphan_section_placement): Define
5200         PLACE_TLS and PLACE_TLS_BSS.
5201         (Orphan_section_placement::Orphan_section_placement): Initialize
5202         new places.
5203         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5204         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5205         (tls_script_test_SOURCES): Define.
5206         (tls_script_test_DEPENDENCIES): Define.
5207         (tls_script_test_LDFLAGS): Define.
5208         (tls_script_test_LDADD): Define.
5209         * testsuite/Makefile.in: Rebuild.
5210
5211 2010-03-22  Doug Kwan  <dougkwan@google.com>
5212
5213         * arm.cc (Arm_relocate_functions::abs8,
5214         Arm_relocate_functions::abs16): Use correct check for overflow
5215         specified in the ARM ELF specs.
5216         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5217         target of a BLX instruction specially.
5218         (Reloc_stub::stub_type_for_reloc): Ditto.
5219         (Relocate::relocate): Use symbolic names instead of numeric relocation
5220         codes to report error.
5221         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5222         workaround.
5223         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5224         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5225         thumb2_blx_out_of_range.stdout
5226         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5227         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5228         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5229         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5230         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5231         thumb2_blx_in_range, thumb2_blx_in_range.o,
5232         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5233         thumb2_blx_out_of_range.o): New rules.
5234         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5235         thumb2_blx_in_range and thumb2_blx_out_of_range.
5236         * testsuite/Makefile.in: Regenerate.
5237         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5238         * testsuite/thumb_blx_in_range.s: New file.
5239         * testsuite/thumb_blx_out_of_range.s: New file.
5240
5241 2010-03-22  Rafael Espindola  <espindola@google.com>
5242
5243         * archive.cc (Should_include): Move to archive.h.
5244         (should_include_member): Make it a member of Archive.
5245         (Lib_group): New.
5246         (Add_lib_group_symbols): New.
5247         * archive.h: Include options.h.
5248         (Archive_member): Moved from Archive.
5249         (Should_include): Moved from archive.cc.
5250         (Lib_group): New.
5251         (Add_lib_group_symbols): New.
5252         * dynobj.cc (do_should_include_member): New.
5253         * dynobj.h (do_should_include_member): New.
5254         * gold.cc (queue_initial_tasks): Update call to queue.
5255         * main.cc (main): Print lib group stats.
5256         * object.cc (do_should_include_member): New.
5257         * object.h: Include archive.h.
5258         (Object::should_include_member): New.
5259         (Object::do_should_include_member): New.
5260         (Sized_relobj::do_should_include_member): New.
5261         * options.cc (General_options::parse_start_lib): New.
5262         (General_options::parse_end_lib): New.
5263         (Input_arguments::add_file): Handle lib groups.
5264         (Input_arguments::start_group): Check we are not in a lib.
5265         (Input_arguments::start_lib): New.
5266         (Input_arguments::end_lib): New.
5267         * options.h (General_options): Add start_lib and end_lib.
5268         (Input_argument::lib_): New.
5269         (Input_argument::lib): New.
5270         (Input_argument::is_lib): New.
5271         (Input_file_lib): New.
5272         (Input_arguments::in_lib_): New.
5273         (Input_arguments::in_lib): New.
5274         (Input_arguments::start_lib): New.
5275         (Input_arguments::end_lib_): New.
5276         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5277         in unused members as preempted.
5278         (Sized_pluginobj::do_should_include_member): New.
5279         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5280         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5281         return the blocker.
5282         (Read_symbols::do_whole_lib_group): New.
5283         (Read_symbols::do_lib_group): New.
5284         (Read_symbols::do_read_symbols): Handle lib groups.
5285         (Read_symbols::get_name): Handle lib groups.
5286         * readsyms.h (Read_symbols): Add an archive member pointer.
5287         (Read_symbols::do_whole_lib_group): New.
5288         (Read_symbols::do_lib_group): New.
5289         (Read_symbols::member_): New.
5290         * script.cc (read_input_script): Update call to queue_soon.
5291
5292 2010-03-19  Doug Kwan  <dougkwan@google.com>
5293
5294         * arm.cc (Stub_table::Stub_table): Initialize new data members
5295         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5296         (Stub_table::add_reloc_stub): Assign stub offset and update
5297         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5298         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5299         New data members.
5300         (Stub_table::update_data_size_and_addralign): Use
5301         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5302         instead of going over all reloc stubs.
5303         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5304         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5305         Stringpool_template::offset_ to size of Stringpool_char.
5306         (Stringpool_template::new_key_offset): Remove code to initialize
5307         Stringpool_template::offset_.
5308         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5309         Stringpool_template::offset_ to zero.
5310
5311 2010-03-15  Doug Kwan  <dougkwan@google.com>
5312
5313         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5314         offset_.
5315         (Stringpool_template::new_key_offset): New method.
5316         (Stringpool_template::add_string): Assign offsets when adding new
5317         strings.
5318         (Stringpool_template::set_string_offsets): Do not set string offsets
5319         when not optimizing.
5320         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5321         member size_.
5322         (Chunked_vector::clear): Clear size_.
5323         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5324         (Chunked_vector::size): Return size_.
5325         (Chunked_vector::push_back): Use size_ to find insert position.
5326         (Chunked_vector::size_): New data member.
5327         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5328         (Stringpool_template::new_key_offset): New method declaration.
5329         (Stringpool_template::offset_): New data member.
5330
5331 2010-03-15   Rafael Espindola  <espindola@google.com>
5332
5333         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5334         Add_symbols' constructor.
5335         * readsyms.h (Add_symbols): Remove the input_group member.
5336
5337 2010-03-10  Ian Lance Taylor  <iant@google.com>
5338
5339         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5340         target to ask whether a reference to a symbol requires a stack
5341         split.
5342         * target.h (Target::is_call_to_non_split): New function.
5343         (Target::do_is_call_to_non_split): Declare virtual function.
5344         * target.cc: Include "symtab.h".
5345         (Target::do_is_call_to_non_split): New function.
5346         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5347
5348 2010-03-10  Cary Coutant  <ccoutant@google.com>
5349
5350         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5351         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5352         (File_read::open[2]): Add whole_file_view_ to list of views.
5353         (File_read::make_view): Remove test of whole_file_view_.
5354         (File_read::find_or_make_view): Create whole_file_view_ if
5355         necessary.
5356         (File_read::clear_views): Replace bool parameter with enum;
5357         adjust all callers.  Don't delete views with permanent data;
5358         do delete cached views and views from archives if
5359         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5360         if clearing the corresponding view.
5361         * fileread.h (File_read::Clear_views_mode): New enum.
5362         (File_read::View::is_permanent_view): New method.
5363         (File_read::clear_views): Replace bool parameter
5364         with enum; adjust all callers.
5365         * options.h (General_options): Change keep_files_mapped option;
5366         add map_whole_files.
5367         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5368         releasing the file.
5369         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5370         the file.
5371
5372 2010-03-10  David S. Miller  <davem@davemloft.net>
5373
5374         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5375
5376 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5377
5378         * icf.cc (get_section_contents): Add '@' marker after processing the
5379         merge reloc.
5380
5381 2010-03-08  Doug Kwan  <dougkwan@google.com>
5382
5383         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5384         due to a conversion warning.
5385         (Arm_relobj::update_output_local_symbol_count): Check for local
5386         symbol with unset output index.
5387
5388 2010-03-05  Ian Lance Taylor  <iant@google.com>
5389
5390         * options.h (class General_options): Add --spare-dynamic-tags.
5391         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5392         --spare-dynamic-tags.
5393
5394 2010-03-05  Ian Lance Taylor  <iant@google.com>
5395
5396         * incremental.cc: Include "libiberty.h".
5397
5398 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5399
5400         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5401         function, is_info_ member.
5402         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5403         (Versions::Versions): Update caller.
5404         (Versions::define_base_version): Likewise.
5405         (Versions::add_def): Likewise.
5406
5407 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5408
5409         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5410         (Scan::possible_function_pointer_reloc): New function.
5411         (Scan::local_reloc_may_be_function_pointer): Change to call
5412         possible_function_pointer_reloc.
5413         (Scan::global_reloc_may_be_function_pointer): Ditto.
5414         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5415         relocations in ".data.rel.ro._ZTV" section.
5416         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5417         * testsuite/icf_safe_so_test.cc: Ditto.
5418         * testsuite/icf_safe_test.cc: Ditto.
5419         * testsuite/icf_safe_test.sh: Ditto.
5420
5421 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5422             Ian Lance Taylor  <iant@google.com>
5423
5424         * target-reloc.h (relocate_section): Check the symbol table index
5425         for -1U before setting the local symbol index.
5426         (scan_relocatable_relocs): If copying the relocation, record that
5427         the local symbol is required.
5428         * object.h (Symbol_value::is_output_symtab_index_set): New
5429         function.
5430         (Symbol_value::may_be_discarded_from_output_symtab): New
5431         function.
5432         (Symbol_value::has_output_symtab_entry): New function.
5433         (Symbol_value::needs_output_symtab_entry): Remove.
5434         (Symbol_value::output_symtab_index): Make sure the symbol index is
5435         set.
5436         (Symbol_value::set_output_symtab_index): Make sure the symbol
5437         index is not set.  Make sure the new index is valid.
5438         (Symbol_value::set_must_have_output_symtab_entry): New function.
5439         (Symbol_value::has_output_dynsym_entry): New function.
5440         (Symbol_value::set_output_dynsym_index): Make sure the new index
5441         is valid.
5442         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5443         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5444         local symbol if permitted.
5445         (Sized_relobj::do_finalize_local_symbols): Call
5446         is_output_symtab_index_set rather than needs_output_symtab_entry.
5447         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5448         rather than needs_output_symtab_entry.  Call
5449         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5450         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5451         is_output_symtab_index_set rather than needs_output_symtab_entry.
5452         * testsuite/discard_locals_relocatable_test.c: New file.
5453         * testsuite/discard_locals_test.sh: Test -r.
5454         * testsuite/Makefile.am (check_DATA): Add
5455         discard_locals_relocatable_test1.syms,
5456         discard_local_relocatable_test2.syms.
5457         (MOSTLYCLEANFILES): Likewise.  Also add
5458         discard_locals_relocatable_test1.lout and
5459         discard_locals_relocatable_test2.out.
5460         (discard_locals_relocatable_test1.syms): New target.
5461         (discard_locals_relocatable_test.o): New target.
5462         (discard_locals_relocatable_test1.out): New target.
5463         (discard_locals_relocatable_test2.syms): New target.
5464         (discard_locals_relocatable_test2.out): New target.
5465         (various): Add missing ../ld-new dependencies.
5466         * testsuite/Makefile.in: Rebuild.
5467
5468 2010-03-03  Nick Clifton  <nickc@redhat.com>
5469
5470         * po/fi.po: New Finnish translation.
5471
5472 2010-03-01  Doug Kwan  <dougkwan@google.com>
5473
5474         * layout.cc (Layout::Layout): Force section types of .init_array*,
5475         .preinit_array* and .fini_array* sections.
5476         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5477         Fix check of return value of std::string::find.().
5478         (Output_section::Input_section_sort_compare::operator()): Remove
5479         comment about .init_array.
5480         (Output_section::Input_section_sort_init_fini_compare::operator()):
5481         New method.
5482         (Output_section::sort_attached_input_sections): Handle .init_array
5483         and .fini_array specially.
5484         * output.h (Output_section::Inut_section_sort_compare): Update
5485         comment.
5486         (Output_section::Input_section_sort_init_fini_compare): New struct.
5487
5488 2010-02-26  Doug Kwan  <dougkwan@google.com>
5489
5490         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5491         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5492         * testsuite/debug_msg.sh: Avoid matching source line number for
5493         use of global variable undef_int.
5494
5495 2010-02-26  Doug Kwan  <dougkwan@google.com>
5496
5497         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5498         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5499         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5500         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5501         * options.cc (General_options::General_options): Initialize member
5502         fix_v4bx_.
5503         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5504         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5505         and rm_no_fix_v4bx.stdout
5506         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5507         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5508         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5509         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5510         and arm_no_fix_v4bx.
5511         * Makefile.in: Regenerate.
5512         * testsuite/arm_fix_v4bx.s: New file.
5513         * testsuite/arm_fix_v4bx.sh: Ditto.
5514
5515 2010-02-24  Doug Kwan  <dougkwan@google.com>
5516
5517         * arm.cc (Target_arm::got_section): Make the .got section the first
5518         non RELRO section in the data segment.
5519         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5520         suffixes of section names.
5521
5522 2010-02-24  Doug Kwan  <dougkwan@google.com>
5523
5524         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5525         flags and attributes merging if an input file is a binary file.
5526         * fileread.cc (Input_file::open): Record format of original file.
5527         * fileread.h (Input_file::Format): New enum type.
5528         (Input_file::Input_file): Initialize data member format_.
5529         (Input_file::format): New method definition.
5530         (Input_file::format_):: New data member.
5531
5532 2010-02-24  Doug Kwan  <dougkwan@google.com>
5533
5534         * arm.cc (Arm_output_data_got): New class.
5535         (ARM_TCB_SIZE): New constant
5536         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5537         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5538         If user uses a script with a SECTIONS clause, issue only a warning
5539         for a misplaced EXIDX input section.  Otherwise, issue an error.
5540         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5541         garbage collection.
5542         (Target_arm::got_mode_index_entry): Handle static linking.
5543         (Target_arm::Scan::local): Ditto.
5544         (Target_arm::Scan::global): Ditto.
5545         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5546         all incorrectly implemented relocations.
5547         (Target_arm::fix_exidx_coverage): Pass layout to
5548         Arm_output_section::fix_exidx_coverage.
5549         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5550         from ".ARM.exidx." and ".ARM.extab.".
5551
5552 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5553
5554         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5555         section if it does not already exist.
5556         * attributes.cc (Attributes_section_data::Attributes_section_data):
5557         Don't crash if size is zero.
5558
5559 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5560             Ian Lance Taylor  <iant@google.com>
5561
5562         * gold.cc (queue_middle_tasks): If no input files were opened,
5563         exit.
5564         * workqueue.h (Task_function::Task_function): Assert that there is
5565         a blocker.
5566
5567 2010-02-22  Doug Kwan  <dougkwan@google.com>
5568
5569         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5570         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5571         types to avoid warnings due to different uint64_t implementations
5572         on different hosts.
5573
5574 2010-02-21  Doug Kwan  <dougkwan@google.com>
5575
5576         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5577         handling of the maximum backward branch offset.
5578         (Arm_relocate_functions::thumb_branch_common): Ditto.
5579         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5580         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5581         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5582         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5583         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5584         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5585         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5586         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5587         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5588         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5589         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5590         thumb2_bl_out_of_range.o): New rules.
5591         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5592         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5593         thumb2_bl_out_of_range
5594         * testsuite/Makefile.in: Regenerate.
5595         * testsuite/arm_bl_in_range.s: New file.
5596         * testsuite/arm_bl_out_of_range.s: Ditto.
5597         * testsuite/arm_branch_in_range.sh: Ditto.
5598         * testsuite/arm_branch_range.t: Ditto.
5599         * testsuite/thumb2_branch_range.t: Ditto.
5600         * testsuite/thumb_bl_in_range.s: Ditto.
5601         * testsuite/thumb_bl_out_of_range.s: Ditto.
5602         * testsuite/thumb_branch_range.t: Ditto.
5603
5604 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5605
5606         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5607         Add reloc offset information.
5608         * icf.cc (get_section_contents): Change iterators to point to the new
5609         vectors. Add reloc offset information to the contents.
5610         * icf.h (Icf::Sections_reachable_info): New typedef.
5611         (Icf::Sections_reachable_list): New typedef.
5612         (Icf::Offset_info): New typedef.
5613         (Icf::Reloc_info): New struct typedef.
5614         (Icf::Reloc_info_list): New typedef.
5615         (Icf::symbol_reloc_list): Delete method.
5616         (Icf::addend_reloc_list): Delete method.
5617         (Icf::section_reloc_list): Delete method.
5618         (Icf::reloc_info_list): New method.
5619         (Icf::reloc_info_list_): New member.
5620
5621 2010-02-19  Doug Kwan  <dougkwan@google.com>
5622
5623         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5624         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5625         * arm.cc (Arm_relocation_functions): New forward declaration.
5626         (Target_arm::Target_arm): Initialize new data members
5627         got_mod_index_offset_ and tls_base_symbol_defined_.
5628         (Target_arm::Relocate::relocate_tls): New method.
5629         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5630          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5631         New methods.
5632         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5633         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5634         (Target_arm::got_mod_index_offset_,
5635         Target_arm::tls_base_symbol_defined_): New data members.
5636         (Target_arm::Scan::local, Target::Scan::global,
5637         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5638         relocations.
5639
5640 2010-02-18  Doug Kwan  <dougkwan@google.com>
5641
5642         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5643         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5644         text section as a parameter becuase some broken tools may not set
5645         the link in section header.
5646         (Target_arm::has_got_section): New method.
5647         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5648         without any mapping symbol as data only.  Remove warning.
5649         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5650         link in its section header, try to discover the link by inspecting the
5651         REL31 relocation at the beginning of the section.
5652         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5653         in error message.
5654         (Target_arm::Scan::global): Treat any reference to the symbol
5655         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5656
5657 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5658
5659         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5660         (Scan::global_reloc_may_be_function_pointer): New function.
5661         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5662         (Scan::global_reloc_may_be_function_pointer): New function.
5663         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5664         (Scan::global_reloc_may_be_function_pointer): New function.
5665         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5666         (Scan::global_reloc_may_be_function_pointer): New function.
5667         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5668         (Scan::global_reloc_may_be_function_pointer): New function.
5669         (Scan::possible_function_pointer_reloc): New function.
5670         (Target_x86_64::can_check_for_function_pointers): New function.
5671         * gc.h (gc_process_relocs): Scan relocation types to determine if
5672         function pointers were taken for targets that support it.
5673         * icf.cc (Icf::find_identical_sections): Include functions for
5674         folding in safe ICF whose pointer is not taken.
5675         * icf.h (Secn_fptr_taken_set): New typedef.
5676         (fptr_section_id_): New member.
5677         (section_has_function_pointers): New function.
5678         (set_section_has_function_pointers): New function.
5679         (check_section_for_function_pointers): New function.
5680         * options.h: Fix comment for safe ICF option.
5681         * target.h (can_check_for_function_pointers): New function.
5682         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5683         Modify icf_safe_test for X86-64.
5684         * testsuite/Makefile.in: Regenerate.
5685         * testsuite/icf_safe_so_test.cc: New file.
5686         * testsuite/icf_safe_so_test.sh: New file.
5687         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5688         (main): Change to take pointer to function kept_func_3.
5689         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5690         folding is done correctly for X86-64.
5691
5692 2010-02-12  David S. Miller  <davem@davemloft.net>
5693
5694         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5695         is_symbolless parameter.
5696         (Output_reloc<SHT_REL>::is_symbolless): New.
5697         (Output_reloc<SHT_REL>::is_symbolless_): New.
5698         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5699         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5700         (Output_reloc<SHT_RELA>::is_symbolless): New.
5701         (Output_data_reloc::add_global): Handle is_symbolless.
5702         (Output_data_reloc::add_global_relative): Likewise.
5703         (Output_data_reloc::add_local): Likewise.
5704         (Output_data_reloc::add_local_relative): Likewise.
5705         (Output_data_reloc::add_symbolless_global_addend): New.
5706         (Output_data_reloc::add_symbolless_local_addend): New.
5707         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5708         is_symbolless.
5709         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5710         instead of ->is_relative_
5711         (Output_reloc::write): Likewise.
5712         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5713         (Output_reloc::write_rel): Simplify.
5714
5715         * sparc.cc (Target_sparc::Scan::local): Use
5716         ->add_symbolless_local_addend as needed.
5717         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5718         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5719         based upon relocation offset.
5720
5721 2010-02-11  Doug Kwan  <dougkwan@google.com>
5722
5723         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5724         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5725         beginning of function.
5726         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5727         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5728         parameter is_32bit in calls to should_apply_static_reloc.
5729         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5730         (check_DATA): Add arm_abs_global.stdout.
5731         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5732         arm_abs_global.stdout): New rules.
5733         (MOSTLLYCLEANFILES): Add arm_abs_global
5734         * Makefile.in: Regenerate.
5735         * testsuite/arm_abs_global.s: New file.
5736         * testsuite/arm_abs_global.sh: Ditto.
5737         * testsuite/arm_abs_lib.s: Ditto.
5738
5739 2010-02-11  Ian Lance Taylor  <iant@google.com>
5740
5741         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5742         Read_relocs task.
5743         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5744         Allocate_commons_task first.
5745         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5746         task, rather than symtab_lock_.
5747         (Gc_process_relocs::~Gc_process_relocs): New function.
5748         (Gc_process_relocs::is_runnable): Check this_blocker_.
5749         (Gc_process_relocs::locks): Use next_blocker_ rather than
5750         blocker_.
5751         (Scan_relocs::~Scan_relocs): New function.
5752         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5753         symtab_lock_.
5754         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5755         next_blocker_.
5756         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5757         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5758         constructor accordingly.
5759         (class Gc_process_relocs): Likewise.
5760         (class Scan_relocs): Likewise.
5761         * common.h (class Allocate_commons_task): Remove symtab_lock_
5762         field, and corresponding constructor parameter.
5763         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5764         symtab_lock_.
5765         (Allocate_commons_task::locks): Likewise.
5766
5767 2010-02-11  Ian Lance Taylor  <iant@google.com>
5768
5769         * gold-threads.h (class Once): Define.
5770         (class Initialize_lock): Rewrite as child of Once.
5771         * gold-threads.cc (class Once_initialize): Define.
5772         (once_pointer_control): New static variable.
5773         (once_pointer, once_arg): New static variables.
5774         (c_run_once): New static function.
5775         (Once::Once, Once::run_once, Once::internal_run): New functions.
5776         (class Initialize_lock_once): Remove.
5777         (initialize_lock_control): Remove.
5778         (initialize_lock_pointer): Remove.
5779         (initialize_lock_once): Remove.
5780         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5781         (Initialize_lock::initialize): Rewrite.
5782         (Initialize_lock::do_run_once): New function.
5783         * archive.cc (Archive::interpret_header): Only clear name if it is
5784         not already empty.
5785         * fileread.cc: Include "gold-threads.h"
5786         (file_counts_lock): New static variable.
5787         (file_counts_initialize_lock): Likewise.
5788         (File_read::release): Only increment counts when using --stats.
5789         Use a lock around the increment.
5790         * parameters.cc (class Set_parameters_target_once): Define.
5791         (set_parameters_target_once): New static variable.
5792         (Parameters::Parameters): Move here from parameters.h.
5793         (Parameters::set_target): Rewrite.
5794         (Parameters::set_target_once): New function.
5795         (Parameters::clear_target): Move here and rewrite.
5796         * parameters.h (class Parameters): Update declarations.  Add
5797         set_parameters_target_once_ field.
5798         (Parameters::Parameters): Move to parameters.cc.
5799         (Parameters::clear_target): Likewise.
5800         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5801         task.
5802         (Start_group::~Start_group): New function.
5803         (Start_group::is_runnable): New function.
5804         (Start_group::locks, Start_group::run): New functions.
5805         (Finish_group::run): Change saw_undefined to size_t.
5806         * readsyms.h (class Start_group): Define.
5807         (class Finish_group): Change saw_undefined_ field to size_t.
5808         (Finish_group::Finish_group): Remove saw_undefined and
5809         this_blocker parameters.  Change all callers.
5810         (Finish_group::set_saw_undefined): New function.
5811         (Finish_group::set_blocker): New function.
5812         * symtab.h (class Symbol_table): Change saw_undefined to return
5813         size_t.  Change saw_undefined_ field to size_t.
5814         * target-select.cc (Set_target_once::do_run_once): New function.
5815         (Target_selector::Target_selector): Initialize set_target_once_
5816         field.  Don't initialize lock_ and initialize_lock_ fields.
5817         (Target_selector::instantiate_target): Rewrite.
5818         (Target_selector::set_target): New function.
5819         * target-select.h (class Set_target_once): Define.
5820         (class Target_selector): Update declarations.  Make
5821         Set_target_once a friend.  Remove lock_ and initialize_lock_
5822         fields.  Add set_target_once_ field.
5823
5824 2010-02-10  Ian Lance Taylor  <iant@google.com>
5825
5826         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5827         queueing any tasks.
5828         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5829         (queue_middle_tasks): Add all blockers before queueing any tasks.
5830         (queue_final_tasks): Likewise.
5831         * token.h (Task_token::add_blockers): New function.
5832         * object.h (Input_objects::number_of_relobjs): New function.
5833
5834 2010-02-10  Ian Lance Taylor  <iant@google.com>
5835
5836         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5837         shared, not if not position independent.
5838         * x86_64.cc (Relocate::relocate_tls): Likewise.
5839         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5840         (tls_pie_pic_test): New target.
5841         * testsuite/Makefile.in: Rebuild.
5842
5843         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5844         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5845         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5846         * testsuite/Makefile.in: Rebuild.
5847
5848 2010-02-09  David S. Miller  <davem@davemloft.net>
5849
5850         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5851         R_SPARC_RELATIVE using ->add_local_relative().
5852         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5853
5854         * output.h (Output_data_dynamic::add_section_size): New method
5855         that takes two Output_data objects.
5856         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5857         entry param.  Handle it in initializers.
5858         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5859         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5860         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5861         arg.
5862         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5863         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5864         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5865         for dynrel_includes_plt.
5866         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5867         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5868         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5869         before .rela.plt
5870         (Target_sparc::do_finalize_sections): Update to pass true for
5871         dynrel_includes_plt.
5872         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5873         output before .rela.plt
5874         (Target_powerpc::do_finalize_sections): Update to pass true for
5875         dynrel_includes_plt when 32-bit.
5876
5877 2010-02-08  Doug Kwan  <dougkwan@google.com>
5878
5879         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5880         method.
5881         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5882         Arm_relobj::scan_section_for_cortex_a8_stubs,
5883         Arm_relobj::do_relocation_section): Instead of calling
5884         Output_section::output_address, use faster
5885         Arm_relobj::simple_input_section_output_address.
5886
5887 2010-02-08  David S. Miller  <davem@davemloft.net>
5888
5889         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5890         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5891         relocation helper function.
5892
5893         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5894         just like R_SPARC_GOT{10,13,22}.
5895         (Target_sparc::Scan::local): Likewise.
5896         (Target_sparc::Relocate:relocate): Likewise.
5897
5898 2010-02-06  Ian Lance Taylor  <iant@google.com>
5899
5900         * configure.ac: Rewrite targetobjs duplicate removal code to use
5901         only shell constructs.
5902         * configure: Rebuild.
5903
5904 2010-02-05  Doug Kwan  <dougkwan@google.com>
5905
5906         PR 11247
5907         * arm.cc (Arm_relobj::section_is_scannable): New method.
5908         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5909         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5910
5911 2010-02-04  Doug Kwan  <dougkwan@google.com>
5912
5913         PR 11247
5914         * arm-reloc-property.cc (cstdio): Include.
5915         * configure.ac (targetobjs): Remove duplicates.
5916         * configure: Regenerate.
5917         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5918         big and little endian version for a given address size.
5919
5920 2010-02-03  Doug Kwan  <dougkwan@google.com>
5921
5922         * arm-reloc-property.cc
5923         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5924         definition.
5925         * arm-reloc-property.h
5926         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5927         New method definition.
5928         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5929         declaration.
5930         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5931         overflow to N.
5932         (GOT_PREL): Change implemented to Y.
5933         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5934         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5935         (Arm_relocate_functions::movw_abs_nc): Remove method.
5936         (Arm_relocate_functions::movt_abs): Ditto.
5937         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5938         (Arm_relocate_functions::thm_movt_abs): Ditto.
5939         (Arm_relocate_functions::movw_rel_nc): Ditto.
5940         (Arm_relocate_functions::movw_rel): Ditto.
5941         (Arm_relocate_functions::movt_rel): Ditto.
5942         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5943         (Arm_relocate_functions:thm_movw_rel): Ditto.
5944         (Arm_relocate_functions:thm_movt_rel): Ditto.
5945         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5946         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5947         New method definitions.
5948         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5949         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5950         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5951         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5952         (Target_arm::Relocate::relocate): Check for non-static or
5953         unimplemented relocation code and exit early.  Change calls to
5954         Target_arm::reloc_uses_thumb_bit and
5955         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5956         instead.  Refactor code to handle similar relocations to increase
5957         code sharing.  Remove check for unsupported relocation code in switch
5958         statement.
5959         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5960         relocation property table to find out size.  Change error message to
5961         print out the name of a relocation code instead of the numeric value.
5962         (Target_arm::scan_reloc_for_stub): Use relocation property table
5963         instead of calling Target_arm::reloc_uses_thumb_bit().
5964
5965 2010-02-02  Doug Kwan  <dougkwan@google.com>
5966
5967         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5968         types of relaxed input section.
5969
5970 2010-02-02  Doug Kwan  <dougkwan@google.com>
5971
5972         * Makefile.am (HFILES): Add arm-reloc-property.h.
5973         (DEFFILES): New.
5974         (TARGETSOURCES): Add arm-reloc-property.cc
5975         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5976         (libgold_a_SOURCES): $(DEFFILES)
5977         * Makefile.in: Regenerate.
5978         * arm-reloc-property.cc: New file.
5979         * arm-reloc-property.h: New file.
5980         * arm-reloc.def: New file.
5981         * arm.cc: Update comments.
5982         (arm-reloc-property.h): New included header.
5983         (arm_reloc_property_table): New global variable.
5984         (Target_arm::do_select_as_default_target): New method definition.
5985         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5986         arm-reloc-property to targ_extra_obj.
5987         * parameters.cc (set_parameters_target): Call
5988         Target::select_as_default_target().
5989         * target.h (Target::select_as_default_target): New method definition.
5990         (Target::do_select_as_default_target): Same.
5991
5992 2010-02-01  Doug Kwan  <dougkwan@google.com>
5993
5994         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5995         first_output_text_section_.
5996         (Arm_exidx_fixup::first_output_text_section): New method definition.
5997         (Arm_exidx_fixup::first_output_text_section_): New data member.
5998         (Arm_exidx_fixup::process_exidx_section): Record the first text
5999         output section seen.
6000         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6001         and entsize in output section header.
6002
6003 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6004
6005         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6006         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6007         (Arm_relocate_functions::thm_alu11): New Method.
6008         (Arm_relocate_functions::thm_pc8): New Method.
6009         (Arm_relocate_functions::thm_pc12): New Method.
6010         (Target_arm::Scan::local): Handle the relocations.
6011         (Target_arm::Scan::global): Likewise.
6012         (Target_arm::Relocate::relocate): Likewise.
6013         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6014
6015 2010-01-29  Doug Kwan  <dougkwan@google.com>
6016
6017         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6018         of relocation types as ld.
6019
6020 2010-01-29  Doug Kwan  <dougkwan@google.com>
6021
6022         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6023         to public.
6024         (Arm_relocate_functions::thumb_branch_common): Ditto.
6025         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6026         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6027         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6028         Arm_relocate_functions::jump24): Remove.
6029         (Target_arm::Relocate::relocate): Adjust code to call
6030         Arm_relocation_functions::arm_branch_common and
6031         Arm_relocation_functions::thumb_branch_common instead of their removed
6032         wrappers.  Merge switch-cases together to reduce source code size.
6033
6034 2010-01-29  Doug Kwan  <dougkwan@google.com>
6035
6036         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6037         output_local_symbol_count_needs_update_.
6038         (Arm_relobj::output_local_symbol_count_needs_update,
6039          Arm_relobj::set_output_local_symbol_count_needs_update,
6040          Arm_relobj::update_output_local_symbol_count): New methods.
6041         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6042         member.
6043         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6044         of pointed function as in a R_ARM_PREL31 relocation.
6045         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6046         for output local symbol count updating.
6047         (Target_arm::do_relax): Update output local symbol counts in objects
6048         if necessary.
6049         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6050
6051 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6052
6053         * arm.cc: Added support for the ARM relocations:
6054         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6055         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6056         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6057         movw_prel_nc).
6058         (Arm_relocate_functions::movw_rel): New method.
6059         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6060         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6061         thm_movw_prel_nc).
6062         (Arm_relocate_functions::thm_movw_rel): New method.
6063         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6064         thm_movt_prel).
6065         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6066         relocations.
6067         (Target_arm::Scan::global): Likewise.
6068         (Target_arm::Relocate::relocate): Likewise.
6069         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6070         Likewise.
6071
6072 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6073
6074         * arm.cc: Added support for ARM group relocations.
6075         (Target_arm::reloc_needs_sym_origin): New method.
6076         (Arm_relocate_functions::calc_grp_kn): New method.
6077         (Arm_relocate_functions::calc_grp_residual): New method.
6078         (Arm_relocate_functions::calc_grp_gn): New method.
6079         (Arm_relocate_functions::arm_grp_alu): New Method.
6080         (Arm_relocate_functions::arm_grp_ldr): New Method.
6081         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6082         (Arm_relocate_functions::arm_grp_ldc): New Method.
6083         (Target_arm::Scan::local): Handle the ARM group relocations.
6084         (Target_arm::Scan::global): Likewise.
6085         (Target_arm::Relocate::relocate): Likewise.
6086         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6087         Likewise.
6088
6089 2010-01-26  Doug Kwan  <dougkwan@google.com>
6090
6091         * arm.cc (set): Include.
6092         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6093         pointer type.
6094         (Arm_output_section::Text_section_list): New type.
6095         (Arm_output_section::append_text_sections_to_list): New method.
6096         (Arm_output_section::fix_exidx_coverage): Ditto.
6097         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6098         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6099         Relobj::set_section_offset() instead of
6100         Sized_relobj::invalidate_section_offset().
6101         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6102         parameter for section headers. Ignore relocation sections for
6103         unallocated sections and EXIDX sections.
6104         (Target_arm::fix_exidx_coverage): New method.
6105         (Target_arm::output_section_address_less_than): New type.
6106         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6107         linked text section instead of the EXIDX section.
6108         (Arm_output_section::create_stub_group): Add an assertion to check
6109         that this is not an EXIDX output section.
6110         (Arm_output_section::append_text_sections_to_list): New method.
6111         (Arm_output_section::fix_exidx_coverage): Ditto.
6112         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6113         Arm_relobj::section_needs_reloc_stub_scanning.
6114         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6115         first pass.
6116         (Target_arm::fix_exidx_coverage): New method.
6117         * object.h (Relobj::set_output_section): New method.
6118         (Sized_relobj::invalidate_section_offset): Remove method.
6119         (Sized_relobj::do_invalidate_section_offset): Remove method.
6120         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6121
6122 2010-01-25  Doug Kwan  <dougkwan@google.com>
6123
6124         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6125         Fix warning due to signed and unsigned comparison on a 32-bit host.
6126
6127 2010-01-22  Doug Kwan  <dougkwan@google.com>
6128
6129         * arm.cc (Target_arm::do_relax): Record an output section for section
6130         offset adjustment it contains any stub table that has changed.
6131         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6132         offsets in an output section if necessary.
6133         * output.cc (Output_section::Output_section): Initialize
6134         section_offsets_need_adjustments_.
6135         (Output_section::add_input_section_for_script): Renamed to
6136         Output_section::add_simple_input_section.
6137         (Output_section::save_states): Add a comment.
6138         (Output_section::discard_states): New method defintion.
6139         (Output_section::adjust_section_offsets): Same.
6140         * output.h (Output_section::add_input_section_for_script): Renamed to
6141         Output_section::add_simple_input_section.
6142         (Output_section::discard_states): New method declaration.
6143         (Output_section::adjust_section_offsets): Same.
6144         (Output_section::section_offsets_need_adjustment,
6145         Output_section::set_section_offsets_need_adjustment): New method
6146         definitions.
6147         (Output_section::section_offsets_need_adjustment_): New data member.
6148         * script-sections.cc
6149         (Output_section_element_input::set_section_address): Adjust code for
6150         renaming of Output_section::add_input_section_for_script.
6151         (Orphan_output_section::set_section_address): Same.
6152
6153 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6154
6155         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6156         Fix_v4bx enum values .
6157         * gold/options.h (General_options): New option definitions.
6158         (General_options::fix_v4bx): New method.
6159         (General_options::Fix_v4bx): New enum.
6160         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6161         (General_options::parse_fix_v4bx_interworking): New method.
6162
6163 2010-01-22  Doug Kwan  <dougkwan@google.com>
6164
6165         * arm.cc (Arm_exidx_fixup): New class.
6166
6167 2010-01-21  Doug Kwan  <dougkwan@google.com>
6168
6169         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6170         classes.
6171         (Arm_exidx_section_offset_map): New type.
6172
6173 2010-01-21  Doug Kwan  <dougkwan@google.com>
6174
6175         * arm.cc (Arm_exidx_input_section): New class.
6176         (Arm_relobj::exidx_input_section_by_link,
6177         Arm_relobj::exidx_input_section_by_shndx,
6178         Arm_relobj::make_exidx_input_section): New methods.
6179         (read_arm_attributes_section): Remove.
6180         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6181         information about them.
6182         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6183         to here.
6184
6185 2010-01-20  Doug Kwan  <dougkwan@google.com>
6186
6187         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6188         Input_section_specifier to Section_id.
6189         (Target_arm::new_arm_input_section: Adjust code for change of key
6190         type.
6191         (Target_arm::find_arm_input_section): Ditto.
6192         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6193         (Section_id): Remove.
6194         (Garbage_collection::Section_id_hash): Remove.
6195         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6196         (Section_id): Remove.
6197         (Icf::Section_id_hash): Remove.
6198         * object.h (Section_id, Const_section_id, Section_id_hash,
6199         Const_section_id_hash): New type definitions.
6200         * output.cc (Output_section::add_relaxed_input_section): Change to
6201         use Const_section_id instead of Input_section_specifier as key type.
6202         (Output_section::add_merge_input_section): Ditto.
6203         (Output_section::build_relaxation_map): Change to use Section_id
6204         instead of Input_section_specifier as key type.
6205         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6206         Ditto.
6207         (Output_section::convert_input_sections_to_relaxed_sections): Change
6208         to use Const_section_id instead of Input_section_specifier as key type.
6209         (Output_section::find_merge_section): Ditto.
6210         (Output_section::find_relaxed_input_section): Ditto.
6211         * output.h (Input_section_specifier): Remove class.
6212         (Output_section::Output_section_data_by_input_section_map): Change
6213         key type to Const_section_id.
6214         (Output_section::Output_relaxed_input_section_by_input_section_map):
6215         Ditto.
6216         (Output_section::Relaxation_map): Change key type to Section_id.
6217
6218 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6219
6220         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6221         (class Arm_v4bx_stub): New class.
6222         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6223         (Stub_factory::make_arm_v4bx_stub): New method.
6224         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6225         (Stub_table::empty): Handle v4bx stubs.
6226         (Stub_table::add_arm_v4bx_stub): New method.
6227         (Stub_table::find_arm_v4bx_stub): New method.
6228         (Arm_relocate_functions::v4bx): New method.
6229         (Target_arm::fix_v4bx): New method.
6230         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6231         (Stub_table::relocate_stubs): Likewise.
6232         (Stub_table::do_write): Likewise.
6233         (Stub_table::update_data_size_and_addralign): Likewise.
6234         (Stub_table::finalize_stubs):  Likewise.
6235         (Target_arm::Scan::local): Likewise.
6236         (Target_arm::Scan::global): Likewise.
6237         (Target_arm::do_finalize_sections): Likewise.
6238         (Target_arm::Relocate::relocate): Likewise.
6239         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6240         Likewise.
6241         (Target_arm::scan_reloc_for_stub): Likewise.
6242         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6243
6244 2010-01-19  Ian Lance Taylor  <iant@google.com>
6245
6246         * output.cc (Output_section_headers::do_sized_write): Write large
6247         segment count to sh_info field.
6248         (Output_file_header::do_sized_write): For large segment count,
6249         write PN_XNUM to e_phnum field.
6250
6251 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6252
6253         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6254         (Arm_relocate_functions::thm_jump8): New function.
6255         (Arm_relocate_functions::thm_jump11): New function.
6256         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6257         R_ARM_THM_JUMP11.
6258         (Target_arm::Scan::global): Likewise.
6259         (Target_arm::Relocate::relocate): Likewise.
6260         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6261         Likewise.
6262
6263 2010-01-14  Doug Kwan  <dougkwan@google.com>
6264
6265         * arm.cc (map, utility): Include headers.
6266         (Target_arm::apply_cortex_a8_workaround): New method.
6267         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6268         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6269         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6270         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6271         the --[no-]fix-cortex-a8 command line options.
6272         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6273         (Target_arm::relocate_stub): Use addend in instruction template.
6274         * options.h (DEFINE_bool): Set the user-set flag.
6275         (General_options): Add --[no-]-fix-cortex options.
6276         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6277         : Update fast look-up map after conversion.
6278
6279 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6280
6281         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6282         in the first pass of do_layout.
6283
6284 2010-01-13  Doug Kwan  <dougkwan@google.com>
6285
6286         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6287         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6288         apparent compiler problem of not folding static constant integral
6289         data members of elfcpp::Elf_sizes<32>.
6290
6291 2010-01-13  Doug Kwan  <dougkwan@google.com>
6292
6293         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6294         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6295         Arm_relobj::scan_section_for_cortex_a8_erratum,
6296         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6297         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6298         sections to scan for relocation stubs into a new method
6299         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6300         relocation and Cortex-A8 stub scanning.
6301         (Target_arm::do_relax): Force stubs to be after stubbed sections
6302         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6303         the beginning of a new relaxation pass.  Update a comment.
6304         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6305
6306 2010-01-12  Ian Lance Taylor  <iant@google.com>
6307
6308         * target-reloc.h (visibility_error): New inline function.
6309         (relocate_section): Call visibility_error.
6310         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6311         (MOSTLYCLEANFILES): Likewise.
6312         (protected_4_pic.o, protected_3.err): New targets.
6313         * testsuite/protected_4.cc: New file.
6314
6315 2010-01-12  Doug Kwan  <dougkwan@google.com>
6316
6317         * arm.cc (Cortex_a8_reloc): New class.
6318         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6319         and cortex_a8_relocs_info_.
6320         (Target_arm::fix_cortex_a8): New method definition.
6321         (Target_arm::Cortex_a8_relocs_info): New type.
6322         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6323         New data member declarations.
6324         (Target_arm::scan_reloc_for_stub): Record information about
6325         relocations for THUMB branches that might be exempted from the
6326         Cortex-A8 workaround.
6327         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6328         at the beginning of a relaxation pass.
6329
6330 2010-01-12  Doug Kwan  <dougkwan@google.com>
6331
6332         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6333         (Arm_relobj::Mapping_symbol_position,
6334          Arm_reloj::Mapping_symbol_position_less,
6335          Arm_relobj::Mapping_symbols_info): New types.
6336         (Target_arm::is_mapping_symbol_name): New method definition.
6337         (Arm_relobj::do_count_local_symbols): Save information about mapping
6338         symbols.
6339
6340 2010-01-11  Doug Kwan  <dougkwan@google.com>
6341
6342         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6343         Arm_relocate_functions::thumb32_branch_upper,
6344         Arm_relocate_functions::thumb32_branch_lower,
6345         Arm_relocate_functions::thumb32_cond_branch_offset,
6346         Arm_relocate_functions::thumb32_cond_branch_upper,
6347         Arm_relocate_functions::thumb32_cond_branch_lower,
6348         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6349         branch offset encoding.
6350         (Arm_relocate_functions::thumb_branch_common): Use new branch
6351         offset encoding methods to avoid code duplication.
6352         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6353         (Stub_addend_reader::operator()): Use new branch encoding method
6354         to avoid code duplication.
6355
6356 2010-01-11  Doug Kwan  <dougkwan@google.com>
6357
6358         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6359         (Target_arm::do_finalize_sections): Define special EXIDX section
6360         symbols only if referenced.
6361         * gc.h (Garbage_collection::add_reference): New method.
6362         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6363         code duplication.
6364
6365 2010-01-11  Ian Lance Taylor  <iant@google.com>
6366
6367         * script.cc (Version_script_info::build_expression_list_lookup):
6368         Change complaing about duplicate wildcard match from error to
6369         warning.
6370
6371         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6372         of 2009-12-30.
6373         (Version_script_info::Version_script_info): Initialize globs_,
6374         default_version_, default_is_global_, and exact_.  Don't
6375         initialize globals_ or locals_.
6376         (Version_script_info::build_lookup_tables): Build local symbols
6377         first.
6378         (Version_script_info::unquote): New function.
6379         (Version_script_info::add_exact_match): New function.
6380         (Version_script_info::build_expression_list_lookup): Remove lookup
6381         parameter.  Add is_global parameter.  Change all callers.  Handle
6382         wildcard pattern specially.  Unquote pattern.  Call
6383         add_exact_match.
6384         (Version_script_info::get_name_to_match): New function.
6385         (Version_script_info::get_symbol_version): New function.
6386         (Version_script_info::get_symbol_version_helper): Remove.
6387         (Version_script_info::check_unmatched_names): Call unquote.
6388         * script.h (class Version_script_info): Change get_symbol_version
6389         to be non-inline and add is_global parameter; change all callers.
6390         Rewrite symbol_is_local.  Update declarations.  Define struct
6391         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6392         Remove globals_ and locals_ members.  Add exact_, globs_,
6393         default_version_, is_global_.
6394         (Version_script_info::Glob): Remove pattern, add expression and
6395         is_global.  Update constructor.  Change all callers.
6396         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6397         default version.
6398         (Versions::symbol_section_contents): If a symbol is undefined, or
6399         defined in a dynamic object, set the version index to
6400         VER_NDX_LOCAL.
6401         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6402         symbol_is_local.
6403         (Symbol_table::add_from_pluginobj): Likewise.
6404         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6405
6406 2010-01-11  Doug Kwan  <dougkwan@google.com>
6407
6408         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6409         (incremental_dump_LDADD): Add linking option for libintl.
6410         * Makefile.in: Regenerate.
6411
6412 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6413
6414         PR gold/11144
6415         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6416         instead of -Ds.
6417         * testsuite/Makefile.in: Regenerated.
6418
6419 2010-01-10  Doug Kwan  <dougkwan@google.com>
6420
6421         * options.h (DEFINE_var): Use parentheses around argument varname__
6422         in macro body to avoid any unintended subsequent substitutions.
6423
6424 2010-01-10  Ian Lance Taylor  <iant@google.com>
6425
6426         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6427         candidates before doing symbol resolution.
6428
6429         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6430         ODR candidates if only one is weak.
6431
6432 2010-01-08  Ian Lance Taylor  <iant@google.com>
6433
6434         * script.cc (Version_script_info::build_expression_list_lookup):
6435         Don't warn about ambiguous version, just record the ambiguity.
6436         (Version_script_info::get_symbol_version_helper): Give error if
6437         version is ambiguous.
6438
6439 2010-01-08  Doug Kwan  <dougkwan@google.com>
6440
6441         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6442           prev_data_size_ and prev_addralign_.  Remove initializer for
6443           deleted data member has_been_changed_.
6444           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6445           to determine if the table is empty.
6446           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6447           Remove.
6448           (Stub_table::add_reloc_stub): Define method in class definition
6449           instead of just declaring it there.
6450           (Stub_table::add_cortex_a8_stub): New method definition.
6451           (Stub_table::update_data_size_and_addralign): Ditto.
6452           (Stub_table::finalize_stubs): Ditto.
6453           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6454           (Stub_table::do_addralign_): Return address alignment in the
6455           (Stub_table::do_reset_address_and_file_offset): Define method in
6456           class definition instead of declaring it there.  Set current data
6457           size to be the data size of the previous pass.
6458           (Stub_table::set_final_data_size): Use current data size as the
6459           final data size.
6460           (Stub_table::relocate_stub): Change parameter type of stub from
6461           Reloc_stub pointer to Stub pointer.
6462           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6463           (Stub_table::Cortex_a8_stub_list): New typedef.
6464           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6465            Stub_table::prev_addralign_): New data member.
6466           (Arm_relobj::Arm_relobj): Initialize data member
6467           section_has_cortex_a8_workaround_.
6468           (Arm_relobj::section_has_cortex_a8_workaround,
6469            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6470            definitions.
6471           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6472           declarations.
6473           (Target_arm::relocate_stub): Change parameter type of stub from
6474           Reloc_stub pointer to Stub pointer.
6475           (Insn_template::size, Insn_template::alignment): Handle
6476           THUMB16_SPECIAL_TYPE.
6477           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6478            Stub_table::update_data_size_and_addralign,
6479            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6480           definitions.
6481           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6482           (Stub_table::do_write): Ditto.
6483           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6484
6485 2010-01-08  Ian Lance Taylor  <iant@google.com>
6486
6487         PR 11108
6488         * symtab.h (class Symbol): Remove fields is_target_special_ and
6489         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6490         (Symbol::is_defined_in_discarded_section): New function.
6491         (Symbol::set_is_defined_in_discarded_section): New function.
6492         (Symbol::has_plt_offset): Rewrite.
6493         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6494         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6495         Don't initialize is_target_special_ or has_plt_offset_.
6496         Initialize is_defined_in_discarded_section_.
6497         (Symbol_table::add_from_relobj): If appropriate, set
6498         is_defined_in_discarded_section.
6499         * resolve.cc (Symbol::override_base_with_special): Don't test
6500         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6501         * target-reloc.h (relocate_section): Do special handling for
6502         symbols defined in discarded sections for global symbols as well
6503         as local symbols.
6504
6505 2010-01-08  Ian Lance Taylor  <iant@google.com>
6506
6507         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6508         the SHT_SYMTAB case.
6509
6510 2010-01-08  Ian Lance Taylor  <iant@google.com>
6511
6512         * object.cc (Sized_relobj::do_layout): Don't get confused if
6513         layout_eh_frame returns NULL.
6514
6515 2010-01-08  Ian Lance Taylor  <iant@google.com>
6516
6517         PR 11084
6518         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6519         dynamic symbol table, use the normal symbol table.
6520         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6521         symbol table.
6522
6523 2010-01-08  Ian Lance Taylor  <iant@google.com>
6524
6525         PR 11072
6526         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6527         sections.
6528
6529 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6530
6531         * version.cc (print_version): Change to "Copyright 2010".
6532
6533 2010-01-08  Ian Lance Taylor  <iant@google.com>
6534
6535         PR 10287
6536         PR 11063
6537         * i386.cc (class Target_i386): Change return type of plt_section
6538         to be non-const.
6539         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6540         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6541         tls_desc_rel_ field.
6542         (Output_data_plt_i386::rel_tls_desc): New function.
6543         (Target_i386::rel_tls_desc_section): New function.
6544         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6545         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6546         R_386_TLS_DESC reloc in rel_tls_desc_section.
6547         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6548         Define struct Tlsdesc_info.
6549         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6550         (Target_x86_64::do_reloc_symbol_index): New function.
6551         (Target_x86_64::add_tlsdesc_info): New function.
6552         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6553         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6554         tlsdesc_rel_ field.
6555         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6556         all callers.
6557         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6558         (Target_x86_64::rela_tlsdesc_section): New function.
6559         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6560         handling.
6561         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6562         (Target_x86_64::do_reloc_addend): New function.
6563         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6564         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6565         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6566         (Output_reloc::type): New function.
6567         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6568         (Output_reloc::is_target_specific): New function.
6569         (Output_reloc::target_arg): New function.
6570         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6571         absolute relocs and target specific relocs.
6572         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6573         add_target_specific.
6574         (class Output_data_reloc) [SHT_RELA]: Likewise.
6575         * output.cc (Output_reloc::Output_reloc): Add four new versions
6576         for absolute relocs and target specific relocs.
6577         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6578         (Output_reloc::get_symbol_index): Likewise.
6579         (Output_reloc::local_section_offset): Check that local_sym_index_
6580         is not TARGET_CODE or 0.
6581         (Output_reloc::symbol_value): Likewise.
6582         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6583         reloc.
6584         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6585         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6586         functions.
6587         * layout.cc (add_target_dynamic_tags): Use output section for
6588         DT_PLTRELSZ and DT_JMPREL.
6589
6590 2010-01-07  Ian Lance Taylor  <iant@google.com>
6591
6592         PR 11061
6593         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6594         function.
6595         (class Output_data_reloc_generic): Define.
6596         (class Output_data_reloc_base): Change base class to
6597         Output_data_reloc_generic.  Change add() method to call
6598         bump_relative_reloc_count for a relative reloc.  Remove
6599         sort_relocs_ field.
6600         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6601         to sort_relocs().
6602         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6603         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6604         appropriate.
6605         * layout.h (class Layout): Update declaration.
6606
6607 2010-01-07  Ian Lance Taylor  <iant@google.com>
6608
6609         * output.h (class Output_data): Add const version of
6610         output_section and do_output_section.
6611         (class Output_section_data): Add const version of
6612         do_output_section.
6613         (class Output_section): Likewise.
6614         * layout.cc (Layout::add_target_dynamic_tags): New function.
6615         * layout.h (class Layout): Update declarations.
6616         * arm.cc (Target_arm::do_finalize_sections): Use
6617         add_target_dynamic_tags.
6618         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6619         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6620         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6621         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6622
6623 2010-01-07  Ian Lance Taylor  <iant@google.com>
6624
6625         PR 11042
6626         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6627         object as needed.
6628
6629 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6630             Ian Lance Taylor  <iant@google.com>
6631
6632         PR 11019
6633         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6634         Xindex::read_symtab_xindex.
6635
6636 2010-01-07  Doug Kwan  <dougkwan@google.com>
6637
6638         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6639         (Insn_template::thumb16_bcond_insn): New method declaration.
6640         (Insn_template): Fix spelling.
6641         (Stub::thumb16_special): New method declaration.
6642         (Stub::do_write): Define virtual method which was previously pure
6643         virtual.
6644         (Stub::do_thumb16_special): New method declaration.
6645         (Stub::do_fixed_endian_write): New template member.
6646         (Reloc_stub::do_write): Remove.
6647         (Reloc_stub::do_fixed_endian_write): Remove.
6648         (Cortex_a8_stub): New class definition.
6649         (Stub_factory::make_cortex_a8_stub): New method definition.
6650         (Stub_factory::Stub_factory): Add missing static storage class
6651         qualifier for elf32_arm_stub_a8_veneer_blx.
6652
6653 2010-01-07  Ian Lance Taylor  <iant@google.com>
6654
6655         PR 10980
6656         * options.h (class General_options): Add --warn-unresolved-symbols
6657         and --error-unresolved-symbols.
6658         * errors.cc (Errors::undefined_symbol): Implement
6659         --warn-unresolved-symbols.
6660
6661         * options.h (class General_options): Add -z text and -z textoff.
6662         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6663
6664 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6665
6666         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6667         (Garbage_collection::cident_sections): New function.
6668         (Garbage_collection::add_cident_section): New function.
6669         (Garbage_collection::cident_sections_): New member.
6670         (gc_process_relocs): Add references to sections whose names are C
6671         identifiers.
6672         * gold.h (cident_section_start_prefix): New constant.
6673         (cident_section_stop_prefix): New constant.
6674         (is_cident): New function.
6675         * layout.cc (Layout::define_section_symbols): Replace string constants
6676         with the newly defined constants.
6677         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6678         C identifiers.
6679         * testsuite/Makefile.am: Add gc_orphan_section_test.
6680         * testsuite/Makefile.in: Regenerate.
6681         * testsuite/gc_orphan_section_test.cc: New file.
6682         * testsuite/gc_orphan_section_test.sh: New file.
6683
6684 2010-01-06  Ian Lance Taylor  <iant@google.com>
6685
6686         PR 10980
6687         * options.h (class General_options): Add --warn-shared-textrel.
6688         * layout.cc (Layout::finish_dynamic_section): Implement
6689         --warn-shared-textrel.
6690
6691         PR 10980
6692         * options.h (class General_options): Add --warn-multiple-gp.
6693
6694 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6695
6696         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6697         $(THREADSLIB) and $(LIBDL).
6698         * Makefile.in: Rebuild.
6699
6700 2010-01-06  Ian Lance Taylor  <iant@google.com>
6701
6702         PR 10980
6703         * options.cc (General_options::parse_section_start): New function.
6704         (General_options::section_start): New function.
6705         (General_options::General_options): Initialize all members.
6706         * options.h: Include <map>
6707         (class General_options): Add --section-start.  Add section_starts_
6708         member.
6709         * layout.cc (Layout::attach_allocated_section_to_segment): If
6710         --section-start was used, set the address of the segment.  Remove
6711         local sort_sections.
6712         (Layout::relaxation_loop_body): If the address of the load segment
6713         has been set by --section-start, don't use it.
6714         * output.h (Output_segment::update_flags_for_output_section): New
6715         function.
6716         * output.cc (Output_segment::add_output_section): Call
6717         update_flags_for_output_section.
6718
6719 2010-01-05  Ian Lance Taylor  <iant@google.com>
6720
6721         PR 10980
6722         * options.h (class General_options): Add --undefined-version.
6723         * script.cc (struct Version_expression): Add was_matched_by_symbol
6724         field.
6725         (Version_script_info::matched_symbol): New function.
6726         (Version_script_info::get_symbol_version_helper): Call
6727         matched_symbol.
6728         (Version_script_info::check_unmatched_names): New function.
6729         * script.h (class Version_script_info): Update declarations.
6730         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6731
6732         * options.h (class General_options): Use DEFINE_bool_alias for
6733         allow_multiple_definition.
6734         * resolve.cc (Symbol_table::should_override): Don't test
6735         allow_multiple_definition.
6736
6737         PR 10980
6738         * options.h (class General_options): Add --cref.
6739         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6740         until after printing cref table.
6741         * cref.cc: Include "symtab.h".
6742         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6743         (Cref_table_compare::operator()): New function.
6744         (Cref_inputs::gather_cref): New function.
6745         (filecol): New static const.
6746         (Cref_inputs::print_cref): New function.
6747         (Cref::print_cref): New function.
6748         * cref.h: Include <cstdio>.
6749         (class Cref): Update declarations.
6750         * mapfile.h (Mapfile::file): New function.
6751         * object.h (class Object): Define Symbols.  Declare virtual
6752         do_get_global_symbols.
6753         (Object::get_global_symbols): New function.
6754         * object.cc (Input_objects::add_object): Pass object to cref_ if
6755         --cref.
6756         (Input_objects::archive_start): Likewise.
6757         (Input_objects::archive_stop): Likewise.
6758         (Input_objects::print_cref): New function.
6759         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6760         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6761         --cref.
6762         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6763         function.
6764         * plugin.h (class Sized_pluginobj): Update declarations.
6765
6766 2010-01-05  Ian Lance Taylor  <iant@google.com>
6767
6768         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6769         to is_default_version.  Rename insdef to insdefault.
6770         (Symbol_table::add_from_relobj): Rename def to is_default_version
6771         and local to is_forced_local.
6772         (Symbol_table::add_from_pluginobj): Likewise.
6773         (Symbol_table::add_from_dynobj): Likewise.
6774         (Symbol_table::define_special_symbol): Rename insdef to
6775         insdefault.
6776
6777 2010-01-04  Ian Lance Taylor  <iant@google.com>
6778
6779         PR 10980
6780         * options.h (class General_options): Add
6781         --allow-multiple-definition and -z muldefs.
6782         * resolve.cc (Symbol_table::should_override): Don't warn about a
6783         multiple symbol definition if --allow-multiple-definition or -z
6784         muldefs.
6785
6786         PR 10980
6787         * options.h (class General_options): Add --add-needed and
6788         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6789         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6790         error if --copy-dt-needed-entries aka --add-needed is used and
6791         would cause a change in behaviour.
6792
6793         PR 10980
6794         * options.h (class General_options): Add -G as a short version of
6795         --shared.  Add no-op options -assert, -g, and -i.
6796
6797 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6798
6799         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6800         check for .text or .gnu.linkonce.t sections.
6801         * icf.cc (Icf::find_identical_sections): Ditto.
6802         Change the detection for mangled function name within the section
6803         name.
6804         * icf.h (is_section_foldable_candidate): New function.
6805
6806 2009-12-30  Ian Lance Taylor  <iant@google.com>
6807
6808         PR 10980
6809         * options.h (class General_options): Permit two dashes with
6810         --retain-symbols-file.
6811
6812 2009-12-30  Ian Lance Taylor  <iant@google.com>
6813
6814         PR 10979
6815         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6816         don't put the file header and segment headers in the text
6817         segment.
6818
6819         PR 10979
6820         * common.cc (Sort_commons::operator()): Stabilize sort when both
6821         entries are NULL.
6822         (Symbol_table::do_allocate_commons_list): When allocating common
6823         symbols, skip a symbol which is no longer common.
6824         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6825         an object before checking its type.
6826         * testsuite/common_test_2.c: New file.
6827         * testsuite/common_test_3.c: New file.
6828         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6829         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6830         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6831         (common_test_2_pic.o, common_test_2.so): New targets.
6832         (common_test_3_pic.o, common_test_3.so): New targets.
6833         * testsuite/Makefile.in: Rebuild.
6834
6835         PR 10979
6836         * script.cc (read_input_script): If we see a new SECTIONS clause,
6837         and we have added an input section, give an error.
6838         * layout.h (class Layout): Add have_added_input_section function.
6839         Add have_added_input_section_ field.
6840         * layout.cc (Layout::Layout): Initialize
6841         have_added_input_section_.
6842         (Layout::layout): Set have_added_input_section_.
6843         (Layout::layout_eh_frame): Likewise.
6844
6845 2009-12-30  Ian Lance Taylor  <iant@google.com>
6846
6847         PR 10931
6848         * options.h (class General_options): Add --sort-common option.
6849         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6850         * common.cc (Sort_common): Add sort_order parameter to
6851         constructor.  Add sort_order_ field.
6852         (Sort_commons::operator): Check sort_order_.
6853         (Symbol_table::allocate_commons): Determine the sort order.
6854         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6855         Change all callers.
6856         (Symbol_table::do_allocate_commons_list): Likewise.
6857
6858 2009-12-30  Ian Lance Taylor  <iant@google.com>
6859
6860         PR 10916
6861         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6862         symbols from this object, don't change the visibility of an
6863         undefined symbol.
6864         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6865
6866 2009-12-30  Ian Lance Taylor  <iant@google.com>
6867
6868         PR 10861
6869         * script.h (class Version_script_info): Define Language enum.
6870         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6871         new fields globals_, locals_, and is_finalized_.
6872         * script.cc: Various formatting fixes.
6873         (class Parser_closure): Change language_stack_ from a vector of
6874         std::string to one of Version_script_info::Language.  Adjust all
6875         uses accordingly.
6876         (class Lazy_demangler): Remove.
6877         (struct Version_expression): Change language from std::string to
6878         Version_script_info::Language.
6879         (Version_script_info::Version_script_info): New function.
6880         (Version_script_info::~Version_script_info): Don't call clear.
6881         (Version_script_info::finalize): New function.
6882         (Version_script_info::build_lookup_tables): New function.
6883         (Version_script_info::build_expression_list_lookup): New
6884         function.
6885         (Version_script_info::get_symbol_version_helper): Rewrite to use
6886         lookup tables.
6887         (Version_script_info::print_expression_list): Adjust to use
6888         Version_script_info::Language.
6889         (script_push_lex_into_version_mode): Check that the version script
6890         has not been finalized.
6891         (version_script_push_lang): Change language string to
6892         Version_script_info::Language.
6893         * options.cc (Command_line::version_script): New function.
6894         * options.h (class General_options): Add finalize_dynamic_list
6895         function.  Change version_script from declaration to definition.
6896         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6897         * testsuite/version_script.map: Remove duplicate def of foo.
6898         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6899         version_script.map.
6900         * testsuite/Makefile.in: Rebuild.
6901
6902 2009-12-30  Ian Lance Taylor  <iant@google.com>
6903
6904         PR 10843
6905         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6906         if the input symbol index is 0, make the output symbol index 0.
6907
6908 2009-12-30  Ian Lance Taylor  <iant@google.com>
6909
6910         PR 10670
6911         * options.h (class General_options): Add -x/--discard-all.
6912         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6913         --discard-all.  If the local symbol needs a dynamic entry, check
6914         that before handling --discard-locals.
6915
6916 2009-12-30  Ian Lance Taylor  <iant@google.com>
6917
6918         PR 10450
6919         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6920         flags to PF_R.
6921         (Output_segment::add_output_section): Don't change the flags if
6922         the type is PT_TLS.
6923
6924         PR 10450
6925         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6926         GNU hash table if they need a dynamic value.  Otherwise, don't add
6927         them if they are defined in a dynamic object or are forced local.
6928
6929 2009-12-29  Ian Lance Taylor  <iant@google.com>
6930
6931         PR 10450
6932         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6933         .gnu.hash table for a 32-bit target.
6934
6935         PR 10450
6936         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6937         regular and a dynamic object only needs a dynamic symbol table
6938         entry if it is externally visible.
6939
6940         PR 10450
6941         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6942         constructor.  Add global_offset_table_ field.
6943         (Target_i386::got_section): Set global_offset_table_.
6944         (Target_i386::do_finalize_sections): Set global_offset_table_
6945         size.
6946         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6947         in constructor.  Add global_offset_table_ field.
6948         (Target_x86_64::got_section): Set global_offset_table_.
6949         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6950         size.
6951
6952         * layout.cc (Layout::Layout): Initialize increase_relro_.
6953         (Layout::get_output_section): Add is_relro, is_last_relro, and
6954         is_first_non_relro parameters.  Change all callers.
6955         (Layout::choose_output_section): Likewise.
6956         (Layout::add_output_section_data): Likewise.
6957         (Layout::make_output_section): Likewise.
6958         (Layout::set_segment_offsets): Clear increase_relro when using a
6959         linker script.
6960         * layout.h (class Layout): Add increase_relro method.  Add
6961         increase_relro_ field.  Update declarations.
6962         * output.cc (Output_section::Output_section): Initialize
6963         is_last_relro_ and is_first_non_relro_.
6964         (Output_segment::add_output_section): Group relro sections is
6965         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6966         (Output_segment::maximum_alignment): Remove relro handling.
6967         (Output_segment::set_section_addresses): Add increase_relro
6968         parameter.  Change all callers.  Add initial alignment to align
6969         relro sections on separate page.  Remove old relro handling.
6970         (Output_segment::set_section_list_addresses): Remove in_relro
6971         parameter.  Change all callers.
6972         (Output_segment::set_offset): Add increase parameter.  Change all
6973         callers.  Remove old relro handling.
6974         * output.h (class Output_section): Add new methods: is_last_relro,
6975         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6976         Add is_last_relro_ and is_first_non_relro_ fields.
6977         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6978         Create separate .got.plt section.  Call increase_relro.
6979         * x86_64.cc (Target_x86_64::got_section): Likewise.
6980         * testsuite/relro_script_test.t: Add .got.plt.
6981
6982         PR 10450
6983         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6984         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6985         (Layout::finalize): Call set_dynamic_symbol_size.
6986         (Layout::set_dynamic_symbol_size): New function.
6987         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6988         set_dynamic_symbol_size.
6989
6990         PR 10450
6991         * output.h (class Output_section): Add is_entsize_zero_ field.
6992         * output.cc (Output_section::Output_section): Initialize
6993         is_entsize_zero_.
6994         (Output_section::set_entsize): If two different entsizes are
6995         requested, force it to zero.
6996         (Output_section::add_input_section): Set flags for .debug_str
6997         before updating section flags.  Set entsize.
6998         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6999         and SHF_STRING if all input sections have those flags.
7000
7001 2009-12-29   Rafael Espindola  <espindola@google.com>
7002
7003         * main.cc (main): Fix the sys time reporting.
7004         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7005         reporting.
7006
7007 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7008
7009         * options.cc (General_options::parse_version): Allow -v to exit
7010         without an error if there is nothing to link.
7011
7012 2009-12-29  Ian Lance Taylor  <iant@google.com>
7013
7014         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7015         using a version of gcc before 4.1.
7016         * configure: Rebuild.
7017
7018 2009-12-28  Chris Demetriou  <cgd@google.com>
7019
7020         * attributes.cc (Output_attributes_section_data::do_write): Use
7021         std::vector::front rather than std::vector::data.
7022
7023 2009-12-28  Ian Lance Taylor  <iant@google.com>
7024
7025         * symtab.h (class Symbol_table): Add enum Defined.
7026         * resolve.cc (Symbol_table::should_override): Add defined
7027         parameter.  Change all callers.  Test whether object is NULL
7028         before calling a method on it.
7029         (Symbol_table::report_resolve_problem): Add defined parameter.
7030         Change all callers.
7031         (Symbol_table::should_override_with_special): Likewise.
7032         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7033         parameter.  Change all callers.
7034         (Symbol_table::do_define_in_output_data): Likewise.
7035         (Symbol_table::define_in_output_segment): Likewise.
7036         (Symbol_table::do_define_in_output_segment): Likewise.
7037         (Symbol_table::define_as_constant): Likewise.
7038         (Symbol_table::do_define_as_constant): Likewise.
7039         * script.h (class Symbol_assignment): Add is_defsym parameter to
7040         constructor; change all callers.
7041         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7042         parameter.  Change all callers.  Add is_defsym_ field.
7043         (class Parser_closure): Add parsing_defsym parameter to
7044         constructor; change all callers.  Add parsing_defsym accessor
7045         function.  Add parsing_defsym_ field.
7046
7047 2009-12-28  Ian Lance Taylor  <iant@google.com>
7048
7049         * gold.cc (queue_middle_tasks): Fix formatting.
7050         * object.cc (Relobj::is_section_name_included): Likewise.
7051
7052 2009-12-23  Ian Lance Taylor  <iant@google.com>
7053
7054         * i386.cc (Target_i386::do_calls_non_split): Recognize
7055         -fsplit-stack prologue for a function with a static chain.
7056         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7057         -fsplit-stack prologue when using %r11.
7058
7059 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7060
7061         * options.cc (General_options::parse_version): Make -v continue and do
7062         the link like GNU ld does.
7063
7064 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7065
7066         * Makefile.am (CCFILES): Add timer.cc.
7067         (HFILES): Add timer.h.
7068         * configure.ac: Check for sysconf and times.
7069         * main.cc: include timer.h.
7070         (main): Use Timer instead of get_run_time.
7071         * timer.cc: New.
7072         * timer.h: New.
7073         * workqueue.cc: include timer.h.
7074         (Workqueue::find_and_run_task):
7075         Report user, sys and wall time.
7076         * Makefile.in: Regenerate.
7077         * config.in: Regenerate.
7078         * configure: Regenerate.
7079
7080 2009-12-16  Doug Kwan  <dougkwan@google.com>
7081
7082         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7083         sections.
7084         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7085         relaxed input sections.
7086         * output.cc (Output_section::find_relaxed_input_section): Change
7087         return type to Output_relaxed_input_section pointer.  Adjust code
7088         for new type of relaxed_input_section_map_.
7089         * output.h (Output_section::find_relaxed_input_section): Change
7090         return type to Output_relaxed_input_section pointer.
7091         (Output_section::Output_relaxed_input_section_by_input_section_map):
7092         New type.
7093         (Output_section::relaxed_input_section_map_): Change type to
7094         Output_section::Output_relaxed_input_section_by_input_section_map.
7095         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7096         input section.
7097
7098 2009-12-15  Ian Lance Taylor  <iant@google.com>
7099
7100         * layout.cc (Layout::create_shstrtab): Only write out after input
7101         sections if we are compressing debug sections.
7102
7103 2009-12-15  Ian Lance Taylor  <iant@google.com>
7104
7105         * archive.cc (Archive::add_symbols): Only look up a symbol without
7106         a version if there is, in fact, a version.
7107
7108 2009-12-14  Ian Lance Taylor  <iant@google.com>
7109
7110         Revert -Wshadow changes, all changes from:
7111         2009-12-11  Doug Kwan  <dougkwan@google.com>
7112         2009-12-11  Nick Clifton  <nickc@redhat.com>
7113         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7114
7115 2009-12-11  Doug Kwan  <dougkwan@google.com>
7116
7117         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7118         due to -Wshadow.
7119         * attributes.cc (Object_attribute::size): Ditto.
7120         (Attributes_section_data::size): Ditto.
7121         (Attributes_section_data::Attributes_section_data): Ditto.
7122         (Output_attributes_section_data::do_write): Ditto.
7123         * attributes.h (Object_attribute::set_type): Ditto.
7124         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7125
7126 2009-12-11  Nick Clifton  <nickc@redhat.com>
7127
7128         * archive.cc: Fix shadowed variable warnings.
7129         * arm.cc: Likewise.
7130         * compressed_output.cc: Likewise.
7131         * compressed_output.h: Likewise.
7132         * configure: Likewise.
7133         * dwarf_reader.cc: Likewise.
7134         * dynobj.cc: Likewise.
7135         * dynobj.h: Likewise.
7136         * ehframe.cc: Likewise.
7137         * ehframe.h: Likewise.
7138         * errors.cc: Likewise.
7139         * expression.cc: Likewise.
7140         * fileread.cc: Likewise.
7141         * fileread.h: Likewise.
7142         * freebsd.h: Likewise.
7143         * i386.cc: Likewise.
7144         * icf.cc: Likewise.
7145         * incremental.h: Likewise.
7146         * layout.cc: Likewise.
7147         * layout.h: Likewise.
7148         * mapfile.cc: Likewise.
7149         * merge.cc: Likewise.
7150         * merge.h: Likewise.
7151         * object.cc: Likewise.
7152         * object.h: Likewise.
7153         * options.h: Likewise.
7154         * output.cc: Likewise.
7155         * output.h: Likewise.
7156         * parameters.cc: Likewise.
7157         * plugin.cc: Likewise.
7158         * powerpc.cc: Likewise.
7159         * reduced_debug_output.cc: Likewise.
7160         * reduced_debug_output.h: Likewise.
7161         * reloc.cc: Likewise.
7162         * reloc.h: Likewise.
7163         * resolve.cc: Likewise.
7164         * script-sections.cc: Likewise.
7165         * script.cc: Likewise.
7166         * script.h: Likewise.
7167         * sparc.cc: Likewise.
7168         * symtab.cc: Likewise.
7169         * symtab.h: Likewise.
7170         * target-select.cc: Likewise.
7171         * target-select.h: Likewise.
7172         * token.h: Likewise.
7173         * workqueue.cc: Likewise.
7174         * workqueue.h: Likewise.
7175         * x86_64.cc: Likewise.
7176
7177 2009-12-10  Doug Kwan  <dougkwan@google.com>
7178
7179         * arm.cc (attributes.h): New include.
7180         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7181         (Arm_relobj::~Arm_relobj): Delete object pointed by
7182         attributes_section_data_.
7183         (Arm_relobj::attributes_section_data): New method definition.
7184         (Arm_relobj::attributes_section_data_): New data member declaration.
7185         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7186         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7187         attributes_section_data_.
7188         (Arm_dynobj::attributes_section_data): New method definition.
7189         (Arm_dynobj::attributes_section_data_): New data member declaration.
7190         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7191         initialization value of may_use_blx_ to false.
7192         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7193         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7194         object attributes to compute results instead of hard-coding.
7195         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7196         Target_arm::get_secondary_compatible_arch,
7197         Target_arm::set_secondary_compatible_arch
7198         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7199         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7200         New method declarations.
7201         (Target_arm::get_aeabi_object_attribute): New method definition.
7202         (Target_arm::attributes_section_data_): New data member declaration.
7203         (read_arm_attributes_section): New template definition.
7204         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7205         (Arm_dynobj::do_read_symbols): Ditto.
7206         (Target_arm::do_finalize_sections): Merge attributes sections from
7207         input.  Check for BLX use after attributes section merging.
7208         Fix __exidx_start and __exidx_end visibility.  Create an
7209         .ARM.attributes section if necessary.
7210         (Target_arm::get_secondary_compatible_arch,
7211         Target_arm::set_secondary_compatible_arch,
7212         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7213         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7214         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7215         New method definitions.
7216
7217 2009-12-09  Ian Lance Taylor  <iant@google.com>
7218
7219         * plugin.cc (Plugin::load): Don't cast from void* to a function
7220         pointer.
7221
7222 2009-12-09  Ian Lance Taylor  <iant@google.com>
7223
7224         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7225         information fields.
7226
7227 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7228
7229         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7230         Replace two_file_shared_1.so with two_file_shared_2.so.
7231         * testsuite/Makefile.in: Regenerated.
7232
7233 2009-12-08  Doug Kwan  <dougkwan@google.com>
7234
7235         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7236         (HFILES): Add attributes.h and int_encoding.h.
7237         * Makefile.in: Regenerate.
7238         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7239         function definitions to int_encoding.cc
7240         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7241         prototypes to int_encoding.h
7242         * reduced_debug_output.cc (int_encoding.h): New include.
7243         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7244         function definitions to int_encoding.cc
7245         (insert_into_vector, read_from_pointer): Move template definitions to
7246         int_encoding.h
7247         * attributes.cc: New file.
7248         * attributes.h: New file.
7249         * int_encoding.cc: New file.
7250         * int_encoding.h: New file.
7251
7252 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7253
7254         PR gold/11055
7255         * incremental-dump.cc (dump_incremental_inputs): New.
7256         (main): Use dump_incremental_inputs.
7257
7258 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7259
7260         PR gold/10893
7261         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7262         checking elfcpp::STT_FUNC.
7263         (Target_i386::Relocate::relocate): Likewise.
7264         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7265
7266         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7267         symbols from shared libraries into normal FUNC symbols.
7268
7269         * symtab.h (Symbol): Add is_func and use it.
7270
7271 2009-12-05  Doug Kwan  <dougkwan@google.com>
7272
7273         * arm.cc (Target_arm::arm_info): Initialize new fields
7274         attributes_section and attributes_vendor.
7275         * i386.cc (Target_i386::i386_info): Same.
7276         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7277         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7278         fields attributes_section and attributes_vendor.
7279         * sparc.cc (Target_sparc::sparc_info): Same.
7280         * target.h (Target::attributes_section, Target::attributes_vendor,
7281         Target::is_attributes_section, Target::attribute_arg_type,
7282         Target::attributes_order): New method definitions.
7283         (Target::Target_info::attributes_section,
7284         Target::Target_info::attributes_vendor): New fields.
7285         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7286         virtual method definitions.
7287         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7288         attributes_section and attributes_vendor.
7289         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7290
7291 2009-12-05  Doug Kwan  <dougkwan@google.com>
7292
7293         * arm.cc: Update comments about interworking and stub generation.
7294         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7295         considered as non-PIC.
7296         (Arm_relocate_functions::base_abs): Fix formatting.
7297         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7298         of function to use GOT entry address instead of offset.
7299         (Target_arm::Scan::global): Issue an error if a symbol would need a
7300         PLT does not get one because it is untyped.  Remove code to create
7301         dynamic symbols for relative branches.
7302         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7303         takes unsigned integer instead of boolean.
7304
7305 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7306
7307         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7308         (two_file_test_LDADD): Likewise.
7309         (common_test_1_LDADD): Likewise.
7310         (exception_test_LDADD) Likewise.
7311         (weak_test_LDADD): Likewise.
7312         (many_sections_test_LDADD): Likewise.
7313         (initpri1_LDADD): Likewise.
7314         (script_test_1_LDADD): Likewise.
7315         (script_test_2_LDADD): Likewise.
7316         (justsyms_LDADD): Likewise.
7317         (binary_test_LDADD): Likewise.
7318         (large_LDADD): Likewise.
7319         * testsuite/Makefile.in: Regenerated.
7320
7321 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7322
7323         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7324         (Symbol_table::override_with_special): Likewise.
7325         (Symbol_table::add_from_object): Likewise.
7326
7327 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7328
7329         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7330         Don't set the data_offset twice.
7331
7332 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7333
7334         * testsuite/Makefile.in: Regenerate.
7335
7336 2009-12-03  Doug Kwan  <dougkwan@google.com>
7337
7338         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7339         (Target_arm::do_finalize_sections): Add parameter for symbol table
7340         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7341         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7342         parameter for symbol table pointer.
7343         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7344         an additional parameter for a pointer to symbol table.
7345         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7346         parameter for a symbol table pointer.
7347         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7348         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7349         Ditto.
7350         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7351         parameter for a symbol table pointer.
7352
7353 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7354
7355         * incremental.cc (Incremental_inputs_header)
7356         (Incremental_inputs_header_write, Incremental_inputs_entry)
7357         (Incremental_inputs_entry_write): Move ...
7358         * incremental.h (Incremental_inputs_header)
7359         (Incremental_inputs_header_write, Incremental_inputs_entry)
7360         (Incremental_inputs_entry_write): here.
7361
7362 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7363
7364         * incremental.cc (make_sized_incremental_binary): Set the target.
7365         Error if it is incompatible.
7366         * output.h (Output_file): Add filename method.
7367
7368 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7369
7370         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7371         from the get_* methods.
7372
7373 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7374
7375         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7376         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7377         Write 0 for the data_offset of scripts.
7378
7379 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7380
7381         * testsuite/Makefile.am: Add the incremental_test.sh test.
7382         * testsuite/incremental_test.sh: New.
7383         * testsuite/incremental_test_1.c: New.
7384         * testsuite/incremental_test_2.c: New.
7385
7386 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7387
7388        * incremental-dump.cc (main): Fix typos.
7389
7390 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7391
7392         PR gold/11025
7393         * incremental-dump.cc (main): Use llu to print 64 bit values.
7394
7395 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7396             H.J. Lu  <hongjiu.lu@intel.com>
7397
7398         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7399         $(LIBDL).
7400         (incremental_dump_LDADD): Likewise.
7401         * Makefile.in: Regenerated.
7402
7403 2009-11-25  Doug Kwan  <dougkwan@google.com>
7404
7405         Revert:
7406
7407         2009-11-25  Doug Kwan  <dougkwan@google.com>
7408
7409                 * arm.cc (Target_arm::Target_arm): Move method definition
7410                 outside of class definition.  Add code to handle
7411                 --target1-rel, --target1-abs and --target2= options.
7412                 (Target_arm::get_reloc_reloc_type): Change method to be
7413                 non-static and const.
7414                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7415                 New data member declaration.
7416                 (Target_arm::Scan::local, Target_arm::Scan::global,
7417                 Target_arm::Relocate::relocate,
7418                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7419                 Adjust call to Target_arm::get_real_reloc_type.
7420                 (Target_arm::get_real_reloc_type): Use command line options
7421                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7422                 * options.h (--target1-rel, --target1-abs, --target2): New
7423                 ARM-only options.
7424
7425 2009-11-25  Doug Kwan  <dougkwan@google.com>
7426
7427         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7428         class definition.  Add code to handle --target1-rel, --target1-abs
7429         and --target2= options.
7430         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7431         and const.
7432         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7433         member declaration.
7434         (Target_arm::Scan::local, Target_arm::Scan::global,
7435         Target_arm::Relocate::relocate,
7436         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7437         call to Target_arm::get_real_reloc_type.
7438         (Target_arm::get_real_reloc_type): Use command line options to
7439         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7440         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7441         options.
7442
7443 2009-11-25  Doug Kwan  <dougkwan@google.com>
7444
7445         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7446         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7447         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7448         formatting.
7449         (Arm_relocate_functions::thm_call): Replace body with a call to
7450         Arm_relocate_functions::thumb_branch_common.
7451         (Arm_relocate_functions::thm_jump24,
7452         Arm_relocate_functions::thm_xpc22): New method definitions.
7453         (Arm_relocate_functions::thumb_branch_common): New method definition.
7454         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7455         operator.
7456         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7457         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7458
7459 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7460
7461         * Makefile.am: Build incremental-dump
7462         * Makefile.in: Regenerate.
7463         * incremental-dump.cc: New.
7464         * incremental.cc (Incremental_inputs_header_data,
7465         Incremental_inputs_entry_data): Move to incremental.h
7466         * incremental.h: (Incremental_inputs_header_data,
7467         Incremental_inputs_entry_data): Move from incremental.cc
7468
7469 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7470
7471         * incremental.cc (Incremental_inputs_header,
7472         Incremental_inputs_header_write, Incremental_inputs_entry,
7473         Incremental_inputs_entry_write): Add a typedef with the data type.
7474
7475 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7476
7477         * incremental.cc (Incremental_inputs_header,
7478         Incremental_inputs_header_write, Incremental_inputs_entry,
7479         Incremental_inputs_entry_write): Update comment about which
7480         type has the filed descriptions.
7481
7482 2009-11-15  Doug Kwan  <dougkwan@google.com>
7483
7484         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7485         (Arm_relocate_functions::arm_branch_common): Change method defintion
7486         in class definition to a method declaration and update list of formal
7487         parameters.
7488         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7489         Arm_relocation_functions::jump24): Adjust call to
7490         Arm_relocate_functions::arm_branch_common.  Update list of formal
7491         parameters.
7492         (Arm_relocate_functions::xpc25): New method definition.
7493         (Arm_relocate_functions::arm_branch_common): Move method defintion
7494         out from class definition.  Use stubs for mode-switching and extending
7495         branch ranges.
7496         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7497         specially.  Change code to enable use of stubs in ARM branches.
7498
7499 2009-11-10  Doug Kwan  <dougkwan@google.com>
7500
7501         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7502         in method declaration.
7503         (Target_arm::relocate_stub): New method declaration.
7504         (Target_arm::default_target): Change to return a pointer instead of
7505         a const reference.
7506         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7507         Target_arm::default_target.
7508         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7509         method definition.
7510         (Target_arm::relocate_section): Adjust view.
7511         (Target_arm::relocate_stub): New method definition.
7512
7513 2009-11-10  Doug Kwan  <dougkwan@google.com>
7514
7515         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7516         a format warning.
7517         * incremental.cc (open_incremental_binary): Initialized local
7518         variables to avoid warnings.
7519         * object.cc (make_elf_object): Ditto.
7520         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7521         a format warning.
7522
7523 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7524
7525         PR gold/10930
7526         * testsuite/plugin_test.c: Include "config.h".
7527
7528 2009-11-09  Doug Kwan  <dougkwan@google.com>
7529
7530         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7531         (arm_symbol_value): Remove.
7532         (Arm_relocate_functions::arm_branch_common,
7533         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7534         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7535         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7536         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7537         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7538         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7539         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7540         Arm_relocate_functions::thm_mobw_abs_nc,
7541         Arm_relocate_functions::thm_mov_abs,
7542         Arm_relocate_functions::movw_prel_nc,
7543         Arm_relocate_functions::thm_movt_abs,
7544         Arm_relocate_functions::movt_prel,
7545         Arm_relocate_functions::thm_movw_prel_nc,
7546         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7547         (Target_arm::Relocate::relocate): Only decompose address into two
7548         parts if relocation type uses the thumb-bit and pass the actual
7549         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7550         calls to methods in Arm_relocate_functions for this change.
7551
7552 2009-11-08  Ian Lance Taylor  <iant@google.com>
7553
7554         PR 10925
7555         * reloc.cc: Instantiate
7556         Sized_relobj::initialize_input_to_output_maps and
7557         Sized_relobj:free_input_to_output_maps.
7558
7559 2009-11-06  Ian Lance Taylor  <iant@google.com>
7560
7561         PR 10876
7562         * defstd.cc (in_segment): Set only_if_ref true for "end".
7563
7564 2009-11-06  Doug Kwan  <dougkwan@google.com>
7565
7566         * arm.cc (class Reloc_stub): Correct a comment.
7567         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7568         (Target_arm::scan_section_for_stubs): New method declaration.
7569         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7570         Change methods from private to protected.
7571         (Target_arm::do_may_relax): New method definition.
7572         (Target_arm::do_relax, Target_arm::group_sections,
7573         Target_arm::scan_reloc_for_stub,
7574         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7575         (Target_arm::arm_input_section_map_): New data member declaration.
7576         (Target_arm::scan_reloc_for_stub,
7577         Target_arm::scan_reloc_section_for_stubs,
7578         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7579         Target_arm::do_relax): New method definitions.
7580
7581 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7582
7583         * configure.ac: Check for (struct stat)::st_mtim
7584         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7585         * config.in: Regenerate.
7586         * configure: Regenerate.
7587
7588 2009-11-05  Ian Lance Taylor  <iant@google.com>
7589
7590         PR 10910
7591         * output.cc (Output_segment::add_output_section): Add missing
7592         return statement.
7593
7594 2009-11-04  Ian Lance Taylor  <iant@google.com>
7595
7596         PR 10880
7597         * object.h (class Object): Add is_needed and set_is_needed
7598         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7599         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7600         defined in a dynamic object and referenced by a regular object,
7601         set is_needed for the dynamic object.
7602         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7603         if the file is marked with as_needed and it is not needed.
7604
7605 2009-11-04  Ian Lance Taylor  <iant@google.com>
7606
7607         PR 10887
7608         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7609         tags if data is discarded by linker script.
7610         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7611         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7612         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7613         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7614
7615 2009-11-04  Ian Lance Taylor  <iant@google.com>
7616
7617         * layout.cc (Layout::get_output_section): Add is_interp and
7618         is_dynamic_linker_section parameters.  Change all callers.
7619         (Layout::choose_output_section): Likewise.
7620         (Layout::make_output_section): Likewise.
7621         (Layout::add_output_section_data): Add is_dynamic_linker_section
7622         parameter.  Change all callers.
7623         * layout.h (class Layout): Update declarations.
7624         * output.h (class Output_section): Add is_interp, set_is_interp,
7625         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7626         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7627         generate_code_fills_at_write_ to a bitfield.
7628         * output.cc (Output_section::Output_sections): Initialize new
7629         fields.
7630         (Output_segment::add_output_section): Add do_sort parameter.
7631         Change all callers.
7632
7633 2009-11-03  Ian Lance Taylor  <iant@google.com>
7634
7635         PR 10860
7636         * options.h (class General_options): Add --warn-common.
7637         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7638         merging two common symbols.
7639         (Symbol_table::should_override): Handle --warn-common when merging
7640         a common symbol with a defined symbol.  Use report_resolve_problem
7641         for multiple definitions.
7642         (Symbol_table::report_resolve_problem): New function.
7643         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7644
7645 2009-11-03  Doug Kwan  <dougkwan@google.com>
7646
7647         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7648         stub_factory_.
7649         (Target_arm::stub_factory): New method definition.
7650         (Target_arm::new_arm_input_section,
7651         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7652         Target_arm::reloc_uses_thumb_bit): New method declarations.
7653         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7654         New type definitions.
7655         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7656         member declarations.
7657         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7658         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7659         New method definitions.
7660
7661 2009-11-03  Ian Lance Taylor  <iant@google.com>
7662
7663         * options.h (class General_options): Add --warn_constructors.
7664
7665 2009-11-03  Ian Lance Taylor  <iant@google.com>
7666
7667         PR 10893
7668         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7669         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7670
7671 2009-11-03  Ian Lance Taylor  <iant@google.com>
7672
7673         PR 10895
7674         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7675         --msgid-bugs-address.
7676         (install-pdf): New target.
7677         (install-data_yes): Look up one directory to find mkinstalldirs.
7678
7679 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7680
7681         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7682         tree.
7683
7684 2009-10-30  Doug Kwan  <dougkwan@google.com>
7685
7686         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7687
7688 2009-10-30  Doug Kwan  <dougkwan@google.com>
7689
7690         * arm.cc (Stub_addend_reader): New struct template definition
7691         and partial specializations.
7692         (Stub_addend_reader::operator()): New method definition for a
7693         partially specialized template.
7694
7695 2009-10-30  Doug Kwan  <dougkwan@google.com>
7696
7697         * arm.cc (Arm_relobj::processor_specific_flags): New method
7698         definition.
7699         (Arm_relobj::do_read_symbols): New method declaration.
7700         (Arm_relobj::processor_specific_flags_): New data member declaration.
7701         (Arm_dynobj): New class definition.
7702         (Target_arm::do_finalize_sections): Add input_objects parameter.
7703         (Target_arm::do_adjust_elf_header): New method declaration.
7704         (Target_arm::are_eabi_versions_compatible,
7705         (Target_arm::merge_processor_specific_flags): New method declaration.
7706         (Target_arm::do_make_elf_object): New overloaded method definitions
7707         and declaration.
7708         (Arm_relobj::do_read_symbols): New method definition.
7709         (Arm_dynobj::do_read_symbols): Ditto.
7710         (Target_arm::do_finalize_sections): Add input_objects parameters.
7711         Merge processor-specific flags from all input objects.
7712         (Target_arm::are_eabi_versions_compatible,
7713         Target_arm::merge_processor_specific_flags,
7714         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7715         New method definitions.
7716         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7717         Input_objects pointer type parameter.
7718         * layout.cc (Layout::finalize): Pass input objects to target's.
7719         finalize_sections function.
7720         * output.cc (Output_file_header::do_sized_write): Set ELF file
7721         header's processor-specific flags.
7722         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7723         Input_objects pointer type parameter.
7724         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7725         * target.h (Input_objects): New forward class declaration.
7726         (Target::processor_specific_flags,
7727         Target::are_processor_specific_flags_sect): New method definitions.
7728         (Target::finalize_sections): Add input_objects parameter.
7729         (Target::Target): Initialize processor_specific_flags_ and
7730         are_processor_specific_flags_set_.
7731         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7732         parameter.
7733         (Target::set_processor_specific_flags): New method definition.
7734         (Target::processor_specific_flags_,
7735         Target::are_processor_specific_flags_set_): New data member
7736         declarations.
7737         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7738         Input_objects pointer type parameter.
7739
7740 2009-10-30  Doug Kwan  <dougkwan@google.com>
7741
7742         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7743
7744 2009-10-28  Ian Lance Taylor  <iant@google.com>
7745
7746         * object.h (class Relobj): Drop options parameter from
7747         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7748         do_scan_relocs, do_relocate.  Change all callers.
7749         (class Sized_relobj): Drop options parameters from
7750         do_gc_process_relocs, do_scan_relocs, do_relocate,
7751         do_relocate_sections, relocate_sections, emit_relocs_scan,
7752         emit_relocs_scan_reltype.  Change all callers.
7753         (struct Relocate_info): Remove options field and all references to
7754         it.
7755         * reloc.h (class Read_relocs): Remove options constructor
7756         parameter and options_ field.  Change all callers.
7757         (class Gc_process_relocs, class Scan_relocs): Likewise.
7758         (class Relocate_task): Likewise.
7759         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7760         all callers.
7761         (scan_relocatable_relocs): Likewise.
7762         * target.h (class Sized_target): Remove options parameter from
7763         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7764         all callers.
7765         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7766         callers.
7767         * arm.cc: Update functions to remove options parameters.
7768         * i386.cc: Likewise.
7769         * powerpc.cc: Likewise.
7770         * sparc.cc: Likewise.
7771         * x86_64.cc: Likewise.
7772         * testsuite/testfile.cc: Likewise.
7773
7774 2009-10-28  Doug Kwan  <dougkwan@google.com>
7775
7776         * arm.cc (Arm_relobj): New class definition.
7777         (Arm_relobj::scan_sections_for_stubs,
7778         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7779         New method definitions.
7780
7781 2009-10-28  Cary Coutant  <ccoutant@google.com>
7782
7783         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7784         (Plugin::cleanup_done_): New member.
7785         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7786         (Plugin_manager::cleanup_done_): Remove.
7787         (Plugin_manager::add_input_file): Edit error message.
7788         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7789         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7790
7791 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7792
7793         * fileread.cc: (File_read::View::~View): Use the new
7794         data_ownership_ filed.
7795         (File_read::~File_read): Dispose the new whole_file_view_.
7796         (File_read::open): Mmap the whole file if needed.
7797         (File_read::open): Use whole_file_view_ instead of contents_.
7798         (File_read::find_view): Use whole_file_view_ if applicable.
7799         (File_read::do_read): Use whole_file_view_ instead of contents_.
7800         (File_read::make_view): Use whole_file_view_ instead of contents_,
7801         update File_read::View::View call.
7802         (File_read::find_or_make_view): Update File_read::View::View
7803         call.
7804         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7805         remove contents_
7806         (File_read::View::Data_ownership): New enum.
7807         (File_read::View::View): Replace bool mapped_ with Data_ownership
7808         argument.
7809         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7810         (File_read::View::data_ownership_): New field.
7811         (File_read::contents_): Remove (replaced by whole_file_view_).
7812         (File_read::whole_file_view_): New field.
7813         * options.h (class General_options): Add --keep-files-mapped.
7814
7815 2009-10-27  Cary Coutant  <ccoutant@google.com>
7816
7817         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7818         * testsuite/Makefile.am (plugin_test_5): New test case.
7819         * testsuite/Makefile.in: Regenerate.
7820
7821 2009-10-25  Doug Kwan  <dougkwan@google.com>
7822
7823         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7824         from private to protected to allow access by child class.
7825         (Sized_relobj::do_relocate_sections): New method declaration.
7826         (Sized_relobj::relocate_sections): Virtualize.
7827         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7828         Sized_relobj::relocate_sections.  Instantiate template explicitly
7829         for different target sizes and endianity.
7830
7831 2009-10-24  Doug Kwan  <dougkwan@google.com>
7832
7833         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7834         (Arm_input_section::as_arm_input_section): New method.
7835         (Arm_output_section): New class definition.
7836         (Arm_output_section::create_stub_group,
7837         Arm_output_section::group_sections): New method definitions.
7838
7839 2009-10-22  Doug Kwan  <dougkwan@google.com>
7840
7841         * arm.cc (Arm_input_section): New class definition.
7842         (Arm_input_section::init, Arm_input_section:do_write,
7843         Arm_input_section::set_final_data_size,
7844         Arm_input_section::do_reset_address_and_file_offset): New method
7845         definitions.
7846
7847 2009-10-21  Doug Kwan  <dougkwan@google.com>
7848
7849         * arm.cc (Stub_table, Arm_input_section): New forward class
7850         declarations.
7851         (Stub_table): New class defintion.
7852         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7853         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7854         New method definition.
7855
7856 2009-10-21  Doug Kwan  <dougkwan@google.com>
7857
7858         * arm.cc: Update copyright comments.
7859         (Target_arm): New forward class template declaration.
7860         (Arm_address): New type.
7861         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7862         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7863         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7864         constants.
7865         (Insn_template): Same.
7866         (DEF_STUBS): New macro.
7867         (Stub_type): New enum type.
7868         (Stub_template): New class definition.
7869         (Stub): Same.
7870         (Reloc_stub): Same.
7871         (Stub_factory): Same.
7872         (Target_arm::Target_arm): Initialize may_use_blx_ and
7873         should_force_pic_veneer_.
7874         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7875         Target_arm::should_force_pic_veneer,
7876         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7877         Target_arm::using_thumb_only, Target_arm:;default_target): New
7878         method defintions.
7879         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7880         New data member declarations.
7881         (Insn_template::size, Insn_template::alignment): New method defintions.
7882         (Stub_template::Stub_template): New method definition.
7883         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7884         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7885         (Stub_factory::Stub_factory): New method definition.
7886         * gold.h (string_hash): New template.
7887         * output.h (Input_section_specifier::hash_value): Use
7888         gold::string_hash.
7889         (Input_section_specifier::string_hash): Remove.
7890         * stringpool.cc (Stringpool_template::string_hash): Use
7891         gold::string_hash.
7892
7893 2009-10-20  Doug Kwan  <dougkwan@google.com>
7894
7895         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7896         symbols of relaxed input sections.
7897         * output.h (Output_section::find_relaxed_input_section): Make
7898         method public.
7899
7900 2009-10-16  Doug Kwan  <dougkwan@google.com>
7901
7902         * dynobj.cc (Versions::Versions): Initialize version_script_.
7903         Only insert base version symbol definition for a shared object
7904         if version script defines any version versions.
7905         (Versions::define_base_version): New method definition.
7906         (Versions::add_def): Check that base version is not needed.
7907         (Versions::add_need): Define base version lazily.
7908         * dynobj.h (Versions::define_base_version): New method declaration.
7909         (Versions::needs_base_version_): New data member declaration.
7910         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7911         (check_DATA): Add no_version_test.stdout.
7912         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7913         New make rules.
7914         * testsuite/Makefile.in: Regenerate.
7915         * testsuite/no_version_test.c: New file.
7916         * testsuite/no_version_test.sh: Ditto.
7917
7918 2009-10-16  Doug Kwan  <dougkwan@google.com>
7919
7920         * expression.cc (class Segment_start_expression): New class definition.
7921         (Segment_start_expression::value): New method definition.
7922         (script_exp_function_segment_start): Return a new
7923         Segment_start_expression.
7924         * gold/script-c.h (script_saw_segment_start_expression): New function
7925         prototype.
7926         * script-sections.cc (Script_sections::Script_sections): Initialize
7927         SAW_SEGMENT_START_EXPRESSION_ to false.
7928         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7929         and -Tbbs options to specify section addresses if given in
7930         command line and no SEGMENT_START expression is seen in a script.
7931         * script-sections.h (Script_sections::saw_segment_start_expression,
7932         Script_sections::set_saw_segment_start_expression): New method
7933         definition.
7934         (Script_sections::saw_segment_start_expression_): New data member
7935         declaration.
7936         * script.cc (script_saw_segment_start_expression): New function.
7937         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7938         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7939         script_test_7.sh and script_test_8.sh.
7940         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7941         script_test_8.stdout.
7942         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7943         (script_test_6, script_test_6.stdout, script_test_7,
7944         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7945         * Makefile.in: Regenerate.
7946         * testsuite/script_test_6.sh: New file.
7947         * testsuite/script_test_6.t: Same.
7948         * testsuite/script_test_7.sh: Same.
7949         * testsuite/script_test_7.t: Same.
7950         * testsuite/script_test_8.sh: Same.
7951
7952 2009-10-16  Doug Kwan  <dougkwan@google.com>
7953
7954         * output.cc (Output_segment::set_section_list_address): Cast
7955         expressions to unsigned long long type to avoid format warnings.
7956
7957 2009-10-15  Ian Lance Taylor  <iant@google.com>
7958
7959         * script.cc (Script_options::add_symbol_assignment): Always add a
7960         dot assignment to script_sections_.
7961         * script-sections.cc (Script_sections::add_dot_assignment):
7962         Initialize if necessary.
7963
7964         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7965         program headers with no load segment if there is a linker script.
7966
7967         * layout.cc (Layout::set_segment_offsets): Align the file offset
7968         to the segment aligment for -N or -n with no load segment.
7969         * output.cc (Output_segment::add_output_section): Don't crash if
7970         the first section is a TLS section.
7971         (Output_segment::set_section_list_addresses): Print an error
7972         message if the address moves backward in a linker script.
7973         * script-sections.cc
7974         (Output_section_element_input::set_section_addresses): Don't
7975         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7976         (Orphan_output_section::set_section_addresses): Likewise.
7977
7978 2009-10-15  Doug Kwan  <dougkwan@google.com>
7979
7980         * layout.cc (Layout::finish_dynamic_section): Generate tags
7981         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7982         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7983         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7984
7985 2009-10-14  Ian Lance Taylor  <iant@google.com>
7986
7987         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7988         fields.
7989         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7990         data_shdr fields of relinfo.
7991         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7992         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7993         R_386_TLS_LDO_32, adjust based on section flags.
7994         (Target_i386::Relocate::fix_up_ldo): Remove.
7995
7996 2009-10-13  Ian Lance Taylor  <iant@google.com>
7997
7998         Add support for -pie.
7999         * options.h (class General_options): Add -pie and
8000         --pic-executable.
8001         (General_options::output_is_position_independent): Test -pie.
8002         (General_options::output_is_executable): Return true if not shared
8003         and not relocatable.
8004         (General_options::output_is_pie): Remove.
8005         * options.cc (General_options::finalize): Reject incompatible uses
8006         of -pie.
8007         * gold.cc (queue_middle_tasks): A -pie link is not static.
8008         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8009         * symtab.cc (Symbol::final_value_is_known): Return false if
8010         output_is_position_independent.
8011         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8012         output_is_position_independent.
8013         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8014         output_is_position_independent.
8015         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8016         output_is_position_independent.
8017         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8018         two_file_pie_test.
8019         (basic_pie_test.o, basic_pie_test): New targets.
8020         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8021         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8022         (two_file_pie_test): New target.
8023         * testsuite/Makefile.in: Rebuild.
8024         * README: Remove note saying that -pie is not supported.
8025
8026 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8027
8028         * options.h (class General_options): Add -init and -fini.
8029         * layout.cc (Layout::finish_dynamic_section): Emit
8030         given init and fini functions.
8031
8032 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8033
8034         * gc.h (gc_process_relocs): Check if icf is enabled using new
8035         function.
8036         * gold.cc (queue_initial_tasks): Likewise.
8037         (queue_middle_tasks): Likewise.
8038         * object.cc (do_layout): Likewise.
8039         * symtab.cc (is_section_folded): Likewise.
8040         * main.cc (main): Likewise.
8041         * reloc.cc (Read_relocs::run): Likewise.
8042         (Sized_relobj::do_scan_relocs): Likewise.
8043         * icf.cc (is_function_ctor_or_dtor): New function.
8044         (Icf::find_identical_sections): Check if function is ctor or dtor when
8045         safe icf is chosen.
8046         * options.h (General_options::icf): Change option to be an enum.
8047         (Icf_status): New enum.
8048         (icf_enabled): New method.
8049         (icf_safe_folding): New method.
8050         (set_icf_status): New method.
8051         (icf_status_): New variable.
8052         * (options.cc) (General_options::finalize): Set icf_status_.
8053         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8054         icf_test and icf_keep_unique_test to use the --icf enum flag.
8055         * testsuite/icf_safe_test.sh: New file.
8056         * testsuite/icf_safe_test.cc: New file.
8057
8058 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8059
8060         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8061         includes to gc.h and icf.h.
8062         * arm.cc: Include gc.h.
8063         * gold.cc: Likewise.
8064         * i386.cc: Likewise.
8065         * powerpc.cc: Likewise.
8066         * sparc.cc: Likewise.
8067         * x86_64.cc: Likewise.
8068         * gc.h: Include icf.h.
8069
8070 2009-10-11  Ian Lance Taylor  <iant@google.com>
8071
8072         * plugin.cc: Include "gold.h" before other header files.
8073
8074 2009-10-10  Chris Demetriou  <cgd@google.com>
8075
8076         * options.h (Input_file_argument::Input_file_type): New enum.
8077         (Input_file_argument::is_lib_): Replace with...
8078         (Input_file_argument::type_): New member.
8079         (Input_file_argument::Input_file_argument): Take Input_file_type
8080         'type' rather than boolean 'is_lib' as second argument.
8081         (Input_file_argument::is_lib): Use type_.
8082         (Input_file_argument::is_searched_file): New function.
8083         (Input_file_argument::may_need_search): Handle is_searched_file.
8084         * options.cc (General_options::parse_library): Support -l:filename.
8085         (General_options::parse_just_symbols): Update for Input_file_argument
8086         changes.
8087         (Command_line::process): Likewise.
8088         * archive.cc (Archive::get_file_and_offset): Likewise.
8089         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8090         * script.cc (read_script_file, script_add_file): Likewise.
8091         * fileread.cc (Input_file::Input_file): Likewise.
8092         (Input_file::will_search_for): Handle is_searched_file.
8093         (Input_file::open): Likewise.
8094         * readsyms.cc (Read_symbols::get_name): Likewise.
8095         * testsuite/Makefile.am (searched_file_test): New test.
8096         * testsuite/Makefile.in: Regenerate.
8097         * testsuite/searched_file_test.cc: New file.
8098         * testsuite/searched_file_test_lib.cc: New file.
8099
8100 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8101             Ian Lance Taylor  <iant@google.com>
8102
8103         * descriptor.cc: Include <cstdio> and "binary-io.h".
8104         (Descriptors::open): Open the files in binary mode always.
8105         * script.cc (Lex::get_token): Treat \r as whitespace.
8106
8107 2009-10-09  Ian Lance Taylor  <iant@google.com>
8108
8109         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8110
8111 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8112             Ian Lance Taylor  <iant@google.com>
8113
8114         * configure.ac: Check for readv function also.
8115         * fileread.cc (readv): Define if not HAVE_READV.
8116         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8117         does not exist.
8118         * config.in: Regenerate.
8119         * configure: Regenerate.
8120
8121 2009-10-09  Doug Kwan  <dougkwan@google.com>
8122
8123         * layout.cc (Layout::make_output_section): Call target hook to make
8124         ordinary output section.
8125         (Layout::finalize): Adjust parameter list of call the
8126         Target::may_relax().
8127         * layout.h (class Layout::section_list): New method.
8128         * merge.h (Output_merge_base::entsize): Change visibility to public.
8129         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8130         New methods.
8131         (Output_merge_string::do_is_string): New method.
8132         * object.cc (Sized_relobj::do_setup): renamed from
8133         Sized_relobj::set_up.
8134         * object.h (Sized_relobj::adjust_shndx,
8135         Sized_relobj::initializ_input_to_output_maps,
8136         Sized_relobj::free_input_to_output_maps): Change visibilities to
8137         protected.
8138         (Sized_relobj::setup): Virtualize.
8139         (Sized_relobj::do_setup): New method declaration.
8140         (Sized_relobj::invalidate_section_offset,
8141         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8142         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8143         * options.cc (parse_int): New function.
8144         * options.h (parse_int): New declaration.
8145         (DEFINE_int): New macro.
8146         (stub_group_size): New option.
8147         * output.cc (Output_section::Output_section): Initialize memebers
8148         merge_section_map_, merge_section_by_properties_map_,
8149         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8150         (Output_section::add_input_section): Handled deferred code-fill
8151         generation and remove an old comment.
8152         (Output_section::add_relaxed_input_section): New method definition.
8153         (Output_section::add_merge_input_section): Use merge section by
8154         properties map to speed to search.  Update merge section maps
8155         as appropriate.
8156         (Output_section::build_relaxation_map): New method definition.
8157         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8158         Same.
8159         (Output_section::relax_input_section): Renamed to
8160         Output_section::convert_input_sections_to_relaxed_sections and change
8161         interface to take a vector of pointers to relaxed sections.
8162         (Output_section::find_merge_section,
8163         Output_section::find_relaxed_input_section): New method definitions.
8164         (Output_section::is_input_address_mapped,
8165         Output_section::output_offset, Output_section::output_address):
8166         Use output section data maps to speed up searching.
8167         (Output_section::find_starting_output_address): Add comments.
8168         (Output_section::do_write,
8169         Output_section::write_to_postprocessing_buffer): Do code-fill
8170         generation as appropriate.
8171         (Output_section::get_input_sections): Invalidate relaxed input section
8172         map.
8173         (Output_section::restore_states): Adjust type of checkpoint .
8174         Invalidate relaxed input section map.
8175         * output.h (Output_merge_base): New class declaration.
8176         (Input_section_specifier): New class defintion.
8177         (class Output_relaxed_input_section) Change base class to
8178         Output_section_data_build.
8179         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8180         base class initializer.
8181         (Output_section::add_relaxed_input_section): New method declaration.
8182         (Output_section::Input_section): Change visibility to protected.
8183         (Output_section::Input_section::relobj,
8184         Output_section::Input_section::shndx): Handle relaxed input sections.
8185         Output_section::input_sections) Change visibility to protected.  Also
8186         define overload to return a non-const pointer.
8187         (Output_section::Merge_section_properties): New class defintion.
8188         (Output_section::Merge_section_by_properties_map,
8189         Output_section::Output_section_data_by_input_section_map,
8190         Output_section::Relaxation_map): New types.
8191         (Output_section::relax_input_section): Rename method to
8192         Output_section::convert_input_sections_to_relaxed_sections and change
8193         interface to take a vector of relaxed section pointers.
8194         (Output_section::find_merge_section,
8195         Output_section::find_relaxed_input_section,
8196         Output_section::build_relaxation_map,
8197         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8198         New method declarations.
8199         (Output_section::merge_section_map_
8200         Output_section::merge_section_by_properties_map_,
8201         Output_section::relaxed_input_section_map_,
8202         Output_section::is_relaxed_input_section_map_valid_,
8203         Output_section::generate_code_fills_at_write_): New data members.
8204         * script-sections.cc
8205         (Output_section_element_input::set_section_addresses): Call
8206         current_data_size and addralign methods of relaxed input sections.
8207         (Orphan_output_section::set_section_addresses): Call current_data_size
8208         and addralign methods of relaxed input sections.
8209         * symtab.cc (Symbol_table::compute_final_value): Extract template
8210         from the body of Symbol_table::sized_finalize_symbol.
8211         (Symbol_table::sized_finalized_symbol): Call
8212         Symbol_table::compute_final_value.
8213         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8214         (Symbol_table::compute_final_value): New templated method declaration.
8215         * target.cc (Target::do_make_output_section): New method defintion.
8216         * target.h (Target::make_output_section): New method declaration.
8217         (Target::relax): Add more parameters for input objects, symbol table
8218         and layout.  Adjust call to do_relax.
8219         (Target::do_make_output_section): New method declaration.
8220         (Target::do_relax): Add parameters for input objects, symbol table
8221         and layout.
8222
8223 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8224
8225         * pread.c: Include stdio.h.
8226
8227 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8228
8229         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8230         defined.
8231
8232 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8233
8234         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8235         Change read_shndx type to unsigned int.
8236         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8237         int.
8238         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8239         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8240         Change read_shndx type to unsigned int.
8241         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8242         int.
8243         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8244         * layout.cc (Layout::create_symtab_sections): Cast the result of
8245         local_symcount * symsize to off_t in the gold_assert.
8246
8247 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8248
8249         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8250         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8251         R_ARM_BASE_ABS.
8252         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8253         (Arm_relocate_functions::thm_abs5): New function.
8254         (Arm_relocate_functions::abs12): New function.
8255         (Arm_relocate_functions::abs16): New function.
8256         (Arm_relocate_functions::base_abs): New function.
8257         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8258         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8259         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8260         R_ARM_BASE_ABS.
8261         (Scan::global): Likewise.
8262         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8263         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8264         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8265         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8266         R_ARM_BASE_ABS.
8267
8268 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8269
8270         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8271         (Arm_relocate_functions::movt_prel): New function.
8272         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8273         (Arm_relocate_functions::thm_movt_prel): New function.
8274         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8275         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8276         (Scan::global, Relocate::relocate): Likewise.
8277         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8278
8279 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8280
8281         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8282         Incremental_checker.
8283         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8284         unsigned int.
8285         (class Incremental_inputs_header): New class.
8286         (Incremental_inputs_header_writer): Edit comment.
8287         (Incremental_inputs_entry): New class.
8288         (Incremental_inputs_entry_writer): Edit comment.
8289         (Sized_incremental_binary::do_find_incremental_inputs_section):
8290         Add *strtab_shndx parameter, fill it.
8291         (Sized_incremental_binary::do_check_inputs): New method.
8292         (Incremental_checker::can_incrementally_link_output_file): Use
8293         Sized_incremental_binary::check_inputs.
8294         (Incremental_inputs::report_command_line): Save command line in
8295         command_line_.
8296         * incremental.h:
8297         (Incremental_binary::find_incremental_inputs_section): New
8298         method.
8299         (Incremental_binary::do_find_incremental_inputs_section): Add
8300         strtab_shndx parameter.
8301         (Incremental_binary::do_check_inputs): New pure virtual method.
8302         (Sized_incremental_binary::do_check_inputs): Declare.
8303         (Incremental_checker::Incremental_checker): Add incremental_inputs
8304         parameter, use it to initialize incremental_inputs_.
8305         (Incremental_checker::incremental_inputs_): New field.
8306         (Incremental_checker::command_line): New method.
8307         (Incremental_checker::inputs): New method.
8308         (Incremental_checker::command_line_): New field.
8309
8310 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8311
8312         * incremental.cc: Include <cstdarg> and "target-select.h".
8313         (vexplain_no_incremental): New function.
8314         (explain_no_incremental): New function.
8315         (Incremental_binary::error): New method.
8316         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8317         method.
8318         (make_sized_incremental_binary): New function.
8319         (open_incremental_binary): New function.
8320         (can_incrementally_link_file): Add checks if output is ELF and has
8321         inputs section.
8322         * incremental.h: Include "elfcpp_file.h" and "output.h".
8323         (Incremental_binary): New class.
8324         (Sized_incremental_binary): New class.
8325         (open_incremental_binary): Declare.
8326         * object.cc (is_elf_object): Use
8327         elfcpp::Elf_recognizer::is_elf_file.
8328         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8329         * output.h (Output_file::filesize): New method.
8330
8331 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8332
8333         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8334         New function.
8335         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8336         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8337         function.
8338         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8339         function.
8340         (Arm_relocate_functions::movw_abs_nc): New function.
8341         (Arm_relocate_functions::movt_abs): New function.
8342         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8343         (Arm_relocate_functions::thm_movt_abs): New function.
8344         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8345         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8346         (Scan::global): Likewise.
8347         (Relocate::relocate): Likewise.
8348         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8349
8350 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8351
8352         * arm.cc (Arm_relocate_functions::got_prel) New function.
8353         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8354         (Relocate::relocate): Likewise.
8355         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8356
8357 2009-10-06  Ian Lance Taylor  <iant@google.com>
8358
8359         * options.h (class General_options): Define
8360         split_stack_adjust_size parameter.
8361         * object.h (class Object): Add uses_split_stack_ and
8362         has_no_split_stack_ fields.  Add uses_split_stack and
8363         has_no_split_stack accessor functions.  Declare
8364         handle_split_stack_section.
8365         (class Reloc_symbol_changes): Define.
8366         (class Sized_relobj): Define Function_offsets.  Declare
8367         split_stack_adjust, split_stack_adjust_reltype, and
8368         find_functions.
8369         * object.cc (Object::handle_split_stack_section): New function.
8370         (Sized_relobj::do_layout): Call handle_split_stack_section.
8371         * dynobj.cc (Sized_dynobj::do_layout): Call
8372         handle_split_stack_section.
8373         * reloc.cc (Sized_relobj::relocate_sections): Call
8374         split_stack_adjust for executable sections in split_stack
8375         objects.  Pass reloc_map to relocate_section.
8376         (Sized_relobj::split_stack_adjust): New function.
8377         (Sized_relobj::split_stack_adjust_reltype): New function.
8378         (Sized_relobj::find_functions): New function.
8379         * target-reloc.h: Include "object.h".
8380         (relocate_section): Add reloc_symbol_changes parameter.  Change
8381         all callers.
8382         * target.h (class Target): Add calls_non_split method.  Declare
8383         do_calls_non_split virtual method.  Declare match_view and
8384         set_view_to_nop.
8385         * target.cc: Include "elfcpp.h".
8386         (Target::do_calls_non_split): New function.
8387         (Target::match_view): New function.
8388         (Target::set_view_to_nop): New function.
8389         * gold.cc (queue_middle_tasks): Give an error if mixing
8390         split-stack and non-split-stack objects with -r.
8391         * i386.cc (Target_i386::relocate_section): Add
8392         reloc_symbol_changes parameter.
8393         (Target_i386::do_calls_non_split): New function.
8394         * x86_64.cc (Target_x86_64::relocate_section): Add
8395         reloc_symbol_changes parameter.
8396         (Target_x86_64::do_calls_non_split): New function.
8397         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8398         parameter.
8399         * powerpc.cc (Target_powerpc::relocate_section): Add
8400         reloc_symbol_changes parameter.
8401         * sparc.cc (Target_sparc::relocate_section): Add
8402         reloc_symbol_changes parameter.
8403         * configure.ac: Call AM_CONDITIONAL for the default target.
8404         * configure: Rebuild.
8405         * testsuite/Makefile.am (TEST_AS): New variable.
8406         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8407         (check_DATA): Add split_i386 and split_x86_64 files.
8408         (SPLIT_DEFSYMS): Define.
8409         (split_i386_[1234n].o): New targets.
8410         (split_i386_[124]): New targets.
8411         (split_i386_[1234r].stdout): New targets.
8412         (split_x86_64_[1234n].o): New targets.
8413         (split_x86_64_[124]): New targets.
8414         (split_x86_64_[1234r].stdout): New targets.
8415         (MOSTLYCLEANFILES): Add new executables.
8416         * testsuite/split_i386.sh: New file.
8417         * testsuite/split_x86_64.sh: New file.
8418         * testsuite/split_i386_1.s: New file.
8419         * testsuite/split_i386_2.s: New file.
8420         * testsuite/split_i386_3.s: New file.
8421         * testsuite/split_i386_4.s: New file.
8422         * testsuite/split_i386_n.s: New file.
8423         * testsuite/split_x86_64_1.s: New file.
8424         * testsuite/split_x86_64_2.s: New file.
8425         * testsuite/split_x86_64_3.s: New file.
8426         * testsuite/split_x86_64_4.s: New file.
8427         * testsuite/split_x86_64_n.s: New file.
8428         * testsuite/testfile.cc (Target_test): Update relocation_section
8429         function.
8430         * testsuite/Makefile.in: Rebuild.
8431
8432 2009-10-06  Ian Lance Taylor  <iant@google.com>
8433
8434         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8435         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8436         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8437         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8438         the address on ldo_addrs_.
8439         (Target_i386::Relocate::fix_up_ldo): New function.
8440
8441 2009-10-06   Rafael Espindola  <espindola@google.com>
8442
8443         * plugin.cc (add_input_library): New.
8444         (Plugin::load): Add add_input_library to tv.
8445         (Plugin_manager::add_input_file): Add the is_lib argument.
8446         (add_input_file): Update call to Plugin_manager::add_input_file.
8447         (add_input_library): New.
8448         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8449
8450 2009-09-30  Doug Kwan  <dougkwan@google.com>
8451
8452         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8453         symbol and call Symbol::may_need_copy_reloc to determine if
8454         a copy reloc is needed.
8455         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8456         nocopyreloc is given in command line.
8457         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8458         given in command line.
8459         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8460         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8461         of the removed Target_i386::may_need_copy_reloc.
8462         * options.h (copyreloc): New option with default value false.
8463         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8464         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8465         instead of the removed Target_powerpc::may_need_copy_reloc.
8466         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8467         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8468         instead of the removed Target_sparc::may_need_copy_reloc.
8469         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8470         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8471         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8472         instead of the removed Target_x86_64::may_need_copy_reloc.
8473
8474 2009-09-30  Ian Lance Taylor  <iant@google.com>
8475
8476         * object.h (class Object): Remove target_ field, and target,
8477         sized_target, and set_target methods.
8478         (Object::sized_target): Remove.
8479         (class Sized_relobj): Update declarations.  Remove sized_target.
8480         * object.cc (Sized_relobj::setup): Remove target parameter.
8481         Change all callers.
8482         (Input_objects::add_object): Don't do anything with the target.
8483         (make_elf_sized_object): Add punconfigured parameter.  Change all
8484         callers.  Set or test parameter target.
8485         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8486         Change all callers.
8487         * parameters.cc (Parameters::set_target): Change parameter type to
8488         be non-const.
8489         (Parameters::default_target): Remove.
8490         (set_parameters_target): Change parameter type to be non-const.
8491         (parameters_force_valid_target): New function.
8492         (parameters_clear_target): New function.
8493         * parameters.h (class Parameters): Update declarations.  Remove
8494         default_target method.  Add sized_target and clear_target
8495         methods.  Change target_ to be non-const.
8496         (set_parameters_target): Update declaration.
8497         (parameters_force_valid_target): Declare.
8498         (parameters_clear_target): Declare.
8499         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8500         as NULL if we aren't searching.
8501         (Add_symbols::run): Don't check for compatible target.
8502         * fileread.cc (Input_file::open_binary): Call
8503         parameters_force_valid_target.
8504         * gold.cc (queue_middle_tasks): Likewise.
8505         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8506         set_target on object.
8507         * dynobj.h (class Sized_dynobj): Update declarations.
8508         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8509         make_elf_object returns NULL.
8510         (Archive::include_member): Don't check whether object target is
8511         compatible.
8512         * output.cc (Output_section::add_input_section): Get target from
8513         parameters.
8514         (Output_section::relax_input_section): Likewise.
8515         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8516         parameters.
8517         (Sized_relobj::do_scan_relocs): Likewise.
8518         (Sized_relobj::relocate_sections): Likewise.
8519         * resolve.cc (Symbol_table::resolve): Likewise.
8520         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8521         parameter.  Change all callers.
8522         (Symbol_table::add_from_object): Get target from parameters.
8523         (Symbol_table::add_from_relobj): Don't check object target.
8524         (Symbol_table::add_from_dynobj): Likewise.
8525         (Symbol_table::define_special_symbol): Get target from
8526         parameters.
8527         * symtab.h (class Symbol_table): Update declaration.
8528         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8529         parameter.  Change all callers.  Clear parameter target.
8530         (Binary_test): Test target here.
8531         * testsuite/object_unittest.cc (gold_testsuite): Remove
8532         target_test_pointer parameter.  Change all callers.
8533         (Object_test): Test target here.
8534
8535 2009-09-26  Ian Lance Taylor  <iant@google.com>
8536
8537         * testsuite/initpri1.c: Don't try to use constructor priorities if
8538         compiling with gcc before 4.3.
8539
8540 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8541
8542         * testsuite/retain_symbols_file_test.sh (check_present): Change
8543         output file name to retain_symbols_file_test.stdout.
8544         (check_absent): Likewise.
8545
8546 2009-09-18  Craig Silverstein  <csilvers@google.com>
8547
8548         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8549         * options.cc: Include <cerrno> and <fstream>.
8550         (General_options::finalize): Parse -retain-symbols-file tag.
8551         * options.h: New flag.
8552         (General_options): New method should_retain_symbol, new
8553         variable symbols_to_retain.
8554         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8555         should_retain_symbol map.
8556         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8557         * testsuite/Makefile.in: Regenerate.
8558         * testsuite/retain_symbols_file_test.sh: New file.
8559
8560 2009-09-18  Nick Clifton  <nickc@redhat.com>
8561
8562         * po/es.po: Updated Spanish translation.
8563
8564 2009-09-17  Doug Kwan  <dougkwan@google.com>
8565
8566         * debug.h (DEBUG_RELAXATION): New constant.
8567         (DEBUG_ALL): Add DEBUG_RELAXATION.
8568         (debug_string_to_enum): Add relaxation debug option.
8569         * layout.cc
8570         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8571         Layout::Relaxation_debug_check::read_sections,
8572         Layout::Relaxation_debug_check::read_sections): New method definitions.
8573         (Layout::Layout): Initialize data members
8574         record_output_section_data_from_scrips_,
8575         script_output_section_data_list_ and relaxation_debug_check_.
8576         (Layout::save_segments, Layout::restore_segments,
8577         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8578         Layout::relaxation_loop_body): New method definitions.
8579         (Layout::finalize): Support relaxation.  Move section layout code to
8580         Layout::relaxation_loop_body.
8581         (Layout::set_asection_address_from_script): Move code for orphan
8582         section placement out.
8583         (Layout::place_orphan_sections_in_script): New method definition.
8584         * layout.h (Output_segment_headers, Output_file_header):
8585         New forward class declarations.
8586         (Layout::~Layout): Define.
8587         (Layout::new_output_section_data_from_script): New method definition.
8588         (Layout::place_orphan_sections_in_script): New method declaration.
8589         (Layout::Segment_states): New type declaration.
8590         (Layout::save_segments, Layout::restore_segments,
8591         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8592         Layout::relaxation_loop_body): New method declarations.
8593         (Layout::Output_section_data_list): New type declaration.
8594         (Layout::Relaxation_debug_check): New class definition.
8595         (Layout::record_output_section_data_from_script_,
8596         Layout::script_output_section_data_list_, Layout::segment_states_,
8597         Layout::relaxation_debug_check_): New data members.
8598         * output.cc: (Output_section_headers::do_size): New method definition.
8599         (Output_section_headers::Output_section_headers): Move size
8600         computation to Output_section_headers::do_size.
8601         (Output_segment_headers::do_size): New method definition.
8602         (Output_file_header::Output_file_header): Move size computation to
8603         Output_file_header::do_size and call it.
8604         (Output_file_header::do_size): New method definition.
8605         (Output_data_group::Output_data_group): Adjust call to
8606         Output_section_data.
8607         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8608         (Output_symtab_xindex::do_write): Add array bound check.
8609         (Output_section::Input_section::print_to_mapfile): Handle
8610         RELAXED_INPUT_SECTION_CODE.
8611         (Output_section::Output_section): Initialize data member checkpoint_.
8612         (Output_section::~Output_section): Delete checkpoint object pointed
8613         by checkpoint_.
8614         (Output_section::add_input_section): Always add an Input_section if
8615         relaxing.
8616         (Output_section::add_merge_input_section): Add assert.
8617         (Output_section::relax_input_section): New method definition.
8618         (Output_section::set_final_data_size): Set load address to zero for
8619         an unallocated section.
8620         (Output_section::do_address_and_file_offset_have_reset_values):
8621         New method definition.
8622         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8623         Handle relaxed input section.
8624         (Output_section::sort_attached_input_sections): Checkpoint input
8625         section list lazily.
8626         (Output_section::get_input_sections): Change type of input_sections to
8627         list of Simple_input_section pointers.  Checkpoint input section list
8628         lazily.  Also handle relaxed input sections.
8629         (Output_section::add_input_section_for_script): Take a reference to
8630         a Simple_input_section object instead of Relobj pointer and section
8631         index as parameter.  Handle relaxed input sections.
8632         (Output_section::save_states, Output_section::restore_states): New
8633         method definitions.
8634         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8635         (Output_data::is_data_size_fixed): New method definition.
8636         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8637         if it is fixed.
8638         (Output_data::address_and_file_offset_have_reset_values): New method
8639         definition.
8640         (Output_data::do_address_and_file_offset_have_reset_values): New method
8641         definition.
8642         (Output_data::set_data_size): Check that data size is not fixed.
8643         (Output_data::fix_data_size): New method definition.
8644         (Output_data::is_data_size_fixed_): New data member.
8645         (Output_section_headers::set_final_data_size): New method definition.
8646         (Output_section_headers::do_size): New method declaration.
8647         (Output_segment_headers::set_final_data_size): New method definition.
8648         (Output_segment_headers::do_size): New method declaration.
8649         (Output_file_header::set_final_data_size)::New method definition.
8650         (Output_file_header::do_size)::New method declaration.
8651         (Output_section_data::Output_section_data): Add new parameter
8652         is_data_size_fixed and use it to fix data size.
8653         (Output_data_const::Output_data_const): Adjust call to base class
8654         constructor and fix data size.
8655         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8656         base class constructor and fix data size.
8657         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8658         base class constructor and fix data size.
8659         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8660         class constructor and fix data size.
8661         (Output_data_group::set_final_data_size): New method definition.
8662         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8663         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8664         class constructor and fix data size.
8665         (Output_relaxed_input_section): New class definition.
8666         (Output_section::Simple_input_section): New class definition.
8667         (Output_section::get_input_sections): Adjust parameter list.
8668         (Output_section::add_input_section_for_script): Same.
8669         (Output_section::save_states, Output_section::restore_states,
8670         Output_section::do_address_and_file_offset_have_reset_values,
8671         (Output_section::Input_section::Input_section): Handle
8672         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8673         Output_relaxed_input_section.
8674         (Output_section::Input_section::is_input_section,
8675         Output_section::Input_section::set_output_section): Handle relaxed
8676         input section.
8677         (Output_section::Input_section::is_relaxed_input_section,
8678         Output_section::Input_section::output_section_data,
8679         Output_section::Input_section::relaxed_input_section): New method
8680         definitions.
8681         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8682         value.
8683         (Output_section::Input_section::u1_): Update comments.
8684         (Output_section::Input_section::u2_): Add new union member poris.
8685         (Output_section::Checkpoint_output_section): New classs definition.
8686         (Output_section::relax_input_section): New method declaration.
8687         (Output_section::checkpoint_): New data member.
8688         (Output_segment): Update comments.
8689         (Output_segment::Output_segment): Un-privatize copy constructor.
8690         (Output_segment::operator=): Un-privatize.
8691         * script-sections.cc (Output_section_element::Input_section_list):
8692         Change element type to Output_section::Simple_input_section.
8693         (Output_section_element_dot_assignment::set_section_addresses):
8694         Register output section data for relaxation clean up.
8695         (Output_data_exression::Output_data_expression): Adjust call to base
8696         constructor to fix data size.
8697         (Output_section_element_data::set_section_addresses): Register
8698         Output_data_expression object for relaxation clean up.
8699         (struct Input_section_info): Replace Relobj pointer and section index
8700         pair with Output_section::Simple_input_section and Convert struct to a
8701         class.
8702         (Input_section_sorter::operator()): Adjust access to
8703         Input_section_info data member to use accessors.
8704         (Output_section_element_input::set_section_addresses): Use layout
8705         parameter.  Adjust code to use Output_section::Simple_input_section
8706         and Input_secction_info classes.  Register filler for relaxation
8707         clean up.
8708         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8709         and section index pair with Output_section::Simple_input_section
8710         class.  Adjust code accordingly.
8711         (Phdrs_element::release_segment): New method definition.
8712         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8713         segment list.
8714         (Script_sections::release_segments): New method definition.
8715         * gold/script-sections.h (Script_sections::release_segments): New
8716         method declaration.
8717         * gold/target.h (Target::may_relax, Target::relax,
8718         Target::do_may_relax, Target::do_relax): New method definitions.
8719
8720 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8721
8722         * arm.cc (has_signed_unsigned_overflow): New function.
8723         (Arm_relocate_functions::abs8): New function.
8724         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8725         (Target_arm::Scan::global): Likewise.
8726         (Target_arm::relocate::relocate): Likewise.
8727         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8728         Likewise.
8729
8730 2009-09-16  Cary Coutant  <ccoutant@google.com>
8731
8732         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8733         * testsuite/Makefile.in: Regenerate.
8734
8735 2009-09-11  Nick Clifton  <nickc@redhat.com>
8736
8737         * po/gold.pot: Updated by the Translation project.
8738
8739 2009-09-08  Cary Coutant  <ccoutant@google.com>
8740
8741         * output.cc (Output_file::open): Add execute permission to empty file.
8742         * testsuite/Makefile.am (permission_test): New test.
8743         * testsuite/Makefile.in: Regenerate.
8744
8745 2009-09-02  Ian Lance Taylor  <iant@google.com>
8746
8747         * output.cc (Output_file::resize): Call map_no_anonymous rather
8748         than map.
8749
8750 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8751
8752         * gold.cc: Include "incremental.h".
8753         (queue_initial_tasks): Call Incremental_checker methods.
8754         * incremental.cc: Include "output.h".
8755         (Incremental_checker::can_incrementally_link_output_file): New
8756         method.
8757         * incremental.h (Incremental_checker): New class.
8758
8759         * output.cc (Output_file::open_for_modification): New method.
8760         (Output_file::map_anonymous): Changed return type to bool.  Record
8761         map in base_ field.
8762         (Output_file::map_no_anonymous): New method, broken out of map.
8763         (Output_file::map): Use map_no_anonymous and map_anonymous.
8764         * output.h (class Output_file): Update declarations.
8765
8766 2009-08-24  Cary Coutant  <ccoutant@google.com>
8767
8768         * options.h (Command_line::Pre_options): New class.
8769         (Command_line::pre_options): New member.
8770         * options.cc (gold::options::ready_to_register): New variable.
8771         (One_option::register_option): Do nothing if not registering options.
8772         Assert if same short option registered twice.
8773         (General_options::General_options): Turn off option registration when
8774         done constructing.
8775         (Command_line::Pre_options::Pre_options): New constructor.
8776
8777 2009-08-24  Cary Coutant  <ccoutant@google.com>
8778
8779         * options.h (General_options::no_keep_memory): Remove incorrect
8780         short option.
8781
8782 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8783
8784         * Makefile.am (am__skiplex, am__skipyacc): New.
8785         * Makefile.in: Regenerate.
8786
8787 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8788
8789         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8790         (INCLUDES): ... this.
8791         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8792         (AM_CPPFLAGS): Renamed from ...
8793         (INCLUDE): ... this.
8794         * Makefile.in, testsuite/Makefile.in: Regenerate.
8795
8796         * Makefile.in: Regenerate.
8797         * aclocal.m4: Likewise.
8798         * config.in: Likewise.
8799         * configure: Likewise.
8800         * testsuite/Makefile.in: Likewise.
8801
8802         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8803         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8804         * Makefile.in: Regenerate.
8805         * testsuite/Makefile.in: Regenerate.
8806
8807 2009-08-19  Cary Coutant  <ccoutant@google.com>
8808
8809         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8810         symbols in shared libraries overridden by hidden or internal symbols
8811         in the main program.
8812
8813 2009-08-19  Chris Demetriou  <cgd@google.com>
8814
8815         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8816         checking source file names in error messages.
8817
8818 2009-08-18  Doug Kwan  <dougkwan@google.com>
8819
8820         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8821         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8822         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8823         an elfcpp::Ehdr as parameter.
8824         * object.cc (Object::set_target): Remove the version that looks up
8825         a target and sets it.
8826         (Sized_relobj::setup): Take a Target object instead of
8827         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8828         (make_elf_sized_object): Find target and ask target to
8829         make an ELF object.
8830         * object.h: (Object::set_target): Remove the version that looks up
8831         a target and sets it.
8832         (Sized_relobj::setup): Take a Target object instead of
8833         an elfcpp:Ehdr as parameter.
8834         * target.cc: Include dynobj.h.
8835         (Target::do_make_elf_object_implementation): New.
8836         (Target::do_make_elf_object): New.
8837         * target.h (Target::make_elf_object): New template declaration.
8838         (Target::do_make_elf_object): New method declarations.
8839         (Target::do_make_elf_object_implementation): New template declaration.
8840
8841 2009-08-14  Ian Lance Taylor  <iant@google.com>
8842
8843         * gold.h (FUNCTION_NAME): Define.
8844         (gold_unreachable): Use FUNCTION_NAME.
8845
8846 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8847
8848         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8849         symbol in the --keep-unique list is not found.
8850
8851 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8852
8853         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8854         been maked as --keep-unique.
8855         (Icf::unfold_section): New function.
8856         * icf.h (Icf::unfold_section): New function.
8857         * options.h (General_options::keep_unique): New option.
8858         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8859         * testsuite/Makefile.in: Regenerate.
8860         * testsuite/icf_keep_unique_test.sh: New file.
8861         * testsuite/icf_keep_unique_test.cc: New file.
8862
8863 2009-08-12  Cary Coutant  <ccoutant@google.com>
8864
8865         PR 10471
8866         * resolve.cc (Symbol_table::resolve): Check for references from
8867         dynamic objects to hidden and internal symbols.
8868         * testsuite/Makefile.am (hidden_test.sh): New test.
8869         * testsuite/Makefile.in: Regenerate.
8870         * testsuite/hidden_test.sh: New script.
8871         * testsuite/hidden_test_1.c: New test source.
8872         * testsuite/hidden_test_main.c: New test source.
8873
8874 2009-08-11  Doug Kwan  <dougkwan@google.com>
8875
8876         * arm.cc: Update comments.
8877         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8878         segment to locate the .ARM.exidx section if present.
8879
8880 2009-08-09  Doug Kwan  <dougkwan@google.com>
8881
8882         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8883         patch.
8884
8885 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8886         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8887         compiler warnings.
8888
8889 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8890
8891         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8892         valid tls_segment only for non-debug-section relocations.
8893         * testsuite/Makefile.am: Add gc_tls_test.
8894         * testsuite/Makefile.in: Regenerate.
8895         * testsuite/gc_tls_test.cc: New file.
8896         * testsuite/gc_tls_test.sh: New file.
8897
8898 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8899
8900         * icf.cc: New file.
8901         * icf.h: New file.
8902         * Makefile.am (CCFILES): Add icf.cc.
8903         (HFILES): Add icf.h
8904         * Makefile.in: Regenerate.
8905         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8906         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8907         section, symbol and addend information for the relocs.
8908         * gold.cc (queue_middle_tasks): Call identical code folding.
8909         * gold.h: Add defines for multimap.
8910         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8911         to the call of finalize_local_symbols.
8912         * main.cc (main): Create object of class Icf.
8913         * object.cc (Sized_relobj::do_layout): Allow this function to be
8914         called twice during icf.
8915         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8916         to sections marked as identical by icf.
8917         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8918         when available.
8919         (Sized_relobj::do_section_entsize): New function.
8920         * object.h (Object::section_entsize): New function.
8921         (Object::do_section_entsize): New pure virtual function.
8922         (Relobj::finalize_local_symbols): Add new parameter.
8923         (Relobj::do_section_entsize): New function.
8924         * options.h (General_options::icf): New option.
8925         (General_options::icf_iterations): New option.
8926         (General_options::print_icf_sections): New option.
8927         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8928         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8929         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8930         icf.
8931         * symtab.cc (Symbol_table::is_section_folded): New function.
8932         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8933         to sections marked as identical by icf.
8934         * symtab.h (Symbol_table::set_icf): New function.
8935         (Symbol_table::icf): New function.
8936         (Symbol_table::is_section_folded): New function.
8937         (Symbol_table::icf_): New data member.
8938         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8939         * testsuite/Makefile.am: Add commands to build icf_test.
8940         * testsuite/Makefile.in: Regenerate.
8941         * testsuite/icf_test.sh: New file.
8942         * testsuite/icf_test.cc: New file.
8943
8944 2009-07-24  Chris Demetriou  <cgd@google.com>
8945
8946         * layout.cc (is_compressible_debug_section): Fix incorrect
8947         comment about compressed section names.
8948
8949 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8950
8951         PR 10419
8952         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8953
8954 2009-07-16  Ian Lance Taylor  <iant@google.com>
8955
8956         PR 10400
8957         * layout.h: #include <map>.
8958         (class Kept_section): Change from struct to class.  Add accessors
8959         and setters.  Add section size to Comdat_group mapping.  Change
8960         Comdat_group to std::map.  Add is_comdat_ field.  Add
8961         linkonce_size field in union.
8962         (class Layout): Update declaration of find_or_add_kept_section.
8963         Don't declare find_kept_object.
8964         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8965         parameter.  Add object, shndx, is_comdat, and is_group_name
8966         parameters.  Change all callers.  Adjust for new Kept_section.
8967         (Layout::find_kept_object): Remove.
8968         * object.cc (Sized_relobj::include_section_group): Update use of
8969         Kept_section.  Rename secnum to shndx.  Only record
8970         Kept_comdat_section if sections are the same size.
8971         (Sized_relobj::include_linkonce_section): Update use of
8972         Kept_section.  Only record Kept_comdat_section if sections are the
8973         same size.  Set size of linkonce section.
8974         (Sized_relobj::map_to_kept_section): Update call to
8975         get_kept_comdat_section.
8976         * object.h (class Sized_relobj): Rename fields in
8977         Kept_comdat_section to drop trailing underscores; change object
8978         field to Relobj*.  Change Kept_comdat_section_table to store
8979         struct rather than pointer.
8980         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8981         Add kept_object and kept_shndx parameters.  Change all callers.
8982         (Sized_relobj::get_kept_comdat_section): Change return type to
8983         bool.  Add kept_object and kept_shndx parameters.  Change all
8984         callers.
8985         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8986         Layout::find_or_add_kept_section.
8987
8988 2009-07-09  Ian Lance Taylor  <iant@google.com>
8989
8990         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8991         Reserve space in the hash table.
8992
8993 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8994
8995         * fileread.cc (File_read::get_mtime): New method.
8996         * fileread.h (Timespec): New structure.
8997         (File_read::get_mtime): New method.
8998         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8999         Renamed from timestamp_nsec.
9000         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9001         Elf_Xword.
9002         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9003         timestamp_nsec.
9004         (Incremental_inputs::report_archive): Save mtime; style fix.
9005         (Incremental_inputs::report_obejct): Save mtime; style fix.
9006         (Incremental_inputs::report_script): Save mtime; style fix.
9007         (Incremental_inputs::finalize_inputs): Style fix.
9008         (Incremental_inputs::finalize): Style fix.
9009         (Incremental_inputs::create_input_section_data): Store inputs
9010         mtime.
9011         * incremental.h (Incremental_inputs::report_script): Add mtime
9012         argument.
9013         (Incremental_inputs::Input_info::Input_info): Intialize only one
9014         union member.
9015         (Incremental_inputs::Input_info::archive): Move to nameless
9016         union.
9017         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9018         (Incremental_inputs::Input_info::script): Move to nameless union.
9019         (Incremental_inputs::mtime): New field.
9020         * script.cc (read_input_script): Pass file mtime to
9021         Incremental_input.
9022         * script.h (Script_info::inputs): Style fix.
9023
9024 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9025
9026         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9027         instead of 32.
9028
9029 2009-06-24  Ian Lance Taylor  <iant@google.com>
9030
9031         PR 10156
9032         * layout.cc (Layout::choose_output_section): If we find an
9033         existing section, update the flags.
9034         (Layout::create_notes): New function, broken out of
9035         Layout::finalize.
9036         (Layout::finalize): Don't create note sections.
9037         (Layout::create_note): Don't crash if linker script discards
9038         section.
9039         (Layout::create_gold_note): Likewise.
9040         (Layout::create_build_id): Likewise.  Don't set
9041         after_input_sections on the section.
9042         (Layout::create_executable_stack_info): Remove target parameter.
9043         Change caller.
9044         * layout.h (class Layout): Declare create_notes.  Update
9045         declaration of create_executable_stack_info.
9046         * gold.cc (queue_middle_tasks): Call create_notes.
9047         * output.cc (Output_section::update_flags_for_input_section): Move
9048         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9049         invalid.
9050         * output.h (Output_data::mark_address_invalid): New function.
9051         (class Output_section): Only declare, not define,
9052         update_flags_for_input_section.  Remove set_flags.
9053
9054 2009-06-24  Ian Lance Taylor  <iant@google.com>
9055
9056         * script-sections.cc (Output_section_definition::
9057         set_section_addresses): Rename shadowing local load_address to
9058         laddr.
9059
9060 2009-06-24  Ian Lance Taylor  <iant@google.com>
9061
9062         PR 10244
9063         * reloc.cc (relocate_sections): Skip empty relocation sections.
9064
9065 2009-06-23  Ian Lance Taylor  <iant@google.com>
9066
9067         PR 10156
9068         * layout.cc (Layout::create_note): Use choose_output_section
9069         rather than make_output_section.
9070
9071 2009-06-23  Ian Lance Taylor  <iant@google.com>
9072
9073         PR 10237
9074         * options.cc (General_options::parse_V): Set printed_version_.
9075         (General_options::General_options): Initialize printed_version_.
9076         * options.h (class General_options): Add printed_version_ field.
9077         * gold.cc (queue_initial_tasks): If there are no input files,
9078         don't give a fatal error if we printed the version information.
9079         (queue_middle_tasks): If using -r with a shared object, give a
9080         fatal error rather than an ordinary error.
9081
9082 2009-06-23  Ian Lance Taylor  <iant@google.com>
9083
9084         PR 10219
9085         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9086         (Layout::make_output_section): Set have_stabstr_section_ if we see
9087         a .stab*str section.
9088         (Layout::finalize): Call link_stabs_sections.
9089         (Layout::link_stabs_sections): New file.
9090         * layout.h (class Layout): Add have_stabstr_section_ field.
9091         Declare link_stabs_sections.
9092
9093 2009-06-23  Doug Kwan  <dougkwan@google.com>
9094
9095         * Makefile.am (libgold_a_LIBADD): New.
9096         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9097         * Makefile.in: Regenerate.
9098         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9099         * configure: Regenerate.
9100         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9101         * fileread.cc: Include sys/state.h
9102         * gold.h: Declare memmem and strndup if found missing.
9103         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9104
9105 2009-06-23  Ian Lance Taylor  <iant@google.com>
9106
9107         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9108         * configure: Rebuild.
9109
9110 2009-06-23  Ian Lance Taylor  <iant@google.com>
9111
9112         PR 10147
9113         * object.cc (Object::section_contents): Don't try to get a view if
9114         the section has length zero.
9115         (Object::handle_gnu_warning_section): If the section is empty, use
9116         the name of the section as the warning.
9117
9118 2009-06-23  Ian Lance Taylor  <iant@google.com>
9119
9120         PR 10133
9121         * stringpool.h (class Stringpool_template): Add optimize_ field.
9122         (Stringpool_template::set_optimize): New function.
9123         * stringpool.cc (Stringpool_template::Stringpool_template):
9124         Initialize optimize_ field.
9125         (Stringpool_template::set_string_offsets): Test local optimize
9126         fild rather than parameter.
9127         * layout.cc (Layout::Layout): Call set_optimize on the section
9128         name stringpool.
9129
9130 2009-06-22  Ian Lance Taylor  <iant@google.com>
9131
9132         PR 10030
9133         * yyscript.y: Parse TARGET.
9134         * script.cc (script_set_target): New function.
9135         * script-c.h (script_set_target): Declare.
9136         * options.cc (General_options::string_to_object_format): Rename
9137         from string_to_object_format in anonymous namespace.  Change
9138         callers.
9139         * options.h (class General_options): Declare
9140         string_to_object_format.
9141
9142 2009-06-22  Ian Lance Taylor  <iant@google.com>
9143
9144         * script-sections.cc (Script_sections::create_segments): Don't put
9145         program headers in a PT_LOAD segment if -n or -N.
9146
9147 2009-06-22  Ian Lance Taylor  <iant@google.com>
9148
9149         PR 10141
9150         * options.h (class General_options): Add -z lazy and -z now.  Sort
9151         -z options into alphabetical order.
9152         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9153
9154 2009-06-21  Ian Lance Taylor  <iant@google.com>
9155
9156         * layout.cc (Layout::make_output_section): Call
9157         Target::new_output_section.
9158         (Layout::attach_allocated_section_to_segment): Put large section
9159         sections in a separate load segment with the large segment flag
9160         set.
9161         (Layout::segment_precedes): Sort large data segments after other
9162         load segments.
9163         (align_file_offset): New static function.
9164         (Layout::set_segment_offsets): Use align_file_offset.
9165         * output.h (class Output_section): Add is_small_section_ and
9166         is_large_section_ fields.
9167         (Output_section::is_small_section): New function.
9168         (Output_section::set_is_small_section):  New function.
9169         (Output_section::is_large_section): New function.
9170         (Output_section::set_is_large_section): New function.
9171         (Output_section::is_large_data_section): New function.
9172         (class Output_segment): Add is_large_data_segment_ field.
9173         (Output_segment::is_large_data_segment): New function.
9174         (Output_segment::set_is_large_data_segment): New function.
9175         * output.cc (Output_section::Output_section): Initialize new
9176         fields.
9177         (Output_segment::Output_segment): Likewise.
9178         (Output_segment::add_output_section): Add assertion that large
9179         data sections always go in large data segments.  Force small data
9180         sections to the end of the list of data sections.  Force small BSS
9181         sections to the start of the list of BSS sections.  For large BSS
9182         sections to the end of the list of BSS sections.
9183         * symtab.h (class Symbol): Declare is_common_shndx.
9184         (Symbol::is_defined): Check Symbol::is_common_shndx.
9185         (Symbol::is_common): Likewise.
9186         (class Symbol_table): Define enum Commons_section_type.  Update
9187         declarations.  Add small_commons_ and large_commons_ fields.
9188         * symtab.cc (Symbol::is_common_shndx): New function.
9189         (Symbol_table::Symbol_table): Initialize new fields.
9190         (Symbol_table::add_from_object): Put small and large common
9191         symbols in the right list.
9192         (Symbol_table::sized_finalized_symbol): Check
9193         Symbol::is_common_shndx.
9194         (Symbol_table::sized_write_globals): Likewise.
9195         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9196         common symbol lists.  Don't call do_allocate_commons_list if the
9197         list is empty.
9198         (Symbol_table::do_allocate_commons_list): Remove is_tls
9199         parameter.  Add comons_section_type parameter.  Change all
9200         callers.  Handle small and large common symbols.
9201         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9202         Symbol::is_common_shndx.
9203         * resolve.cc (symbol_to_bits): Likewise.
9204         * target.h (Target::small_common_shndx): New function.
9205         (Target::small_common_section_flags): New function.
9206         (Target::large_common_shndx): New function.
9207         (Target::large_common_section_flags): New function.
9208         (Target::new_output_section): New function.
9209         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9210         small_common_section_flags, and large_common_section_flags
9211         fields.
9212         (Target::do_new_output_section): New virtual function.
9213         * arm.cc (Target_arm::arm_info): Initialize new fields.
9214         * i386.cc (Target_i386::i386_info): Likewise.
9215         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9216         Likewise.
9217         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9218         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9219         (Target_x86_64::do_new_output_section): New function.
9220         * configure.ac: Define conditional MCMODEL_MEDIUM.
9221         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9222         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9223         (large_LDFLAGS): Define.
9224         * testsuite/large.c: New file.
9225         * testsuite/testfile.cc (Target_test::test_target_info):
9226         Initialize new fields.
9227         * configure, testsuite/Makefile.in: Rebuild.
9228
9229 2009-06-05  Doug Kwan  <dougkwan@google.com>
9230
9231         * Makefile.am (CCFILES): Add target.cc.
9232         * Makefile.in: Regenerate.
9233         * i386.cc (class Target_i386): Define new virtual method to
9234         override do_is_local_label_name in parent.
9235         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9236         local symbols if --discard-locals or -X is given.
9237         * options.h (class General_options): Declare new options
9238         '--discard-locals' and '-X' for discarding locals.
9239         * target.h (class Target): Define new methods is_local_label_name.
9240         Declare new virtual method do_is_local_label_name.
9241         * target.cc: New file.
9242         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9243         (check_SCRIPTS): Add discard_locals_test.sh.
9244         (check_DATA): Add discard_local_tests.syms.
9245         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9246         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9247         * testsuite/Makefile.in: Regenerate.
9248         * testsuite/discard_locals_test.c: New file.
9249         * testsuite/discard_locals_test.sh: Same.
9250
9251 2009-06-05  Doug Kwan  <dougkwan@google.com>
9252
9253         * object.cc (Sized_relobj::Sized_relobj): Initialize
9254         discarded_eh_frame_shndx_ to -1U.
9255         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9256         section.
9257         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9258         a discarded .eh_frame section.
9259         (Sized_relobj::do_finalize_local_symbols): Ditto.
9260         * object.h (class Sized_relobj): Declare new member
9261         discarded_eh_frame_shndx_.
9262         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9263         (local_labels_test.o, local_labels_test): New rules.
9264         * testsuite/Makefile.in: Regenerate.
9265
9266 2009-06-04  Doug Kwan  <dougkwan@google.com>
9267
9268         * layout.cc (Layout::section_name_mapping): Add mapping for
9269         special ARM sections.
9270
9271 2009-06-03  Doug Kwan  <dougkwan@google.com>
9272
9273         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9274         (utils::has_overflow): Same.
9275
9276 2009-06-03  Ian Lance Taylor  <iant@google.com>
9277
9278         * layout.cc (Layout::section_name_mapping): New array, replacing
9279         Layout::linkonce_mapping.
9280         (Layout::section_name_mapping_count): New variable, replacing
9281         Layout::linkonce_mapping_count.
9282         (Layout::linkonce_output_name): Remove.
9283         (Layout::output_section_name): Rewrite.
9284         * layout.h (class Layout): Rename Linkonce_mapping to
9285         Section_name_mapping, linkonce_mapping to section_name_mapping,
9286         linkonce_mapping_count to section_name_mapping_count.  Don't
9287         declare linkonce_output_name.
9288
9289 2009-06-03  Doug Kwan  <dougkwan@google.com>
9290
9291         * gold/arm.cc (namespace utils): New.
9292         (Target_arm::reloc_is_non_pic): Define new method.
9293         (class Arm_relocate_functions): New.
9294         (Target_arm::Relocate::relocate): Handle relocation types used by
9295         Android.
9296
9297 2009-06-03  Ian Lance Taylor  <iant@google.com>
9298
9299         * arm.cc (Target_arm::scan::global): Use || instead of |.
9300
9301 2009-06-02  Doug Kwan  <dougkwan@google.com>
9302
9303         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9304         issued_non_pic_error_.
9305         (class Target_arm::Scan): Declare new method check_non_pic.
9306         Define new method symbol_needs_plt_entry.
9307         Declare new data member issued_non_pic_error_.
9308         (class Target_arm::Relocate): Declare new method
9309         should_apply_static_reloc.
9310         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9311         (Target_arm::Scan::check_non_pic): Define new method.
9312         (Target_arm::Scan::local): Handle a small subset of reloc types used
9313         by Android.
9314         (Target_arm::Scan::local): Same.
9315         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9316
9317 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9318
9319         * incremental.cc (Incremental_inputs::report_command_line): Filter
9320         out --incremental-* options.
9321
9322 2009-05-29  Doug Kwan  <dougkwan@google.com>
9323
9324         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9325         template class.
9326         (class Target_arm): Update comment.
9327         (Target_arm::Target_arm): Initialize new data members GOT_,
9328         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9329         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9330         and Target_arm::rel_dyn_section.
9331         Declare new_enum Target_arm::Got_type.
9332         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9333         and DYNBSS_.
9334         Update commments for member do_dynsym_value.
9335         (Target_arm::got_size, Target_arm::plt_section,
9336         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9337         new methods inside class defintion.
9338         (Target_arm::got_section): Define new method.
9339         (Target_arm::rel_dyn_section): Same.
9340         (Output_data_plt_arm): New template class.
9341         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9342         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9343         (Output_data_plt_arm::add_entry): Same.
9344         (Output_data_plt_arm::first_plt_entry): Define new
9345         static data member for PLT instruction template.
9346         (Output_data_plt_arm::plt_entry): Same.
9347         (Output_data_plt_arm::do_write): Define new method.
9348         (Target_arm::make_plt_entry): Same.
9349         (Target_arm::do_finalize_sections): Same.
9350         (Target_arm::do_dynsym_value): Same.
9351
9352 2009-05-28  Doug Kwan  <dougkwan@google.com>
9353
9354         * Makefile.am (TARGETSOURCES): Add arm.cc.
9355         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9356         * Makefile.in: Regenerate.
9357         * arm.cc: New file.
9358         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9359
9360 2009-05-26  Doug Kwan  <dougkwan@google.com>
9361
9362         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9363         (General_options::check_excluded_libs): Strip off directories in
9364         archive name before matching like GNU ld does.
9365         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9366         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9367         (exclude_libs_test_LDFLAGS): Add linker option
9368         -Wl,--exclude-libs,libexclude_libs_test_3
9369         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9370         an explicit archive without using -l.
9371         (alt/libexclude_libs_test_3.a): New make rule.
9372         * testsuite/Makefile.in: Regenerate.
9373         * testsuite/exclude_libs_test.c : Declare lib3_default().
9374         (main): Call it.
9375         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9376         * exclude_libs_test_3.c: New file.
9377
9378 2009-05-26  Nick Clifton  <nickc@redhat.com>
9379
9380         * po/id.po: New Indonesian translation.
9381         * po/gold.pot: Updated template file.
9382
9383 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9384
9385         * testsuite/Makefile.am: Add -ffunction-sections to compile
9386         gc_comdat_test files.  Add -Wl,--gc-sections to build
9387         gc_comdat_test.
9388         * testsuite/Makefile.in: Regenerate.
9389         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9390
9391 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9392
9393         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9394         kept comdat section was garbage collected.
9395         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9396         * testsuite/Makefile.in: Regenerate.
9397         * testsuite/gc_comdat_test.sh: New file.
9398         * testsuite/gc_comdat_test_1.cc: New file.
9399         * testsuite/gc_comdat_test_2.cc: New file.
9400
9401 2009-05-19  Doug Kwan  <dougkwan@google.com>
9402
9403         * archive.cc (Archive::Archive): Move constructor from archive.h
9404         to here.  Initialize no_export_.
9405         (Archive::get_elf_object_for_member): Set no_export flag of object.
9406         * archive.h (Archive::Archive): Move constructor body to
9407         archive.cc.
9408         (Archive::no_export): New method.
9409         (Archive::no_export_): New field.
9410         * object.h (Object::Object): Initialize no_export_ to false.
9411         (Object::no_export, Object::set_no_export): New methods.
9412         (Object::no_export_): New field.
9413         * options.cc (General_options::parse_exclude_libs): New method.
9414         (General_options::check_excluded_libs) Same.
9415         * options.h (exclude_libs): New option.
9416         (General_options::check_excluded_libs): New method declaration.
9417         (General_options::excluded_libs_): New field.
9418         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9419         default or protected visibility if an object has no-export flag set.
9420         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9421         (check_SCRIPTS): Add exclude_libs_test.sh.
9422         (check_DATA): Add exclude_libs_test.syms.
9423         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9424         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9425         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9426         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9427         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9428         libexclude_libs_test_2.a): New rules.
9429         * testsuite/Makefile.in: Regenerate.
9430         * testsuite/exclude_libs_test.c: New file.
9431         * testsuite/exclude_libs_test.sh: Ditto.
9432         * testsuite/exclude_libs_test_1.c: Ditto.
9433         * testsuite/exclude_libs_test_2.c: Ditto.
9434
9435 2009-05-15  Ian Lance Taylor  <iant@google.com>
9436
9437         * configure.ac: Check for declarations for cases where libiberty.h
9438         checks HAVE_DECL_xxx.
9439         * configure, config.in: Rebuild.
9440
9441 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9442
9443         * gold.h (Incremental_argument_list): Remove (invalid) forward
9444         declaration.
9445         * incremental.cc (Incremental_inputs::report_achive): New method.
9446         (Incremental_inputs::report_object): New method.
9447         (Incremental_inputs::report_script): New method.
9448         (Incremental_inputs::finalize_inputs): New method.
9449         (Incremental_inputs::finalize): Call finalize_inputs().
9450         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9451         Create inputs entries.
9452         * incremental.h (Incremental_input_type): New enum.
9453         (Incremental_inputs::Incremental_input): Initialize new fields.
9454         (Incremental_inputs::report_inputs): New method.
9455         (Incremental_inputs::report_achive): New method.
9456         (Incremental_inputs::report_object): New method.
9457         (Incremental_inputs::report_script): New method.
9458         (Incremental_inputs::finalize_inputs): New method.
9459         (Incremental_inputs::Input_info): New struct.
9460         (Incremental_inputs::Input_info_map): New typedef.
9461         (Incremental_inputs::lock_): New field.
9462         (Incremental_inputs::Inputs_): New field.
9463         (Incremental_inputs::Inputs_map): New field.
9464         * main.cc (main): Call Incremental_input::report_inputs.
9465         * options.h (Input_argument_list): Typedef moved from
9466         Input_arguments.
9467         (Input_file_group::Files): Remove, use ::Input_argument_list.
9468         (Input_file_group::Input_argument_list): Remove, use
9469         ::Input_argument_list.
9470         * plugin.cc (Plugin_manager::add_input_file): Add error in
9471         incremental build.
9472         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9473         functions.
9474         * script.cc (read_input_script): Call
9475         Incremental_input::report_script.
9476         * script.h (Script_info): New class.
9477
9478 2009-04-27  Ian Lance Taylor  <iant@google.com>
9479
9480         * x86_64.cc (do_adjust_output_section): Set entsize to
9481         plt_entry_size.
9482
9483 2009-04-23  Elliott Hughes  <enh@google.com>
9484
9485         * output.cc (Output_file::close): After short writes, continue
9486         writing from the correct offset in the buffer being written.
9487
9488 2009-04-23  Chris Demetriou  <cgd@google.com>
9489
9490         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9491         * configure: Regenerate.
9492         * config.in: Regenerate.
9493         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9494         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9495
9496 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9497
9498         * incremental.cc (Incremental_inputs_header_data): Renamed from
9499         Incremental_input_header_data.
9500         (Incremental_inputs_header_data::data_size): New field.
9501         (Incremental_inputs_header_data::put_input_file_count): Renamed
9502         from input_file_count.
9503         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9504         from command_line_offset.
9505         (Incremental_inputs_header_data::put_reserved): Renamed from
9506         put_reserved.
9507         (Incremental_inputs_entry_data): Renamed from
9508         Incremental_input_entry_data.
9509         (Incremental_inputs_entry_data::data_size): New field.
9510         (Incremental_inputs::report_command_line): New method.
9511         (Incremental_inputs::finalize): New method.
9512         (Incremental_inputs::create_incremental_inputs_data): New method.
9513         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9514         * incremental.h: New file.
9515         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9516        (Layout::finalize): Create incremental inputs section in
9517         incremental builds.
9518        (Layout::create_incremental_info_sections): New method.
9519         * layout.h (Layout::incremental_inputs): New method.
9520        (Layout::create_incremental_info_sections): New method.
9521        (Layout::incremental_inputs_): New field.
9522         * main.cc (main): Notify Incremental_input of the command line.
9523
9524 2009-04-01  Ian Lance Taylor  <iant@google.com>
9525             Mikolaj Zalewski  <mikolajz@google.com>
9526
9527         * gold.h (reserve_unordered_map): Define, three versions, one for
9528         each version of Unordered_map.
9529         * layout.cc (Layout::Layout): Remove options parameter.  Add
9530         number_of_input_files parameter.  Don't initialize options_.
9531         Initialize number_of_input_files_ and resized_signatures_.  Move
9532         sections_are_attached_.
9533         (Layout::layout_group): Reserve space for group_signatures_.
9534         (Layout::find_or_add_kept_section): Change name parameter to be a
9535         reference.  Resize signatures_ map when it gets large enough.
9536         (Layout::layout_eh_frame): Use parameters->options() instead of
9537         this->options_.
9538         (Layout::make_output_section): Likewise.
9539         (Layout::attach_allocated_section_to_segment): Likewise.
9540         (Layout::finalize, Layout::create_executable_stack): Likewise.
9541         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9542         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9543         * layout.h (class Layout): Update declarations.  Remove options_
9544         field.  Add number_of_input_files_ and resized_signatures_
9545         fields.  Move sections_are_attached_ field.
9546         * main.cc (main): Pass number of input files to Layout
9547         constructor.  Don't pass options.
9548
9549 2009-03-30  Ian Lance Taylor  <iant@google.com>
9550
9551         * ffsll.c (ffsll): Correct implementation.
9552
9553 2009-03-27  Ian Lance Taylor  <iant@google.com>
9554
9555         * ffsll.c: New file.
9556         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9557         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9558         * ftruncate.c (ftruncate): Declare before definition.
9559         * mremap.c (mremap): Likewise.
9560         * pread.c (pread): Likewise.
9561         * configure, Makefile.in, config.in: Rebuild.
9562
9563         * mremap.c: New file.
9564         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9565         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9566         (mremap): Declare if HAVE_MREMAP is not defined.
9567         * configure, Makefile.in, config.in: Rebuild.
9568
9569 2009-03-27  Cary Coutant  <ccoutant@google.com>
9570
9571         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9572         position independent.
9573         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9574         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9575
9576 2009-03-24  Cary Coutant  <ccoutant@google.com>
9577
9578         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9579         an executable.
9580         (needs_dynamic_reloc): Likewise.
9581
9582 2009-03-24  Ian Lance Taylor  <iant@google.com>
9583
9584         * yyscript.y (file_cmd): Recognize EXTERN.
9585         (extern_name_list, extern_name_list_body): New nonterminals.
9586         * script.cc (script_add_extern): Define.
9587         * script-c.h (script_add_extern): Declare.
9588
9589 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9590
9591         * object.cc (is_elf_object): Define.
9592         * object.h (is_elf_object): Declare.
9593         * archive.cc (Archive::get_elf_object_for_member): Call
9594         is_elf_object.
9595         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9596
9597 2009-03-24  Elliott Hughes  <enh@google.com>
9598
9599         * output.cc (Output_file::map_anonymous): Define.
9600         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9601         try an anonymous one.  Report the size if the mmap fails.
9602         * output.h (class Output_file): Declare map_anonymous.
9603
9604 2009-03-24  Ian Lance Taylor  <iant@google.com>
9605
9606         * target-select.cc (instantiate_target): Don't acquire the lock if
9607         the instantiated_target_ field has already been set.
9608
9609 2009-03-23  Ian Lance Taylor  <iant@google.com>
9610
9611         * gold-threads.h (class Initialize_lock): Define.
9612         * gold-threads.cc (class Initialize_lock_once): Define.
9613         (initialize_lock_control): New static variable.
9614         (initialize_lock_pointer): New static variable.
9615         (initialize_lock_once): New static function.
9616         (Initialize_lock::Initialize_lock): Define.
9617         (Initialize_lock::initialize): Define.
9618         * target-select.h: Include "gold-threads.h".
9619         (class Target_selector): Add lock_ and initialize_lock_ fields.
9620         Don't define instantiate_target, just declare it.
9621         * target-select.cc (Target_selector::Target_selector): Initialize
9622         new fields.
9623         (Target_selector::instantiate_target): Define.
9624         * descriptors.h: Include "gold-threads.h".
9625         (class Descriptors): Add initialize_lock_ field.
9626         * descriptors.cc (Descriptors::Descriptors): Initialize new
9627         field.
9628         (Descriptors::open): Use initialize_lock_ field
9629         * errors.h (class Errors): Add initialize_lock_ field.
9630         * errors.cc (Errors::Errors): Initialize new field.
9631         (Errors::initialize_lock): Use initialize_lock_ field.
9632         * powerpc.cc (class Target_selector_powerpc): Remove
9633         instantiated_target_ field.  In do_recognize call
9634         instantiate_target rather than do_instantiate_target.  In
9635         do_instantiate_target just allocate a new target.
9636         * sparc.cc (class Target_selector_sparc): Likewise.
9637
9638         * freebsd.h: New file.
9639         * i386.cc: Include "freebsd.h".
9640         (Target_i386): Derive from Target_freebsd rather than
9641         Sized_target.
9642         (Target_selector_i386): Derive from Target_selector_freebsd rather
9643         than Target_selector.
9644         * x86_64.cc: Include "freebsd.h".
9645         (Target_x86_64): Derive from Target_freebsd rather than
9646         Sized_target.
9647         (Target_selector_x86_64): Derive from Target_selector_freebsd
9648         rather than Target_selector.
9649         * target.h (class Target): Add adjust_elf_header and
9650         do_adjust_elf_header.
9651         * output.cc (Output_file_header:: do_sized_write): Call target
9652         adjust_elf_header routine.
9653         * configure.tgt: Set targ_osabi.
9654         * configure.ac: Define GOLD_DEFAULT_OSABI.
9655         * parameters.cc (Parameters::default_target): Pass
9656         GOLD_DEFAULT_OSABI to select_target.
9657         * target-select.h (class Target_selector): Make instantiate_target
9658         protected rather than private.
9659         * Makefile.am (HFILES): Add freebsd.h.
9660         * configure, Makefile.in, config.in: Rebuild.
9661
9662         * merge.cc (do_add_input_section): Correct pend value.  Change
9663         message about last entry not being null terminated from error to
9664         warning.
9665
9666 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9667
9668         * incremental.cc: New file.
9669         * Makefile.am (CCFILES): Add incremental.cc.
9670         * Makefile.in: Rebuild.
9671
9672 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9673
9674         * layout.cc (Layout::output_section_name): Preserve names
9675         of '.note.' sections.
9676
9677 2009-03-19  Ian Lance Taylor  <iant@google.com>
9678
9679         * descriptors.cc (Descriptors::open): Check that the options are
9680         valid before using them.
9681
9682 2009-03-18  Ian Lance Taylor  <iant@google.com>
9683
9684         * script-sections.h: Include <list>.
9685         (class Script_sections): Change Sections_elements from std::vector
9686         to std::list.  Typedef public Elements_iterator.  Add
9687         orphan_section_placement_, data_segment_align_start_, and
9688         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9689         field.
9690         * script-sections.cc (class Orphan_section_placement): New class.
9691         (class Sections_element): Add virtual functions is_relro and
9692         orphan_section_init.  Remove virtual function place_orphan_here.
9693         (class Output_section_definition): Add is_relro and
9694         orphan_section_init.  Remove place_orphan_here.
9695         (class Orphan_output_section): Likewise.
9696         (Script_sections::Script_sections): Update for field changes.
9697         (Script_sections::data_segment_align): Set saw_data_segment_align_
9698         and data_segment_align_start_, not data_segment_align_index.
9699         (Script_sections::data_segment_relro_end): Check
9700         saw_data_segment_align_.  Use data_segment_align_start_ rather
9701         than data_segment_align_index_.
9702         (Script_sections::place_orphan): Rewrite to use
9703         Orphan_section_placement.
9704
9705 2009-03-17  Ian Lance Taylor  <iant@google.com>
9706
9707         * archive.cc (Archive::add_symbols): Check for a version attached
9708         to the symbol name in the archive map.
9709         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9710         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9711         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9712         (ver_test_11.a): New target.
9713         * testsuite/Makefile.in: Rebuild.
9714
9715         * configure.ac: Check for chsize and posix_fallocate.  Replace
9716         ftruncate.
9717         * ftruncate.c: New file, from gnulib.
9718         * output.cc (posix_fallocate): Define dummy version if not
9719         HAVE_POSIX_FALLOCATE.
9720         (Output_file::map): Call posix_fallocate rather than lseek and
9721         write.
9722         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9723         * configure, Makefile.in, config.in: Rebuild.
9724
9725 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9726
9727         * layout.h (Layout::create_note): Add section_name parameter.
9728         * layout.cc (Layout::create_note): Likewise.
9729         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9730
9731 2009-03-17  Ian Lance Taylor  <iant@google.com>
9732
9733         * descriptors.cc: Include "options.h".
9734         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9735         (Descriptors::open): Always use O_CLOEXEC when opening a new
9736         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9737         then set FD_CLOEXEC.
9738
9739         * sparc.cc (class Target_sparc): Add has_got_section.
9740         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9741         make sure we have a GOT section.
9742
9743         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9744         (Target_sparc::Scan::local): Likewise.
9745         (Target_sparc::Scan::global): Likewise.
9746         (Target_sparc::Relocate::relocate): Likewise.
9747         (Target_sparc::Relocate::relocate_tls): Likewise.
9748
9749         * symtab.cc (Symbol_table::define_default_version): New function,
9750         broken out of add_from_object.
9751         (Symbol_table::add_from_object): Call define_default_version.
9752         (Symbol_table::define_special_symbol): Add resolve_oldsym
9753         parameter.  Change all callers.  If the version for a symbol comes
9754         from a version script, resolve it with the symbol with the same
9755         name with no version.  Also add the symbol without a version if
9756         appropriate.
9757         (do_define_in_output_data): If resolving with oldsym, don't delete
9758         sym.
9759         (do_define_in_output_segment): Likewise.
9760         (do_define_as_constant): Likewise.
9761         * symtab.h (class Symbol_table): Update declarations.
9762
9763 2009-03-13  Ian Lance Taylor  <iant@google.com>
9764
9765         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9766         (Read_symbols::requeue): New function.
9767         (Read_symbols::do_read_symbols): If make_elf_object fails because
9768         the target type is not configured, and the file was searched for,
9769         issue a warning and retry with the next directory.
9770         (Add_symbols::run): If the file has an incompatible format, and
9771         it was searched for, requeue the Read_symbols task.  On error,
9772         release the object.
9773         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9774         dirindex parameter to constructor.  Change all callers.  Declare
9775         incompatible_warning and requeue.
9776         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9777         input_argument_ and input_group_ fields.  Add them to
9778         constructor.  Change all callers.
9779         (class Read_script): Add dirindex_ field.  Add it to constructor.
9780         Change all callers.
9781         * archive.cc (Archive::setup): Remove input_objects parameter.
9782         Change all callers.
9783         (Archive::get_file_and_offset): Likewise.
9784         (Archive::read_all_symbols): Likewise.
9785         (Archive::read_symbols): Likewise.
9786         (Archive::get_elf_object_for_member): Remove input_objects
9787         parameter.  Add punconfigured parameter.  Change all callers.
9788         (Archive::add_symbols): Change return type to bool.  Check return
9789         value of include_member.
9790         (Archive::include_all_members): Likewise.
9791         (Archive::include_member): Change return type to bool.  Return
9792         false if first included object has incompatible target.  Set
9793         included_member_ field.
9794         (Add_archive_symbols::run): If add_symbols returns false, requeue
9795         Read_symbols task.
9796         * archive.h (class Archive): Add included_member_ field.
9797         Initialize it in constructor.  Add input_file and searched_for
9798         methods.  Update declarations.
9799         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9800         input_argument_ fields.  Add them to constructor.  Change all
9801         callers.
9802         * script.cc: Include "target-select.h".
9803         (class Parser_closure): Add skip_on_incompatible_target_ and
9804         found_incompatible_target_ fields.  Add
9805         skip_on_incompatible_target parameter to constructor.  Change all
9806         callers.  Add methods skip_on_incompatible_target,
9807         clear_skip_on_incompatible_target, found_incompatible_target, and
9808         set_found_incompatible_target.
9809         (read_input_script): Add dirindex parameter.  Change all callers.
9810         If parser finds an incompatible target, requeue Read_symbols
9811         task.
9812         (script_set_symbol): Clear skip_on_incompatible_target in
9813         closure.
9814         (script_add_assertion, script_parse_option): Likewise.
9815         (script_start_sections, script_add_phdr): Likewise.
9816         (script_check_output_format): New function.
9817         * script.h (read_input_script): Update declaration.
9818         * script-c.h (script_check_output_format): Declare.
9819         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9820         (ignore_cmd): Remove OUTPUT_FORMAT.
9821         * fileread.cc (Input_file::Input_file): Add explicit this.
9822         (Input_file::will_search_for): New function.
9823         (Input_file::open): Add pindex parameter.  Change all callers.
9824         * fileread.h (class Input_file): Add input_file_argument method.
9825         Declare will_search_for.  Update declarations.
9826         * object.cc (make_elf_object): Add punconfigured parameter.
9827         Change all callers.
9828         * object.h (class Object): Make input_file public.  Add
9829         searched_for method.
9830         (make_elf_object): Update declaration.
9831         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9832         restart search.
9833         * dirsearch.h (class Dirsearch): Update declaration.
9834         * options.h (class General_options): Add --warn-search-mismatch.
9835         * parameters.cc (Parameters::is_compatible_target): New function.
9836         * parameters.h (class Parameters): Declare is_compatible_target.
9837         * workqueue.cc (Workqueue::add_blocker): New function.
9838         * workqueue.h (class Workqueue): Declare add_blocker.
9839
9840         * fileread.cc (Input_file::open): Remove options parameter.
9841         Change all callers.
9842         (Input_file::open_binary): Likewise.
9843         * script.cc (read_input_script): Likewise.
9844         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9845         options parameter from constructor.  Change all callers.
9846         (class Read_script): Likewise.
9847         * fileread.h (class Input_file): Update declarations.
9848         * script.h (read_input_script): Update declaration.
9849
9850 2009-03-10  Nick Clifton  <nickc@redhat.com>
9851
9852         * po/es.po: New Spanish translation.
9853
9854 2009-03-06  Cary Coutant  <ccoutant@google.com>
9855
9856         * options.cc (parse_short_option): Keep dash_z from registering itself.
9857
9858 2009-03-03  Ian Lance Taylor  <iant@google.com>
9859
9860         PR 9918
9861         * target-reloc.h (relocate_section): Pass output_section to
9862         relocate.
9863         * i386.cc (Target_i386::should_apply_static_reloc): Add
9864         output_section parameter.  Change all callers.
9865         (Target_i386::Relocate::relocate): Add output_section parameter.
9866         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9867         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9868         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9869         * testsuite/two_file_shared.sh: New script.
9870         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9871         (check_DATA): Add two_file_shared.dbg.
9872         (two_file_shared.dbg): New target.
9873         * testsuite/Makefile.in: Rebuild.
9874
9875 2009-03-01  Ian Lance Taylor  <iant@google.com>
9876
9877         * configure.ac: Check for byteswap.h.
9878         * configure: Rebuild.
9879         * config.in: Rebuild.
9880
9881 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9882
9883         * layout.cc (Layout::find_or_add_kept_section): New function.
9884         (Layout::add_comdat): Removed.
9885         * layout.h (struct Kept_section): Move out of class Layout.
9886         Remove trailing underscores from field names.  Add group_sections
9887         field.  Rename group_ field to is_group.  Change all uses.
9888         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9889         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9890         comdat_groups_ field.
9891         (Sized_relobj::include_section_group): Use
9892         find_or_add_kept_section and Kept_section::group_sections.
9893         (Sized_relobj::include_linkonce_section): Likewise.
9894         * object.cc (class Sized_relobj): Don't define Comdat_group or
9895         Comdat_group_table.  Remove find_comdat_group and
9896         add_comdat_group.  Remove comdat_groups_ field.
9897         * plugin.cc (include_comdat_group): Use
9898         Layout::find_or_add_kept_section.
9899
9900 2009-02-28  Ian Lance Taylor  <iant@google.com>
9901
9902         * README: --gc-sections and map files are now supported.  Document
9903         some build requirements.
9904
9905         PR 6992
9906         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9907         relocatable link set the value of the section symbol to zero.
9908         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9909         relocatable link don't include the section address in the local
9910         symbol value.
9911
9912 2009-02-27  Ian Lance Taylor  <iant@google.com>
9913
9914         PR 6811
9915         * options.h (class Search_directory): Add is_system_directory.
9916         (class General_options): Declare is_in_system_directory.
9917         * options.cc (get_relative_sysroot): Make static.
9918         (get_default_sysroot): Make static.
9919         (General_optoins::is_in_system_directory): New function.
9920         * fileread.cc (Input_file::is_in_system_directory): New function.
9921         * fileread.h (class Input_file): Declare is_in_system_directory.
9922         * object.h (class Object): Add is_in_system_directory.
9923         (class Input_objects): Remove system_library_directory_ field.
9924         * object.cc (Input_objects::add_object): Don't set
9925         system_library_directory_.
9926         (input_objects::found_in_system_library_directory): Remove.
9927         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9928         parameter.  Change all callers.
9929         (Symbol_table::sized_write_globals): Likewise.
9930         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9931         Call Object::is_in_system_directory.
9932         * symtab.h (class Symbol_table): Update declarations.
9933
9934         PR 5990
9935         * descriptors.h (Open_descriptor): Add is_on_stack field.
9936         * descriptors.cc (Descriptors::open): If the descriptor is on the
9937         top of the stack, remove it.  Initialize is_on_stack field.
9938         (Descriptors::release): Only add pod to stack if it is not on the
9939         stack already.
9940         (Descriptors::close_some_descriptor): Clear stack_next and
9941         is_on_stack fields.
9942
9943         PR 7091
9944         * output.cc (Output_section::find_starting_output_address): Rename
9945         from starting_output_address; add PADDR parameter; change return
9946         type.
9947         * output.h (class Output_section): Declare
9948         find_starting_output_address instead of starting_output_address.
9949         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9950         section symbol for which we can't find a merge section.
9951
9952         PR 9836
9953         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9954         hidden or internal, force the symbol to be local.
9955         * resolve.cc (Symbol::override_visibility): Define.
9956         (Symbol::override_base): Use override_visibility.
9957         (Symbol_table::resolve): Likewise.
9958         (Symbol::override_base_with_special): Likewise.
9959         (Symbol_table::override_with_special): If the visibility is hidden
9960         or internal, force the symbol to be local.
9961         * symtab.h (class Symbol): Add set_visibility and
9962         override_visibility.
9963         * testsuite/ver_test_1.sh: New file.
9964         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9965         (check_DATA): Add ver_test_1.syms.
9966         (ver_test_1.syms): New target.
9967         * testsuite/Makefile.in: Rebuild.
9968
9969 2009-02-25  Cary Coutant  <ccoutant@google.com>
9970
9971         * layout.cc (Layout::choose_output_section): Don't rename sections
9972         when using a linker script that has a SECTIONS clause.
9973         * Makefile.in: Regenerate.
9974
9975         * testsuite/Makefile.am (script_test_5.sh): New test case.
9976         * testsuite/Makefile.in: Regenerate.
9977         * testsuite/script_test_5.cc: New file.
9978         * testsuite/script_test_5.sh: New file.
9979         * testsuite/script_test_5.t: New file.
9980
9981 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9982
9983         * archive.cc (Archive::include_member): Update calls to add_symbols.
9984         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9985         the Layout argument.
9986         * dynobj.h (do_add_symbols): Add the Layout argument.
9987         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9988         Layout argument.
9989         * object.h (Object::add_symbols): Add the Layout argument.
9990         (Object::do_add_symbols): Add the Layout argument.
9991         (Sized_relobj::do_add_symbols): Add the Layout argument.
9992         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9993         Unify the two versions.
9994         (Add_plugin_symbols): Remove.
9995         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9996         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9997         (Add_plugin_symbols): Remove.
9998         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9999         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10000         (Add_symbols::run): Make it work with Pulginobj.
10001
10002 2009-02-06  Ian Lance Taylor  <iant@google.com>
10003
10004         * object.cc (Sized_relobj::do_layout): Make info message start
10005         with lower case letter.
10006
10007 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10008
10009         * binary.cc: Fix file comment.
10010
10011         * options.h (enum Incremental_disposition): Define.
10012         (class General_options): Add new options: --incremental,
10013         --incremental_changed, --incremental_unchanged,
10014         --incremental_unknown.  Add incremental_disposition_ and
10015         implicit_incremental_ fields.
10016         (General_options::incremental_disposition): New function.
10017         (class Position_dependent_options): Add incremental_disposition
10018         option.
10019         (Position_dependent_options::copy_from_options): Set incremental
10020         dispositions.
10021         * options.cc (General_options::parse_incremental_changed): New
10022         function.
10023         (General_options::parse_incremental_unchanged): New function.
10024         (General_options::parse_incremental_unknown): New function.
10025         (General_options::General_options): Initialize new fields
10026         incremental_disposition_ and implicit_incremental_.
10027         (General_options::finalize): Check for uasge of --incremental-*
10028         without --incremental.
10029
10030 2009-02-06  Chris Demetriou  <cgd@google.com>
10031
10032         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10033         pointer and to report location as the file name associated with
10034         the symbol.
10035         (gold_undefined_symbol_at_location): New function to replace the
10036         old gold_undefined_symbol functionality.
10037         * target-reloc.h (relocate_section): Update to use
10038         gold_undefined_symbol_at_location.
10039         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10040         Call gold_undefined_symbol function rather than gold_error.
10041         * errors.h (Errors::undefined_symbol): Take location as a
10042         string, rather than calculating it from a relocation.
10043         * errors.cc (Errors::fatal): Print "fatal error:" before the
10044         formatted message.
10045         (Errors::error, Errors::error_at_location): Print "error: "
10046         before the formatted message.
10047         (Errors::undefined_symbol): Take location as a string, rather
10048         than calculating it from a relocation.
10049         (gold_undefined_symbol_at_location): New function akin to
10050         old gold_undefined_symbol, calculates location from relocation.
10051         (gold_undefined_symbol): Change to take only a Symbol pointer
10052         and to report location as the file name associated with the symbol.
10053         * testsuite/debug_msg.sh: Update for changed error messages.
10054         * testsuite/undef_symbol.sh: Likewise.
10055
10056 2009-02-04  Duncan Sands  <baldrick@free.fr>
10057
10058         PR 9812
10059         * reduced_debug_output.h
10060         (Output_reduced_debug_abbrev_section::failed): Use format for
10061         gold_warning.
10062         (Output_reduced_debug_info_section::faild): Likewise.
10063
10064 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10065
10066         * script.cc (Lazy_demangler): New class.
10067         (Version_script_info::get_symbol_version_helper): Demangle a
10068         symbol only once.
10069
10070 2009-01-29  Cary Coutant  <ccoutant@google.com>
10071
10072         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10073         to __tls_get_addr.
10074         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10075
10076 2009-01-28  Ian Lance Taylor  <iant@google.com>
10077
10078         * version.cc (version_string): Bump to 1.9.
10079
10080         * gold.h: Include <cstring> and <stdint.h>.
10081         * version.cc: Include <cstdio>.
10082         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10083         warning.
10084         * reduced_debug_output.cc (insert_into_vector): Rename from
10085         Insert_into_vector; change all callers.  Use Swap_unaligned to
10086         avoid aliasing issue; remove union since it is unnecessary.
10087
10088 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10089
10090         * Makefile.am (CCFILES): Add gc.cc.
10091         (HFILES): Add gc.h.
10092         * Makefile.in: Regenerate.
10093         * gold.cc (Gc_runner): New class.
10094         (queue_initial_tasks): Call garbage collection related tasks
10095         when corresponding options are invoked.
10096         (queue_middle_gc_tasks): New function.
10097         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10098         processed early before laying out sections during garbage collection.
10099         * gold.h (queue_middle_gc_tasks): New function.
10100         (is_prefix_of): Move from "layout.cc".
10101         * i386.cc (Target_i386::gc_process_relocs): New function.
10102         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10103         * main.cc (main): Create object of class "Garbage_collection".
10104         * object.cc (Relobj::copy_symbols_data): New function.
10105         (Relobj::is_section_name_included): New function.
10106         (Sized_relobj::do_layout): Allow this function to be called twice
10107         during garbage collection and defer layout of section during the
10108         first call.
10109         * object.h (Relobj::get_symbols_data): New function.
10110         (Relobj::is_section_name_included): New function.
10111         (Relobj::copy_symbols_data): New function.
10112         (Relobj::set_symbols_data): New function.
10113         (Relobj::get_relocs_data): New function.
10114         (Relobj::set_relocs_data): New function.
10115         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10116         (Relobj::gc_process_relocs): New function.
10117         (Relobj::do_gc_process_relocs): New pure virtual function.
10118         (Relobj::sd_): New data member.
10119         (Sized_relobj::is_output_section_offset_invalid): New function.
10120         (Sized_relobj::do_gc_process_relocs): New function.
10121         * options.h (General_options::gc_sections): Modify to not be a no-op.
10122         (General_options::print_gc_sections): New option.
10123         * plugin.cc (Plugin_finish::run): Remove function call to
10124         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10125         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10126         * reloc.cc (Read_relocs::run): Add task to process relocs and
10127         determine unreferenced sections when doing garbage collection.
10128         (Gc_process_relocs): New class.
10129         (Sized_relobj::do_gc_process_relocs): New function.
10130         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10131         sections that are garbage collected.
10132         * reloc.h (Gc_process_relocs): New class.
10133         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10134         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10135         symbols whose corresponding sections are garbage collected.
10136         (Symbol_table::Symbol_table): Add new parameter for the garbage
10137         collection object.
10138         (Symbol_table::gc_mark_undef_symbols): New function.
10139         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10140         (Symbol_table::gc_mark_dyn_syms): New function.
10141         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10142         as garbage.
10143         (Symbol_table::add_from_object): Likewise.
10144         (Symbol_table::add_from_relobj): When building shared objects, do not
10145         treat externally visible symbols as garbage.
10146         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10147         table information for static and relocatable links.
10148         * symtab.h (Symbol_table::set_gc): New function.
10149         (Symbol_table::gc): New function.
10150         (Symbol_table::gc_mark_undef_symbols): New function.
10151         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10152         (Symbol_table::gc_mark_dyn_syms): New function.
10153         (Symbol_table::gc_): New data member.
10154         * target.h (Sized_target::gc_process_relocs): New pure virtual
10155         function.
10156         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10157         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10158
10159 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10160
10161         * options.h (General_options::gc_sections): Define as a no-op for now.
10162         (General_options::no_keep_memory): Ditto.
10163         (General_options::Bshareable): Define.
10164         * options.cc (General_options::finalize): Honor -Bshareable.
10165
10166 2009-01-20  Andreas Schwab  <schwab@suse.de>
10167
10168         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10169         read the value in the contents, since we don't use it.  Use the
10170         template endianness when writing.
10171         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10172
10173 2009-01-19  Andreas Schwab  <schwab@suse.de>
10174
10175         * configure.tgt (powerpc64-*): Fix targ_obj.
10176
10177 2009-01-15  Ian Lance Taylor  <iant@google.com>
10178
10179         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10180         local symbols when stripping all symbols.
10181
10182 2009-01-14  Cary Coutant  <ccoutant@google.com>
10183
10184         * output.cc (Output_reloc): Add explicit instantiations.
10185
10186 2009-01-14  Cary Coutant  <ccoutant@google.com>
10187
10188         * archive.cc (Archive::get_elf_object_for_member): Remove call
10189         to File_read::claim_for_plugin.
10190         * descriptors.cc (Descriptors::open): Remove reference to
10191         is_claimed.
10192         (Descriptors::claim_for_plugin): Remove.
10193         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10194         (Descriptors::is_claimed): Remove.
10195         (claim_descriptor_for_plugin): Remove.
10196         * fileread.cc (File_read::claim_for_plugin): Remove.
10197         * fileread.h (File_read::claim_for_plugin): Remove.
10198         (File_read::descriptor): Reopen descriptor if necessary.
10199         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10200         (Plugin_manager::all_symbols_read): Add task parameter. Change
10201         all callers.
10202         (Plugin_manager::get_input_file): New function.
10203         (Plugin_manager::release_input_file): New function.
10204         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10205         corresponding data member.
10206         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10207         and pass to base constructor. Change all callers.
10208         (get_input_file, release_input_file): New functions.
10209         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10210         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10211         (Plugin_manager::all_symbols_read): Add task parameter.
10212         (Plugin_manager::get_input_file): New function.
10213         (Plugin_manager::release_input_file): New function.
10214         (Plugin_manager::task_): New data member.
10215         (Pluginobj::Pluginobj): Add filesize parameter.
10216         (Pluginobj::filename): New function.
10217         (Pluginobj::descriptor): New function.
10218         (Pluginobj::filesize): New function.
10219         (Pluginobj::filesize_): New data member.
10220         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10221         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10222         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10223
10224         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10225         with archive libraries.
10226         * testsuite/Makefile.in: Regenerate.
10227         * testsuite/plugin_test.c (struct sym_info): New type.
10228         (get_input_file, release_input_file): New static variables.
10229         (onload): Capture new transfer vector entries.
10230         (claim_file_hook): Stop reading at end of file according to filesize.
10231         Factor out parsing of readelf output into separate function.
10232         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10233         APIs and get the source file name from the symbol table.  Convert
10234         source file name to corresponding object file name.  Print info
10235         message when adding new input files.
10236         (parse_readelf_line): New function.
10237         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10238         * testsuite/plugin_test_2.sh: Likewise.
10239         * testsuite/plugin_test_3.sh: Likewise.
10240         * testsuite/plugin_test_4.sh: New test case.
10241
10242 2009-01-07  Ian Lance Taylor  <iant@google.com>
10243
10244         * version.cc (version_string): Bump to 1.8.
10245
10246 2008-12-23  Cary Coutant  <ccoutant@google.com>
10247
10248         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10249         * plugin.cc (Plugin_manager::finish): Rename as
10250         layout_deferred_objects.  Move cleanup to separate function.
10251         (Plugin_manager::cleanup): New function.
10252         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10253         separately.
10254         * plugin.h (Plugin_manager::finish): Rename as
10255         layout_deferred_objects.
10256         (Plugin_manager::cleanup): New function.
10257         (Plugin_manager::cleanup_done): New field.
10258
10259 2008-12-23  Cary Coutant  <ccoutant@google.com>
10260
10261         * plugin.cc (is_visible_from_outside): New function.
10262         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10263         so we don't return "IR only" status for exported symbols or -r links.
10264
10265         * testsuite/Makefile.am (plugin_test_3): New test case.
10266         * testsuite/Makefile.in: Regenerate.
10267         * testsuite/plugin_test_3.sh: New file.
10268
10269 2008-12-22  Cary Coutant  <ccoutant@google.com>
10270
10271         * object.cc (Sized_relobj::layout_section): New function.
10272         (Sized_relobj::do_layout): Defer layout of input sections until after
10273         plugin has provided replacement files.
10274         (Sized_relobj::do_layout_deferred_sections): New function.
10275         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10276         (Relobj::layout_deferred_sections): New function.
10277         (Relobj::do_layout_deferred_sections): New function.
10278         (Sized_relobj::do_layout_deferred_sections): New function.
10279         (Sized_relobj::layout_section): New function.
10280         (Sized_relobj::Deferred_layout): New structure.
10281         (Sized_relobj::deferred_layout_): New field.
10282         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10283         Change all callers.  Layout deferred sections.
10284         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10285         references.
10286         (Plugin_hook::run): Move code from do_plugin_hook inline.
10287         (Plugin_hook::do_plugin_hook): Remove.
10288         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10289         (Plugin_manager::finish): Renamed, was cleanup.
10290         (Plugin_manager::should_defer_layout): New function.
10291         (Plugin_manager::add_deferred_layout_object): New function.
10292         (Plugin_manager::Deferred_layout_list): New type.
10293         (Plugin_manager::deferred_layout_objects_): New field.
10294         (Plugin_hook::do_plugin_hook): Remove.
10295
10296 2008-12-17  Ian Lance Taylor  <iant@google.com>
10297
10298         * options.h (class General_options): Add --no case for
10299         --export-dynamic.
10300
10301 2008-12-16  Cary Coutant  <ccoutant@google.com>
10302
10303         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10304         vector.
10305         (Plugin_manager::claim_file): Create plugin object even if
10306         plugin did not call the add_symbols callback.
10307         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10308         asking for more symbols than were added.
10309         * testsuite/Makefile.am (plugin_test_1): Add test case with
10310         no global symbols.
10311         (empty.syms): New target.
10312         * testsuite/Makefile.in: Regenerate.
10313         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10314         message. Don't call add_symbols if no globals.
10315         (all_symbols_read_hook): Don't provide replacement for empty
10316         claimed file.
10317
10318 2008-12-12  Ian Lance Taylor  <iant@google.com>
10319
10320         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10321         r_type == 0 for a local symbol with r_sym == 0.
10322         (scan_relocatable_relocs): Pass r_sym to
10323         local_non_section_strategy.
10324         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10325         r_sym parameter.
10326
10327         * configure.ac: Update test for TLS descriptors: they are
10328         supported as of glibc 2.9.
10329         * configure: Rebuild.
10330
10331 2008-12-11  Ian Lance Taylor  <iant@google.com>
10332
10333         PR 7091
10334         * target-reloc.h (Default_scan_relocatable_relocs): For each
10335         function, map r_type == 0 to RELOC_DISCARD.
10336
10337 2008-12-10  Cary Coutant  <ccoutant@google.com>
10338
10339         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10340         object to override a kept COMDAT group from a plugin object.
10341
10342 2008-12-09  Ian Lance Taylor  <iant@google.com>
10343
10344         PR 7088
10345         * yyscript.y (file_cmd): Handle INPUT.
10346
10347         * testsuite/initpri1.c: Change all declarations to be full
10348         prototypes by adding void, to avoid compiler warnings.
10349
10350 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10351
10352         * options.cc (General_options::parse_plugin_opt): New.
10353         (General_options::add_plugin): The argument now is just the filename.
10354         (General_options::add_plugin_option): New.
10355         * options.h (plugin_opt): New.
10356         (add_plugin): Change argument name.
10357         (add_plugin_option): New.
10358         * plugin.cc (Plugin::load): Don't parse the plugin option.
10359         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10360         (Plugin::add_option): New.
10361         (Plugin::args_): Change type.
10362         (Plugin::filename_): New.
10363         (Plugin_manager::add_plugin_option): New.
10364         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10365         * testsuite/Makefile.in: Regenerate.
10366
10367 2008-12-05  Cary Coutant  <ccoutant@google.com>
10368
10369         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10370         Handle --strip-lto-sections option.
10371         * options.h (strip_lto_sections): New option.
10372
10373 2008-12-01  Cary Coutant  <ccoutant@google.com>
10374
10375         * plugin.cc (ld_plugin_message): Change format parameter to const.
10376         Fix mismatch between new[] and delete.
10377
10378 2008-11-14  Cary Coutant  <ccoutant@google.com>
10379
10380         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10381         instead of -1U.
10382
10383 2008-11-05  Craig Silverstein  <csilvers@google.com>
10384
10385         * options.cc (General_options::parse_dynamic_list): New function.
10386         * options.h (General_options): New flags dynamic_list,
10387         dynamic_list_data, dynamic_list_cpp_new, and
10388         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10389         (General_options::in_dynamic_list): New function.
10390         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10391         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10392         (Lex::can_continue_name): Likewise.
10393         (yylex): Likewise.
10394         (read_script_file): New parameter script_options.
10395         (read_dynamic_list): New function.
10396         (Script_options::define_dynamic_list): New function.
10397         (dynamic_list_keyword_parsecodes): New variable.
10398         (dynamic_list_keywords): New variable.
10399         * script.h (Script_options::define_dynamic_list): New function
10400         prototype.
10401         (read_dynamic_list): New function prototype.
10402         * symtab.cc (strprefix): New macro.
10403         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10404         dynamic_list_data, dynamic_list_cpp_new, and
10405         dynamic_list_cpp_typeinfo.
10406         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10407         (dynamic_list_expr): New rule.
10408         (dynamic_list_nodes): Likewise.
10409         (dynamic_list_node): Likewise.
10410         * testsuite/Makefile.am (dynamic_list): New test.
10411         * testsuite/Makefile.in: Regenerated.
10412         * testsuite/dynamic_list.t: New file.
10413         * testsuite/dynamic_list.sh: New file.
10414
10415 2008-11-05  Craig Silverstein  <csilvers@google.com>
10416
10417         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10418         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10419         (t11_last): Likewise.
10420         * testsuite/ver_test_6.c (main): Likewise.
10421
10422 2008-10-07  Cary Coutant  <ccoutant@google.com>
10423
10424         * options.c (General_options::finalize): Add check for -static and
10425         -shared.
10426         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10427         is not empty.
10428
10429 2008-10-02  Cary Coutant  <ccoutant@google.com>
10430
10431         * plugin.cc (make_sized_plugin_object): Fix conditional
10432         compilation to work when not all targets are enabled.
10433
10434 2008-09-29  Cary Coutant  <ccoutant@google.com>
10435
10436         * archive.cc (Archive::get_file_and_offset): Use filename instead
10437         of name to get library path.
10438         (Archive::include_member): Unlock external member of a thin archive.
10439
10440         * testsuite/Makefile.am (TEST_AR): New variable.
10441         (thin_archive_test_1): New test.
10442         (thin_archive_test_2): New test.
10443         * testsuite/Makefile.in: Regenerate.
10444         * testsuite/thin_archive_main.cc: New file.
10445         * testsuite/thin_archive_test_1.cc: New file.
10446         * testsuite/thin_archive_test_2.cc: New file.
10447         * testsuite/thin_archive_test_3.cc: New file.
10448         * testsuite/thin_archive_test_4.cc: New file.
10449
10450 2008-09-29  Cary Coutant  <ccoutant@google.com>
10451
10452         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10453         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10454         instead of -1U.
10455         (Sized_relobj::do_finalize_local_symbols): Likewise.
10456         (Sized_relobj::map_to_kept_section): Likewise.
10457         * object.h (Sized_relobj::invalid_address): New constant.
10458         (Sized_relobj::do_output_section_offset): Check for invalid_address
10459         and return -1ULL.
10460         * output.cc (Output_reloc::local_section_offset): Use constant
10461         invalid_address instead of -1U.
10462         (Output_reloc::get_address): Likewise.
10463         (Output_section::output_address): Change -1U to -1ULL.
10464         * output.h (Output_reloc::invalid_address): New constant.
10465         * reloc.cc (Sized_relobj::write_sections): Use constant
10466         invalid_address instead of -1U.
10467         (Sized_relobj::relocate_sections): Likewise.
10468         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10469         values for merge sections.
10470         * target-reloc.h (relocate_for_relocatable): Use constant
10471         invalid_address instead of -1U.
10472
10473 2008-09-19  Cary Coutant  <ccoutant@google.com>
10474
10475         Add plugin functionality for link-time optimization (LTO).
10476         * configure.ac (plugins): Add --enable-plugins option.
10477         * configure: Regenerate.
10478         * config.in: Regenerate.
10479         * Makefile.am (LIBDL): New variable.
10480         (CCFILES): Add plugin.cc.
10481         (HFILES): Add plugin.h.
10482         (ldadd_var): Add LIBDL.
10483         * Makefile.in: Regenerate.
10484
10485         * archive.cc: Include "plugin.h".
10486         (Archive::setup): Don't preread archive symbols when using a plugin.
10487         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10488         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10489         files.
10490         (Archive::include_member): Add symbols from plugin objects.
10491         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10492         * descriptors.cc (Descriptors::open): Check for file descriptors
10493         abandoned by plugins.
10494         (Descriptors::claim_for_plugin): New function.
10495         * descriptors.h (Descriptors::claim_for_plugin): New function.
10496         (Open_descriptor::is_claimed): New field.
10497         (claim_descriptor_for_plugin): New function.
10498         * fileread.cc (File_read::claim_for_plugin): New function.
10499         * fileread.h (File_read::claim_for_plugin): New function.
10500         (File_read::descriptor): New function.
10501         * gold.cc: Include "plugin.h".
10502         (queue_initial_tasks): Add task to call plugin hooks for generating
10503         new object files.
10504         * main.cc: Include "plugin.h".
10505         (main): Load plugin libraries.
10506         * object.h (Pluginobj): Declare.
10507         (Object::pluginobj): New function.
10508         (Object::do_pluginobj): New function.
10509         (Object::set_target): New function.
10510         * options.cc: Include "plugin.h".
10511         (General_options::parse_plugin): New function.
10512         (General_options::General_options): Initialize plugins_ field.
10513         (General_options::add_plugin): New function.
10514         * options.h (Plugin_manager): Declare.
10515         (General_options): Add --plugin option.
10516         (General_options::has_plugins): New function.
10517         (General_options::plugins): New function.
10518         (General_options::add_plugin): New function.
10519         (General_options::plugins_): New field.
10520         * plugin.cc: New file.
10521         * plugin.h: New file.
10522         * readsyms.cc: Include "plugin.h".
10523         (Read_symbols::do_read_symbols): Check for archive before checking
10524         for ELF file.  Call plugin hooks to claim files.
10525         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10526         from a real object file; force override when processing replacement
10527         files.
10528         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10529         (Symbol::init_base_object): Likewise.
10530         (Symbol::init_base_output_data): Likewise.
10531         (Symbol::init_base_output_segment): Likewise.
10532         (Symbol::init_base_constant): Likewise.
10533         (Symbol::init_base_undefined): Likewise.
10534         (Symbol::output_section): Assert that object is not a plugin.
10535         (Symbol_table::add_from_pluginobj): New function.
10536         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10537         undefined.
10538         (Symbol_table::sized_write_globals): Likewise.
10539         (Symbol_table::add_from_pluginobj): Instantiate template.
10540         * symtab.h (Sized_pluginobj): Declare.
10541         (Symbol::in_real_elf): New function.
10542         (Symbol::set_in_real_elf): New function.
10543         (Symbol::in_real_elf_): New field.
10544         (Symbol_table::add_from_pluginobj): New function.
10545
10546         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10547         (LIBDL): New variable.
10548         (LDADD): Add LIBDL.
10549         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10550         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10551         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10552         (MOSTLYCLEANFILES): Likewise.
10553         * testsuite/Makefile.in: Regenerate.
10554         * testsuite/plugin_test.c: New file.
10555         * testsuite/plugin_test_1.sh: New file.
10556         * testsuite/plugin_test_2.sh: New file.
10557
10558 2008-09-16  Ian Lance Taylor  <iant@google.com>
10559
10560         * target-reloc.h (relocate_section): Check whether a symbol is
10561         defined by the ABI before reporting an undefined symbol error.
10562         * target.h (Target::is_defined_by_abi): Make parameter const.
10563         (Target::do_is_defined_by_abi): Likewise.
10564         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10565         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10566         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10567         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10568         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10569         * testsuite/Makefile.in: Rebuild.
10570
10571         * fileread.cc (make_view): Add casts to avoid warning.
10572
10573 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10574
10575         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10576         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10577
10578 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10579
10580         * options.h (General_options::output_is_executable): New.
10581         (General_options::output_is_pie): New.
10582         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10583         for shared libraries.
10584         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10585
10586 2008-09-11  Chris Demetriou  <cgd@google.com>
10587
10588         * options.h (origin): New -z option.
10589         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10590         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10591         in DT_FLAGS_1.
10592
10593 2008-09-05  Cary Coutant  <ccoutant@google.com>
10594
10595         * fileread.cc (File_read::make_view): Add check for attempt to map
10596         beyond end of file.
10597
10598 2008-09-05  Cary Coutant  <ccoutant@google.com>
10599
10600         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10601         explicit instantiations.
10602
10603 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10604
10605         PR gold/6858
10606         * options.cc (General_options::finalize): Allow undefined symbols
10607         in shlibs if linking -shared.
10608
10609         PR gold/6859
10610         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10611         symbols as not needing a dynsym entry.
10612
10613 2008-08-20  Craig Silverstein  <csilvers@google.com>
10614
10615         * fileread.cc (File_read::open): Do not lock the file unless it
10616         was successfully opened.
10617
10618 2008-08-14  Cary Coutant  <ccoutant@google.com>
10619
10620         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10621         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10622         * testsuite/tls_test.cc (struct int128): 128-bit struct
10623         for testing TLS relocs with non-zero addend.
10624         (v12): New TLS variable.
10625         (t12): New test.
10626         (t_last): Add check for v12.
10627         * testsuite/tls_test.h (t12): New function.
10628         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10629
10630 2008-08-13  Ian Lance Taylor  <iant@google.com>
10631
10632         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10633         set tls_segment_ or relro_segment_.
10634         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10635         when appropriate.
10636         * output.h (Output_section::clear_is_relro): New function.
10637         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10638         sections specially even when output_data_ is empty.
10639         (Output_segment::maximum_alignment): When first section is relro,
10640         only force alignment for PT_LOAD segments.
10641         * script.cc (script_data_segment_align): New function.
10642         (script_data_segment_relro_end): New function.
10643         * script-c.h (script_data_segment_align): Declare.
10644         (script_data_segment_relro_end): Declare.
10645         * script-sections.h (class Script_sections): Declare
10646         data_segment_align and data_segment_relro_end.  Add fields
10647         segment_align_index_ and saw_relro_end_.
10648         * script-sections.cc (class Sections_element): Add set_is_relro
10649         virtual function.  Add new bool* parameter to place_orphan_here.
10650         Add get_output_section virtual function.
10651         (class Output_section_definition): Add set_is_relro.  Add new
10652         bool* parameter to place_orphan_here.  Add get_output_section.
10653         Add is_relro_ field.
10654         (Output_section_definition::Output_section_definition): Initialize
10655         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10656         and is_relro_ fields.
10657         (Output_section_definition::place_orphan_here): Add is_relro
10658         parameter.
10659         (Output_section_definition::set_section_addresses): Set relro for
10660         output section.
10661         (Output_section_definition::alternate_constraint): Likewise.
10662         (class Orphan_output_section): Add new bool* parameter to
10663         place_orphan_here.  Add get_output_section.
10664         (Orphan_output_section::place_orphan_here): Add is_relro
10665         parameter.
10666         (Script_sections::Script_sections): Initialize
10667         data_segment_align_index_ and saw_relro_end_.
10668         (Script_sections::data_segment_align): New function.
10669         (Script_sections::data_segment_relro_end): New function.
10670         (Script_sections::place_orphan): Set or clear is_relro.
10671         (Script_sections::set_section_addresses): Force alignment of first
10672         TLS section.
10673         * yyscript.y (exp): Call script_data_segment_align and
10674         script_data_segment_relro_end.
10675         * testsuite/relro_script_test.t: New file.
10676         * testsuite/relro_test.cc (using_script): Declare.
10677         (t1, t2): Test using_script.
10678         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10679         (relro_script_test_SOURCES): Define.
10680         (relro_script_test_DEPENDENCIES): Define.
10681         (relro_script_test_LDFLAGS): Define.
10682         (relro_script_test_LDADD): Define.
10683         (relro_script_test.so): New target.
10684         * testsuite/Makefile.in: Rebuild.
10685
10686 2008-08-06  Cary Coutant <ccoutant@google.com>
10687
10688         * archive.cc (Archive::total_archives, Archive::total_members)
10689         (Archive::total_members_loaded): New variables.
10690         (Archive::setup): Add parameter.  Add option to preread
10691         archive symbols.
10692         (Archive::read_armap): Add counter.
10693         (Archive::get_file_and_offset): New function.
10694         (Archive::get_elf_object_for_member): New function.
10695         (Archive::read_all_symbols): New function.
10696         (Archive::read_symbols): New function.
10697         (Archive::add_symbols): Add counters.
10698         (Archive::include_all_members): Use armap to find members if it's
10699         already built.
10700         (Archive::include_member): Skip reading symbols if already read.
10701         Factored code into Archive::get_file_and_offset and
10702         Archive::get_elf_object_for_member.  Changed call to
10703         Mapfile::report_include_archive_member.
10704         (Archive::print_stats): New function.
10705         * archive.h: Declare Object and Read_symbols_data classes.
10706         (Archive::Archive): Add initializers for new members.
10707         (Archive::setup): Add parameter.
10708         (Archive::print_stats): New function.
10709         (Archive::total_archives, Archive::total_members)
10710         (Archive::total_members_loaded): New variables.
10711         (Archive::get_file_and_offset): New function.
10712         (Archive::get_elf_object_for_member): New function.
10713         (Archive::read_all_symbols): New function.
10714         (Archive::read_symbols): New function.
10715         (Archive::Archive_member): New class.
10716         (Archive::members_): New member.
10717         (Archive::num_members_): New member.
10718         * main.cc: Include archive.h.
10719         (main): Call Archive::print_stats.
10720         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10721         archive parameter; member_name is now the fully-decorated name.
10722         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10723         * options.h: (General_options): Add --preread-archive-symbols option.
10724         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10725         Archive::setup.
10726
10727 2008-08-04  Ian Lance Taylor  <iant@google.com>
10728
10729         * symtab.h (Symbol::use_plt_offset): New function.
10730         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10731         * powerpc.cc (Relocate::relocate): Likewise.
10732         * sparc.cc (Relocate::relocate): Likewise.
10733         * x86_64.cc (Relocate::relocate): Likewise.
10734         * testsuite/weak_plt.sh: New test.
10735         * testsuite/weak_plt_main.cc: New test.
10736         * testsuite/weak_plt_shared.cc: New test.
10737         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10738         (check_PROGRAMS): Add weak_plt.
10739         (check_DATA): Add weak_plt_shared.so.
10740         (weak_plt_main_pic.o, weak_plt): New targets.
10741         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10742         * testsuite/Makefile.in: Rebuild.
10743
10744         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10745         gcctestdir/ld.
10746         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10747         * testsuite/Makefile.in: Rebuild.
10748
10749 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10750
10751         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10752         * Makefile.in: Regenerate.
10753         * po/POTFILES.in: Regenerate.
10754
10755 2008-07-29  Ian Lance Taylor  <iant@google.com>
10756
10757         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10758         symbols before other symbols.
10759         * testsuite/script_test_2.cc (test_addr): Declare.
10760         (test_addr_alias): Declare.
10761         (main): Check that test_addr and test_addr_alias have the right
10762         values.
10763         * testsuite/script_test_2.t: Define test_addr_alias and
10764         test_addr.
10765
10766 2008-07-24  Ian Lance Taylor  <iant@google.com>
10767
10768         PR 5990
10769         * descriptors.cc: New file.
10770         * descriptors.h: New file.
10771         * gold-threads.h (class Hold_optional_lock): New class.
10772         * fileread.cc: Include "descriptors.h".
10773         (File_read::~File_read): Release descriptor rather than closing
10774         it.
10775         (File_read::open) [file]: Call open_descriptor rather than open.
10776         Set is_descriptor_opened_.
10777         (File_read::open) [memory]: Assert that descriptor is not open.
10778         (File_read::reopen_descriptor): New function.
10779         (File_read::release): Release descriptor.
10780         (File_read::do_read): Make non-const.  Reopen descriptor.
10781         (File_read::read): Make non-const.
10782         (File_read::make_view): Reopen descriptor.
10783         (File_read::do_readv): Likewise.
10784         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10785         Update declarations.
10786         * layout.cc: Include "descriptors.h".
10787         (Layout::create_build_id): Use open_descriptor rather than open.
10788         * output.cc: Include "descriptors.h".
10789         (Output_file::open): Use open_descriptor rather than open.
10790         * archive.cc (Archive::const_iterator): Change Archive to be
10791         non-const.
10792         (Archive::begin, Archive::end): Make non-const.
10793         (Archive::count_members): Likewise.
10794         * archive.h (class Archive): Update declarations.
10795         * object.h (Object::read): Make non-const.
10796         * Makefile.am (CCFILES): Add descriptors.cc.
10797         (HFILES): Add descriptors.h.
10798         * Makefile.in: Rebuild.
10799
10800         PR 6716
10801         * gold.h: Always include <clocale>.  Add Solaris workarounds
10802         following code in binutils/sysdep.h.
10803
10804         PR 6048
10805         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10806         this->eh_frame_hdr_ is NULL before using it.
10807
10808         * dynobj.cc (Versions::Versions): Update comment.
10809
10810         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10811         the base version name.
10812
10813         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10814         array size plus one.
10815         (Stringpool_template::set_string_offsets): Subtract one from key
10816         before using it as an array index.
10817         (Stringpool_template::get_offset_with_length): Likewise.
10818         (Stringpool_template::write_to_buffer): Likewise.
10819         * stringpool.h (Stringpool_template::get_offset_from_key):
10820         Likewise.
10821
10822 2008-07-23  Ian Lance Taylor  <iant@google.com>
10823
10824         PR 6658
10825         * object.h (Merged_symbol_value::value): Do our best to handle a
10826         negative addend.
10827
10828         PR 6647
10829         * script.cc (Version_script_info::get_versions): Don't add empty
10830         version tag to return value.
10831         (Version_script_info::get_symbol_version_helper): Change return
10832         type to bool.  Add pversion parameter.  Change all callers.
10833         (script_register_vers_node): Don't require a non-NULL tag.
10834         * script.h (class Version_script_info): Update declarations.
10835         (Version_script_info::get_symbol_version): Change return type to
10836         bool.  Add version parameter.  Change all callers.
10837         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10838         handling.  Handle an empty version from a version script.
10839         (Symbol_table::define_special_symbol): Likewise.
10840         * testsuite/ver_test_10.script: New file.
10841         * testsuite/ver_test_10.sh: New file.
10842         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10843         (check_DATA): Add ver_test_10.syms.
10844         (ver_test_10.syms, ver_test_10.so): New target.
10845         * testsuite/Makefile.in: Rebuild.
10846
10847 2008-07-23  Simon Baldwin  <simonb@google.com>
10848
10849         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10850         to zero for undefined symbols from dynamic libraries.
10851
10852 2008-07-23  Ian Lance Taylor  <iant@google.com>
10853
10854         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10855         Change all callers.
10856         * symtab.h (class Symbol_table): Update declaration.
10857         * testsuite/ver_test_9.cc: New file.
10858         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10859         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10860         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10861         (ver_test_9.so, ver_test_9.o): New targets.
10862         * testsuite/Makefile.in: Rebuild.
10863
10864 2008-07-22  Ian Lance Taylor  <iant@google.com>
10865
10866         * options.h (class General_options): Define --check-sections.
10867         * layout.cc (Layout::set_segment_offsets): Handle
10868         --check-sections.
10869
10870         * options.h (class General_options): Define -n/--nmagic and
10871         -N/--omagic.
10872         * options.cc (General_options::finalize): For -n/--nmagic or
10873         -N/--omagic, set -static.
10874         * layout.cc (Layout::attach_allocated_section_to_segment): If
10875         -N/--omagic, don't put read-only and read-write sections in
10876         different segments.
10877         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10878         finding a read-only segment.
10879         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10880         don't set the minimum segment alignment to the common page size,
10881         and don't set the file offset to the address modulo the page size.
10882         * script-sections.cc (Script_sections::create_segments): If
10883         -n/--omagic, don't put read-only and read-write sections in
10884         different segments.
10885
10886         * cref.cc: New file.
10887         * cref.h: New file.
10888         * options.h (class General_options): Add --print-symbol-counts.
10889         * main.cc (main): Issue defined symbol report if requested.
10890         * archive.cc (Archive::interpret_header): Make into a const member
10891         function.
10892         (Archive::add_symbols): Call Input_objects::archive_start and
10893         archive_stop.
10894         (Archive::const_iterator): Define new class.
10895         (Archive::begin, Archive::end): New functions.
10896         (Archive::include_all_members): Rewrite to use iterator.
10897         (Archive::count_members): New function.
10898         * archive.h (class Archive): Update declarations.
10899         (Archive::filename): New function.
10900         * object.cc: Include "cref.h".
10901         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10902         (Sized_relobj::do_get_global_symbol_counts): New function.
10903         (Input_objects::add_object): Add object to cross-referencer.
10904         (Input_objects::archive_start): New function.
10905         (Input_objects::archive_stop): New function.
10906         (Input_objects::print_symbol_counts): New function.
10907         * object.h: Declare Cref and Archive.
10908         (Object::get_global_symbol_counts): New function.
10909         (Object::do_get_global_symbol_counts): New pure virtual function.
10910         (class Sized_relobj): Add defined_count_ field.  Update
10911         declarations.
10912         (class Input_objects): Add cref_ field.  Update constructor.
10913         Update declarations.
10914         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10915         defined_count_.
10916         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10917         symbol counts.
10918         (Sized_dynobj::do_get_global_symbol_counts): New function.
10919         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10920         defined_count_.  Update declarations.  Define Symbols typedef.
10921         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10922         parameter.  Change all callers.
10923         (Symbol_table::add_from_dynobj): Add sympointers and defined
10924         parameters.  Change all callers.
10925         * symtab.h (class Symbol_table): Update declarations.
10926         * Makefile.am (CCFILES): Add cref.cc.
10927         (HFILES): Add cref.h.
10928         * Makefile.in: Rebuild.
10929
10930 2008-07-22  Simon Baldwin  <simonb@google.com>
10931
10932         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10933         to zero when writing undefined symbols.
10934
10935 2008-07-22  Ian Lance Taylor  <iant@google.com>
10936
10937         * output.cc (Output_section::add_input_section): Don't try to
10938         merge empty merge sections.
10939
10940 2008-07-21  Craig Silverstein  <csilvers@google.com>
10941
10942         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10943         Include symbol version in error message.
10944
10945 2008-07-20  Chris Demetriou  <cgd@google.com>
10946
10947         * configure.ac (gold_cv_c_random_seed): New configured variable.
10948         (RANDOM_SEED_CFLAGS): New substituted variable.
10949         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10950         * configure: Rebuild.
10951         * Makefile.in: Likewise.
10952         * testsuite/Makefile.in: Likewise.
10953
10954 2008-07-18  Ian Lance Taylor  <iant@google.com>
10955
10956         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10957         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10958         * testsuite/ver_test_main.cc (main): Call t4.
10959         (t4, t4_2a): Define.
10960         * testsuite/ver_test_2.cc (t4_2): Define.
10961         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10962         * testsuite/ver_test_4.cc (t4_2a): Define.
10963         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10964         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10965
10966 2008-07-17  Ian Lance Taylor  <iant@google.com>
10967
10968         * dynobj.cc (Versions::add_def): If we give an error about a
10969         missing version, go ahead and create the version anyhow.
10970
10971 2008-07-10  Ian Lance Taylor  <iant@google.com>
10972
10973         Handle output sections with more than 0x7fffffff bytes.
10974         * object.h (class Relobj): Change map_to_output_ to
10975         output_sections_, and just keep a section pointer.  Change all
10976         uses.  Move comdat group support to Sized_relobj.
10977         (Relobj::is_section_specially_mapped): Remove.
10978         (Relobj::output_section): Remove poff parameter.  Change all
10979         callers.
10980         (Relobj::output_section_offset): New function.
10981         (Relobj::set_section_offset): Rewrite.
10982         (Relobj::map_to_output): Remove.
10983         (Relobj::output_sections): New function.
10984         (Relobj::do_output_section_offset): New pure virtual function.
10985         (Relobj::do_set_section_offset): Likewise.
10986         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10987         group support from Relobj.  Update declarations.
10988         (Sized_relobj::get_output_section_offset): New function.
10989         (Sized_relobj::do_output_section_offset): New function.
10990         (Sized_relobj::do_set_section_offset): New function.
10991         * object.cc (Relobj::output_section_address): Remove.
10992         (Sized_relobj::Sized_relobj): Initialize new fields.
10993         (Sized_relobj::include_section_group): Cast find_kept_object to
10994         Sized_relobj.
10995         (Sized_relobj::include_linkonce_section): Likewise.
10996         (Sized_relobj::do_layout): Use separate arrays for output section
10997         and output offset.
10998         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10999         output_sections.
11000         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11001         output_sections and section_offsets.
11002         (Sized_relobj::write_local_symbols): Likewise.
11003         (map_to_kept_section): Compute output address directly.
11004         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11005         output_sections and section_offsets.
11006         (Sized_relobj::write_sections): Likewise.
11007         (Sized_relobj::relocate_sections): Likewise.
11008         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11009         * output.h (class Output_reloc): Update declarations.  Change
11010         u2_.relobj to Sized_relobj*.
11011         (class Output_data_reloc): Change add functions to use
11012         Sized_relobj*.
11013         * output.cc (Output_reloc::Output_reloc): Change relobj to
11014         Sized_relobj*.
11015         (Output_reloc::local_section_offset): Change return type to
11016         Elf_Addr.  Use get_output_section_offset.
11017         (Output_reloc::get_address): Likewise.
11018         (Output_section::is_input_address_mapped): Don't call
11019         is_section_specially_mapped.
11020         (Output_section::output_offset): Likewise.
11021         (Output_section::output_address): Likewise.
11022         (Output_section::starting_output_address): Likewise.
11023         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11024         parameter to Sized_relobj*.
11025         (Copy_relocs::need_copy_reloc): Likewise.
11026         (Copy_relocs::save): Likewise.
11027         * copy-relocs.h (class Copy_relocs): Update declarations.
11028         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11029         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11030         * target-reloc.h (relocate_for_relocatable): Change
11031         offset_in_output_section type to Elf_Addr.  Change code that uses
11032         it as well.
11033         * layout.cc (Layout::layout): Always set *off.
11034         * mapfile.cc (Mapfile::print_input_section): Use
11035         output_section_offset.
11036         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11037         Sized_relobj*.
11038         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11039         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11040         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11041
11042 2008-07-03  Ian Lance Taylor  <iant@google.com>
11043
11044         * layout.cc (Layout::include_section): Do not discard unrecognized
11045         SHT_STRTAB sections.
11046
11047 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11048
11049         * script.cc (Lex::can_continue_name): Make '?' allowable in
11050         version-script names.
11051         * testsuite/version_script.map: Change glob pattern to use '?'
11052
11053 2008-06-30  Manish Singh  <yosh@gimp.org>
11054
11055         PR 6585
11056         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11057         Correct typo.
11058
11059 2008-06-30  Ian Lance Taylor  <iant@google.com>
11060
11061         PR 6660
11062         PR 6682
11063         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11064         versions]: Don't try to read the value in the contents, since we
11065         don't use it.  Use the template endianness when writing.
11066
11067 2008-06-25  Cary Coutant  <ccoutant@google.com>
11068
11069         * fileread.cc (File_read::make_view): Assert on zero-length view.
11070         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11071         symbol table when there are no symbols to read.
11072
11073 2008-06-23  Craig Silverstein  <csilvers@google.com>
11074
11075         * version.cc (version_string): Bump to 1.7
11076
11077 2008-06-18  Craig Silverstein  <csilvers@google.com>
11078
11079         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11080         constant 0xFFFF to type Valtype.
11081         (Powerpc_relocate_functions::rel16_ha): Likewise.
11082
11083 2008-06-17  Ian Lance Taylor  <iant@google.com>
11084
11085         * output.h (Output_section::Input_section): Initialize p2align_ to
11086         zero for Output_section_data constructors.
11087         (Output_section::Input_section::addralign): If not an input
11088         section, return the alignment of the Output_section_data.
11089         * testsuite/copy_test.cc: New file.
11090         * testsuite/copy_test_1.cc: New file.
11091         * testsuite/copy_test_2.cc: New file.
11092         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11093         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11094         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11095         (copy_test_1_pic.o, copy_test_1.so): New targets.
11096         (copy_test_2_pic.o, copy_test_2.so): New targets.
11097         * testsuite/Makefile.in: Rebuild.
11098
11099         * script-sections.cc (Script_sections::place_orphan): Initialize
11100         local variable exact.
11101
11102 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11103
11104         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11105
11106 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11107             David S. Miller  <davem@davemloft.net>
11108
11109         * powerpc.cc: New file.
11110         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11111         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11112         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11113         * Makefile.in: Rebuild.
11114
11115 2008-06-09  Ian Lance Taylor  <iant@google.com>
11116
11117         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11118         <exception>.
11119         (throwing, orig_terminate): New static variables.
11120         (terminate_handler): New static function.
11121         (t2): Set terminate handler.
11122
11123 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11124
11125         PR 6584
11126         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11127         alignment.
11128
11129 2008-05-30  Cary Coutant  <ccoutant@google.com>
11130
11131         * archive.cc (Archive::include_all_members) Correct to step
11132         over symbol table and extended name table in thin archives.
11133
11134 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11135
11136         PR 6407
11137         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11138         calculation.
11139
11140 2008-05-28  Caleb Howe  <cshowe@google.com>
11141
11142         * reduced_debug_output.cc: New file.
11143         * reduced_debug_output.h: New file.
11144         * options.h (class General_options): Add --strip-debug-non-line.
11145         * options.cc (General_options::finalize): Add strip_debug_non_line
11146         to the strip heirarchy.
11147         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11148         fields.
11149         * layout.cc: Include "reduced_debug_output.h".
11150         (Layout::Layout): Initialize new fields.
11151         (line_only_debug_sections): New static array.
11152         (is_lines_only_debug_sections): New static inline function.
11153         (Layout::include_section): Handle --strip-debug-non-line.
11154         (Layout::make_output_section): If --strip-debug-non-line, build
11155         new output sections for .debug_abbrev and .debug_info.
11156         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11157         gold.  Warn about possible overflow.
11158         (read_signed_LEB_128): Likewise.
11159         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11160         (read_signed_LEB_128): Declare.
11161         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11162         (HFILES): Add reduced_debug_output.h.
11163         * Makefile.in: Rebuild.
11164
11165 2008-05-21  Ian Lance Taylor  <iant@google.com>
11166
11167         * mapfile.cc: New file.
11168         * mapfile.h: New file.
11169         * options.h (class General_options): Add -M/--print-map and -Map.
11170         * options.cc (General_options::finalize): Make -M equivalent to
11171         -Map -.
11172         * main.cc: Include <cstdio> and "mapfile.h".
11173         (main): Open mapfile if requested.
11174         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11175         constructor.  Change caller.
11176         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11177         (queue_middle_tasks): Likewise.
11178         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11179         declarations.
11180         * archive.cc: Include "mapfile.h".
11181         (Archive::add_symbols): Add mapfile parameter.  Change all
11182         callers.  Pass mapfile, symbol, and reason to include_member.
11183         (Archive::include_all_members): Add mapfile parameter.  Change all
11184         callers.
11185         (Archive::include_member): Add mapfile, sym, and why parameters.
11186         Change all callers.  Report inclusion to map file.
11187         * archive.h: Include "fileread.h".
11188         (class Archive): Update declarations.
11189         (Archive::file): New const method.
11190         (class Add_archive_symbols): Add mapfile_ field.  Update
11191         constructor.  Change all callers.
11192         * readsyms.h (class Read_symbols): Likewise.
11193         (class Finish_group): Likewise.
11194         (class Read_script): Likewise.
11195         * common.cc: Include "mapfile.h".
11196         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11197         all callers.
11198         (Symbol_table::do_allocate_commons): Likewise.
11199         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11200         symbol allocation to mapfile.
11201         * common.h (class Allocate_commons_task): Add mapfile_ field.
11202         Update constructor.  Change all callers.
11203         * symtab.h (class Symbol_table): Update declarations.
11204         * layout.cc: Include "mapfile.h".
11205         (Layout_task_runner::run): Print information to mapfile.
11206         (Layout::create_gold_note): Change Output_data_fixed_space to
11207         Output_data_zero_fill.
11208         (Layout::create_build_id): Likewise.
11209         (Layout::print_to_mapfile): New function.
11210         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11211         constructor.  Change caller.
11212         (class Layout): Declare print_to_mapfile.
11213         * output.cc (Output_section::Input_section::print_to_mapfile): New
11214         function.
11215         (Output_section::add_input_section): If producing a map, always
11216         add to input_sections_ list.
11217         (Output_section::do_print_to_mapfile): New function.
11218         (Output_segment::print_sections_to_mapfile): New function.
11219         (Output_segment::print_section_list_to_mapfile): New function.
11220         * output.h: Include "mapfile.h".
11221         (Output_data::print_to_mapfile): New function.
11222         (Output_data::do_print_to_mapfile): New virtual function.
11223         (Output_segment_headers::do_print_to_mapfile): New function.
11224         (Output_file_header::do_print_to_mapfile): New function.
11225         (Output_data_const::do_print_to_mapfile): New function.
11226         (class Output_data_const_buffer): Add map_name_ field.  Update
11227         constructor.  Change all callers.  Add do_print_to_mapfile
11228         function.
11229         (class Output_data_fixed_space): Likewise.
11230         (class Output_data_space): Likewise.
11231         (class Output_data_zero_fill): New class.
11232         (Output_data_strtab::do_print_to_mapfile): New function.
11233         (Output_data_reloc_base::do_print_to_mapfile): New function.
11234         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11235         (Output_data_group::do_print_to_mapfile): New function.
11236         (Output_data_got::do_print_to_mapfile): New function.
11237         (Output_data_dynamic::do_print_to_mapfile): New function.
11238         (Output_symtab_xindex::do_print_to_mapfile): New function.
11239         (class Output_section): Declare do_print_to_mapflie.  Declare
11240         print_to_mapfile in Input_section.
11241         (class Output_segment): Declare new functions.
11242         * object.h (Sized_relobj::symbol_count): New function.
11243         * script-sections.cc
11244         (Output_section_element_dot_assignment::set_section_addresses):
11245         Change Output_data_fixed_space to Output_data_zero_fill.
11246         (Output_data_expression::do_print_to_mapfile): New function.
11247         * script.cc (read_input_script): Add mapfile parameter.  Change
11248         all callers.
11249         * script.h (read_input_script): Update declaration.
11250         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11251         (Eh_frame::do_print_to_mapfile): New function.
11252         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11253         (Output_merge_string::do_print_to_mapfile): New function.
11254         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11255         function.
11256         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11257         function.
11258         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11259         function.
11260         * Makefile.am (CCFILES): Add mapfile.cc.
11261         (HFILES): Add mapfile.h.
11262         * Makefile.in: Rebuild.
11263
11264 2008-05-19  Ian Lance Taylor  <iant@google.com>
11265
11266         * options.h (class General_options): Add -z relro.
11267         * layout.cc (Layout::Layout): Initialize relro_segment_.
11268         (Layout::add_output_section_data): Return the output section.
11269         (Layout::make_output_section): Rcognize relro sections and mark
11270         them appropriately.
11271         (Layout::attach_allocated_section_to_segment): Put relro sections
11272         in a PT_GNU_RELRO segment.
11273         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11274         section as relro.
11275         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11276         PT_TLS segments.
11277         (Layout::linkonce_mapping): Map d.rel.ro.local to
11278         .data.rel.ro.local.
11279         (Layout::output_section_name): Us .data.rel.ro.local for any
11280         section which begins with that.
11281         * layout.h (class Layout): Update add_output_section_data
11282         declaration.  Add relro_segment_ field.
11283         * output.cc (Output_section::Output_section): Initialize is_relro_
11284         and is_relro_local_ fields.
11285         (Output_segment::add_output_section): Group relro sections.
11286         (Output_segment::is_first_section_relro): New function.
11287         (Output_segment::maximum_alignment): If there is a relro section,
11288         align the segment to the common page size.
11289         (Output_segment::set_section_addresses): Track whether we are
11290         looking at relro sections.  If the last section is a relro
11291         section, align to the common page size.
11292         (Output_segment::set_section_list_addresses): Add in_relro
11293         parameter.  Change all callers.  Align to the page size when
11294         moving from relro to non-relro section.
11295         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11296         segment.
11297         * output.h (class Output_section): Add is_relro_ and
11298         is_relro_local_ fields.
11299         (Output_section::is_relro): New function.
11300         (Output_section::set_is_relro): New function.
11301         (Output_section::is_relro_local): New function.
11302         (Output_section::set_is_relro_local): New function.
11303         (class Output_segment): Update declarations.
11304         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11305         * sparc.cc (Target_sparc::got_section): Likewise.
11306         * x86_64.cc (Target_x86_64::got_section): Likewise.
11307         * testsuite/relro_test_main.cc: New file.
11308         * testsuite/relro_test.cc: New file.
11309         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11310         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11311         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11312         (relro_test.so, relro_test_pic.o): New targets.
11313         * testsuite/Makefile.in: Rebuild.
11314
11315 2008-05-16  Ian Lance Taylor  <iant@google.com>
11316
11317         * output.cc (Output_segment::add_output_section): Remove front
11318         parameter.
11319         * output.h (class Output_segment): Remove
11320         add_initial_output_section and overloaded add_output_section.
11321         Update declaration of remaining add_output_section.
11322         * layout.cc (Layout::create_interp): Call add_output_section
11323         rather than add_initial_output_section.
11324         (Layout::finish_dynamic_section): Likewise.
11325
11326         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11327         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11328         know the dynamic type.
11329         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11330         field.  Initialize it in constructor.
11331         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11332         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11333         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11334         reloc.
11335
11336         * output.cc (Output_reloc::get_address): Change return type to
11337         Elf_Addr.
11338         * output.h (class Output_reloc): Update get_address declaration.
11339         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11340         for section addresses.
11341
11342 2008-05-09  Ian Lance Taylor  <iant@google.com>
11343
11344         PR 6493
11345         * gold.cc (gold_nomem): Use return value of write.
11346
11347 2008-05-08  Ian Lance Taylor  <iant@google.com>
11348
11349         * symtab.c (Symbol::init_base_output_data): Add version
11350         parameter.  Change all callers.
11351         (Symbol::init_base_output_segment): Likewise.
11352         (Symbol::init_base_constant): Likewise.
11353         (Symbol::init_base_undefined): Likewise.
11354         (Sized_symbol::init_output_data): Likewise.
11355         (Sized_symbol::init_output_segment): Likewise.
11356         (Sized_symbol::init_constant): Likewise.
11357         (Sized_symbol::init_undefined): Likewise.
11358         (Symbol_table::do_define_in_output_data): If the new symbol has a
11359         version, mark it as the default.
11360         (Symbol_table::do_define_in_output_segment): Likewise.
11361         (Symbol_table::do_define_as_constant): Likewise.
11362         * symtab.h (class Symbol): Update declarations.
11363         (class Sized_symbol): Likewise.
11364         * resolve.cc (Symbol::override_version): New function.
11365         (Symbol::override_base): Call override_version.
11366         (Symbol::override_base_with_special): Likewise.
11367         * testsuite/ver_script_8.script: New file.
11368         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11369         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11370         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11371         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11372
11373 2008-05-06  Ian Lance Taylor  <iant@google.com>
11374
11375         PR 6049
11376         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11377         functions.
11378         (class General_options): Remove existing --undefined, and add
11379         --no-undefined instead.  Add new --undefined as synonym for -u.
11380         * archive.cc (Archive::add_symbols): Check whether symbol was
11381         named with -u.
11382         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11383         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11384         all uses.  Add IS_UNDEFINED.  Update declarations to split
11385         different versions of init_base.  Declare init_base_undefined.
11386         (Symbol::is_defined): Handle IS_UNDEFINED.
11387         (Symbol::is_undefined): Likewise.
11388         (Symbol::is_weak_undefined): Call is_undefined.
11389         (Symbol::is_absolute): Handle IS_CONSTANT.
11390         (class Sized_symbol): Update declarations to split different
11391         versions of init.  Declare init_undefined.
11392         (class Symbol_table): Declare new functions.
11393         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11394         Change all callers.
11395         (Symbol::init_base_output_data): Likewise.
11396         (Symbol::init_base_output_segment): Likewise.
11397         (Symbol::init_base_constant): Likewise.
11398         (Symbol::init_base_undefined): New function.
11399         (Sized_symbol::init_object): Rename from init.  Change all
11400         callers.
11401         (Sized_symbol::init_output_data): Likewise.
11402         (Sized_symbol::init_output_segment): Likewise.
11403         (Sized_symbol::init_constant): Likewise.
11404         (Sized_symbol::init_undefined): New function.
11405         (Symbol_table::add_undefined_symbols_from_command_line): New
11406         function.
11407         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11408         function.
11409         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11410         (Symbol::output_section): Likewise.
11411         (Symbol::set_output_section): Likewise.
11412         (Symbol_table::sized_finalize_symbol): Likewise.
11413         (Symbol_table::sized_write_globals): Likewise.
11414         * resolve.cc (Symbol_table::should_override): Likewise.
11415         (Symbol::override_base_with_special): Likewise.
11416
11417         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11418         symbol, change it to have default visibility.
11419         * testsuite/protected_1.cc: New file.
11420         * testsuite/protected_2.cc: New file.
11421         * testsuite/protected_3.cc: New file.
11422         * testsuite/protected_main_1.cc: New file.
11423         * testsuite/protected_main_2.cc: New file.
11424         * testsuite/protected_main_3.cc: New file.
11425         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11426         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11427         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11428         (protected_1.so): New target.
11429         (protected_1_pic.o, protected_2_pic.o): New targets.
11430         (protected_3_pic.o): New target.
11431         (check_PROGRAMS): Add protected_2.
11432         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11433         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11434         * testsuite/Makefile.in: Rebuild.
11435
11436         * options.h (DEFINE_var): Add set_user_set_##varname__.
11437         (DEFINE_bool_alias): New macro.
11438         (class General_options): Define -Bstatic using DEFINE_bool_alias
11439         rather than DEFINE_special.  Add --undefined as an alias for -z
11440         defs.
11441         * options.cc (General_options::parse_Bstatic): Remove.
11442
11443         * options.h (class General_options): Add --fatal-warnings.
11444         * main.cc (main): Implement --fatal-warnings.
11445         * errors.h (Errors::warning_count): New function.
11446
11447         * options.h (class General_options): Add -Bsymbolic-functions.
11448         * symtab.h (Symbol::is_preemptible): Check for
11449         -Bsymbolic-functions.
11450
11451 2008-05-05  Ian Lance Taylor  <iant@google.com>
11452
11453         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11454         as noVARNAME rather than no-VARNAME.
11455         (class General_options): Add option -z combreloc.
11456         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11457         get_address.
11458         (Output_reloc::sort_before) [SHT_REL]: New function.
11459         (Output_reloc::sort_before) [SHT_RELA]: New function.
11460         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11461         Sort_relocs_comparison.
11462         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11463         parameter.  Change all callers.
11464         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11465         sort_relocs parameter.  Change all callers.
11466         * output.cc (Output_reloc::get_address): New function, broken out
11467         of write_rel.
11468         (Output_reloc::write_rel): Call it.
11469         (Output_reloc::compare): New function.
11470         (Output_data_reloc_base::do_write): Optionally sort relocs.
11471
11472         * configure.ac: If targ_extra_obj is set, link it in.
11473         * configure.tgt: Initialize all variables.
11474         (x86_64*): Set targ_extra_obj and targ_extra_size.
11475         * configure: Rebuild.
11476
11477         * object.cc (Sized_relobj::include_section_group): Adjust section
11478         indexes read from group data.  Build vector to pass to
11479         layout_group.
11480         * layout.cc (Layout::layout_group): Add flags and shndxes
11481         parameters.  Remove contents parameter.  Change caller.  Update
11482         explicit instantiations.
11483         * layout.h (class Layout): Update layout_group declaration.
11484         * output.cc (Output_data_group::Output_data_group): Add flags and
11485         input_shndxes parameters.  Remove contents parameter.  Change
11486         caller.
11487         (Output_data_group::do_write): Change input_sections_ to
11488         input_shndxes_.
11489         * output.h (class Output_data_group): Update constructor
11490         declaration.  Rename input_sections_ to input_shndxes_.
11491         * testsuite/many_sections_test.cc: Add template.
11492
11493 2008-04-30  Cary Coutant  <ccoutant@google.com>
11494
11495         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11496
11497         * layout.cc (Layout::include_section): Refactored check for debug
11498         info section.
11499         (Layout::add_comdat): Add new parameters.  Change type
11500         of signature parameter.  Add object and shndx to signatures table.
11501         (Layout::find_kept_object): New function.
11502         * layout.h: Include <cstring>.
11503         (Layout::is_debug_info_section): New function.
11504         (Layout::add_comdat): Add new parameters.
11505         (Layout::find_kept_object): New function.
11506         (Layout::Kept_section): New struct.
11507         (Layout::Signatures): Change type of map range.
11508         * object.cc (Relobj::output_section_address): New function.
11509         (Sized_relobj::include_section_group): Add new parameters.  Change
11510         calls to Layout::add_comdat.  Change to build table of kept comdat
11511         groups and table mapping discarded sections to kept sections.
11512         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11513         (Sized_relobj::do_layout): Change calls to include_section_group and
11514         include_linkonce_section.
11515         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11516         value to zero when section is discarded.
11517         (Sized_relobj::map_to_kept_section): New function.
11518         * object.h (Relobj::output_section_address): New function.
11519         (Relobj::Comdat_group): New type.
11520         (Relobj::find_comdat_group): New function.
11521         (Relobj::Comdat_group_table): New type.
11522         (Relobj::Kept_comdat_section): New type.
11523         (Relobj::Kept_comdat_section_table): New type.
11524         (Relobj::add_comdat_group): New function.
11525         (Relobj::set_kept_comdat_section): New function.
11526         (Relobj::get_kept_comdat_section): New function.
11527         (Relobj::comdat_groups_): New field.
11528         (Relobj::kept_comdat_sections_): New field.
11529         (Symbol_value::input_value): Update comment.
11530         (Sized_relobj::map_to_kept_section) New function.
11531         (Sized_relobj::include_linkonce_section): Add new parameter.
11532         * target-reloc.h (Comdat_behavior): New type.
11533         (get_comdat_behavior): New function.
11534         (relocate_section): Add code to map a discarded section to the
11535         corresponding kept section when applying a relocation.
11536
11537 2008-04-30  Craig Silverstein  <csilvers@google.com>
11538
11539         * dwarf_reader.cc (next_generation_count): New static var.
11540         (Addr2line_cache_entry): New struct.
11541         (addr2line_cache): New static var.
11542         (Dwarf_line_info::one_addr2line): Added caching.
11543         (Dwarf_line_info::clear_addr2line_cache): New function.
11544         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11545         cache-size parameter.
11546         (Dwarf_line_info::one_addr2line_cache): New function.
11547         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11548         new cache-size argument to one_addr2line(), and clear cache.
11549
11550 2008-04-28  Cary Coutant  <ccoutant@google.com>
11551
11552         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11553         R_386_PC8 relocations.
11554
11555 2008-04-23  Ian Lance Taylor  <iant@google.com>
11556
11557         * object.cc (Sized_relobj::include_section_group): Check for
11558         invalid section group.
11559
11560         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11561         header size.
11562
11563         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11564         than read for file header.
11565         * archive.cc (Archive::include_member): Likewise.
11566
11567 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11568
11569         * aclocal.m4: Regenerate.
11570         * configure: Regenerate.
11571
11572 2008-04-19  Ian Lance Taylor  <iant@google.com>
11573
11574         * version.cc (version_string): Bump to 1.6.
11575
11576         * testsuite/Makefile.am (many_sections_r_test): New target.
11577         (many_sections_r_test_SOURCES): Remove.
11578         (many_sections_r_test_DEPENDENCIES): Remove.
11579         (many_sections_r_test_LDFLAGS): Remove.
11580         (many_sections_r_test_LDADD): Remove.
11581
11582         * object.cc (Sized_relobj::do_add_symbols): Always pass
11583         local_symbol_count_ to add_from_relobj.
11584
11585         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11586         every thousand variables.
11587         * testsuite/Makefile.in: Rebuild.
11588
11589         * object.cc (Xindex::initialize_symtab_xindex): New function.
11590         (Xindex::read_symtab_xindex): New function.
11591         (Xindex::sym_xindex_to_shndx): New function.
11592         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11593         available.
11594         (Sized_relobj::do_initialize_xindex): New function.
11595         (Sized_relobj::do_read_symbols): Adjust section links.
11596         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11597         parameter.  Change all callers.
11598         (Sized_relobj::include_section_group): Adjust section links and
11599         symbol section indexes.
11600         (Sized_relobj::do_layout): Adjust section links.
11601         (Sized_relobj::do_count_local_symbols): Adjust section links and
11602         symbol section indexes.
11603         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11604         ordinary and special symbols.
11605         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11606         dynsym_xindex parameters.  Change all callers.  Adjust section
11607         links.  Use SHN_XINDEX when needed.
11608         (Sized_relobj::get_symbol_location_info): Adjust section links.
11609         Don't get fooled by special symbols.
11610         * object.h (class Xindex): Define.
11611         (class Object): Add xindex_ parameter.  Declare virtual functoin
11612         do_initialize_xindex.
11613         (Object::adjust_sym_shndx): New function.
11614         (Object::set_xindex): New protected function.
11615         (class Symbol_value): Add is_ordinary_shndx_ field.
11616         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11617         (Symbol_value::value): Assert ordinary section.
11618         (Symbol_value::initialize_input_to_output_map): Likewise.
11619         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11620         Change all callers.
11621         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11622         all callers.
11623         (class Sized_relobj): Update declarations.
11624         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11625         parameter.  Change all callers.
11626         (Sized_relobj::adjust_shndx): New function.
11627         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11628         field.
11629         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11630         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11631         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11632         (Sized_dynobj::read_dynsym_section): Adjust section links.
11633         (Sized_dynobj::read_dynamic): Likewise.
11634         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11635         section links.
11636         (Sized_dynobj::do_initialize_xindex): New function.
11637         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11638         do_initialize_xindex.
11639         (Sized_dynobj::adjust_shndx): New function.
11640         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11641         dynsym_xindex_ fields.
11642         (Layout::finalize): Add a call to set_section_indexes before
11643         creating the symtab sections.
11644         (Layout::set_section_indexes): Don't do anything if the section
11645         already has a section index.
11646         (Layout::create_symtab_sections): Add shnum parameter.  Change
11647         caller.  Create .symtab_shndx section if needed.
11648         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11649         caller.
11650         (Layout::allocated_output_section_count): New function.
11651         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11652         needed.
11653         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11654         fields.  Update declarations.
11655         (Layout::symtab_xindex): New function.
11656         (Layout::dynsym_xindex): New function.
11657         (class Write_symbols_task): Add layout_ field.
11658         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11659         Change caller.
11660         * output.cc (Output_section_headers::Output_section_headers): Add
11661         shstrtab_section parameter.  Change all callers.
11662         (Output_section_headers::do_sized_write): Store overflow values
11663         for section count and section string table section index in
11664         section header zero.
11665         (Output_file_header::do_sized_write): Check for overflow of
11666         section count and section string table section index.
11667         (Output_symtab_xindex::do_write): New function.
11668         (Output_symtab_xindex::endian_do_write): New function.
11669         * output.h (class Output_section_headers): Add shstrtab_section_.
11670         Update declarations.
11671         (class Output_symtab_xindex): Define.
11672         (Output_section::has_out_shndx): New function.
11673         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11674         field.
11675         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11676         Change all callers.
11677         (Sized_symbol::init): Likewise.
11678         (Symbol::output_section): Check for ordinary symbol.
11679         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11680         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11681         callers.
11682         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11683         Change all callers.  Simplify handling of symbols from sections
11684         not included in the link.
11685         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11686         distinction.
11687         (Weak_alias_sorter::operator()): Assert that symbols are
11688         ordinary.
11689         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11690         distinction.
11691         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11692         parameters.  Change all callers.
11693         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11694         symbol distinction.  Use SHN_XINDEX when needed.
11695         (Symbol_table::write_section_symbol): Add symtab_xindex
11696         parameter.  Change all callers.
11697         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11698         SHN_XINDEX when needed.
11699         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11700         declarations.
11701         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11702         (Symbol::is_defined): Check is_ordinary.
11703         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11704         (Symbol::is_absolute, Symbol::is_common): Likewise.
11705         (class Sized_symbol): Update declarations.
11706         (class Symbol_table): Update declarations.
11707         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11708         parameters.  Change all callers.
11709         (Sized_symbol::override): Likewise.
11710         (Symbol_table::override): Likewise.
11711         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11712         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11713         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11714         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11715         to be in an ordinary section.
11716         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11717         object and is_ordinary parameters.  Change all callers.
11718         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11719         Change all callers.  Don't add undefined or non-ordinary symbols
11720         to reloc_map_.
11721         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11722         Change all callers.
11723         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11724         declarations.
11725         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11726         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11727         (Sized_relobj::relocate_sections): Likewise.
11728         * target-reloc.h (scan_relocs): Adjust section symbol index.
11729         (scan_relocatable_relocs): Likewise.
11730         * i386.cc (Scan::local): Check for ordinary symbols.
11731         * sparc.cc (Scan::local): Likewise.
11732         * x86_64.cc (Scan::local): Likewise.
11733         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11734         to symbol_section_and_value.
11735         * testsuite/many_sections_test.cc: New file.
11736         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11737         (check_PROGRAMS): Add many_sections_test.
11738         (many_sections_test_SOURCES): Define.
11739         (many_sections_test_DEPENDENCIES): Define.
11740         (many_sections_test_LDFLAGS): Define.
11741         (BUILT_SOURCES): Add many_sections_define.h.
11742         (many_sections_define.h): New target.
11743         (BUILT_SOURCES): Add many_sections_check.h.
11744         (many_sections_check.h): New target.
11745         (check_PROGRAMS): Add many_sections_r_test.
11746         (many_sections_r_test_SOURCES): Define.
11747         (many_sections_r_test_DEPENDENCIES): Define.
11748         (many_sections_r_test_LDFLAGS): Define.
11749         (many_sections_r_test_LDADD): Define.
11750         (many_sections_r_test.o): New target.
11751         * testsuite/Makefile.in: Rebuild.
11752
11753 2008-04-17  Cary Coutant  <ccoutant@google.com>
11754
11755         * errors.cc (Errors::info): New function.
11756         (gold_info): New function.
11757         * errors.h (Errors::info): New function.
11758         * gold.h (gold_info): New function.
11759         * object.cc (Input_objects::add_object): Print trace output.
11760         * options.cc (options::parse_set): New function.
11761         (General_options::parse_wrap): Deleted.
11762         (General_options::General_options): Deleted initializer.
11763         * options.h (options::String_set): New typedef.
11764         (options::parse_set): New function.
11765         (DEFINE_set): New macro.
11766         (General_options::wrap): Changed to use DEFINE_set. Changed
11767         callers of any_wrap_symbols and is_wrap_symbol.
11768         (General_options::trace, General_options::trace_symbol):
11769         New options.
11770         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11771         (General_options::wrap_symbols_): Deleted.
11772         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11773
11774 2008-04-17  David S. Miller  <davem@davemloft.net>
11775
11776         * options.cc (General_options::parse_V): New function.
11777         * options.h: Add entries for -V and -Qy.
11778
11779 2008-04-17  Ian Lance Taylor  <iant@google.com>
11780
11781         * common.cc (Symbol_table::allocate_commons): Remove options
11782         parameter.  Change caller.
11783         (Symbol_table::do_allocate_commons): Remove options parameter.
11784         Change caller.  Just call do_allocate_commons_list twice.
11785         (Symbol_table::do_allocate_commons_list): New function, broken out
11786         of do_allocate_commons.
11787         * common.h (class Allocate_commons_task): Remove options_ field.
11788         Update constructor.
11789         * symtab.cc (Symbol_table::Symbol_table): Initialize
11790         tls_commons_.
11791         (Symbol_table::add_from_object): Put TLS common symbols on
11792         tls_commons_ list.
11793         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11794         which are IN_OUTPUT_DATA.
11795         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11796         allocate_commons and do_allocate_commons declarations.  Declare
11797         do_allocate_commons_list.
11798         * gold.cc (queue_middle_tasks): Update creation of
11799         Allocate_commons_task to not pass options.
11800         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11801         (TLS_TEST_C_FLAGS): New variable.
11802         (tls_test_c_pic.o): New target.
11803         (tls_test_shared.so): Link in tls_test_c_pic.o.
11804         (tls_test_c_pic_ie.o): New target.
11805         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11806         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11807         (tls_test_c.o): New target.
11808         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11809         (tls_pic_test_LDADD): Likewise.
11810         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11811         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11812         (tls_test_c_gnu2.o): New target.
11813         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11814         tls_test_c_gnu2.o.
11815         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11816         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11817         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11818         * testsuite/tls_test.cc: Include "config.h".
11819         (t_last): Call t11_last.
11820         * testsuite/tls_test.h (t11, t11_last): Declare.
11821         * testsuite/tls_test_c.c: New file.
11822         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11823         * configure.ac: Check for OpenMP support.
11824         * configure, config.in, Makefile.in: Rebuild.
11825         * testsuite/Makefile.in: Rebuild.
11826
11827 2008-04-16  Cary Coutant  <ccoutant@google.com>
11828
11829         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11830         (Target_i386::tls_base_symbol_defined_): New field.
11831         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11832         (Target_i386::Scan::global): Likewise.
11833         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11834         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11835         (Target_x86_64::tls_base_symbol_defined_): New field.
11836         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11837         (Target_x86_64::Scan::global): Likewise.
11838
11839 2008-04-16  Cary Coutant  <ccoutant@google.com>
11840
11841         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11842         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11843         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11844         building shared libraries.
11845         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11846         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11847         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11848         * testsuite/Makefile.in: Rebuild.
11849         * testsuite/weak_undef.h: New file.
11850         * testsuite/weak_undef_file1.cc: Add extra test cases.
11851         * testsuite/weak_undef_file2.cc: Likewise.
11852         * testsuite/weak_undef_test.cc: Likewise.
11853
11854 2008-04-16  David S. Miller  <davem@davemloft.net>
11855
11856         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11857         Add issued_non_pic_error_ field.  Declare check_non_pic.
11858         (Target_sparc::Scan::check_non_pic): New function.
11859         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11860         (Target_sparc::Scan::global): Likewise.
11861
11862         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11863         * configure: Rebuild.
11864
11865         * options.h (DEFINE_enable): New macro.
11866         (new_dtags): New enable option.
11867         (initfirst, interpose, loadfltr, nodefaultlib,
11868         nodelete, nodlopen, nodump): New -z options.
11869         * layout.cc (Layout:finish_dynamic_section): If new
11870         dtags enabled, emit DT_RUNPATH.  Also, emit a
11871         DT_FLAGS_1 containing any specified -z flags.
11872
11873 2008-04-16  Ian Lance Taylor  <iant@google.com>
11874
11875         * copy-relocs.cc: New file.
11876         * copy-relocs.h: New file.
11877         * reloc.cc: Remove Copy_relocs code.
11878         * reloc.h: Likewise.
11879         * reloc-types.h (struct Reloc_types) [both versions]: Add
11880         get_reloc_addend_noerror.
11881         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11882         variants of add_global which take an addend which must be zero.
11883         * i386.cc: Include "copy-relocs.h".
11884         (class Target_i386): Change type of copy_relocs_ to variable,
11885         update initializer.
11886         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11887         Change all callers.
11888         (Target_i386::do_finalize_sections): Change handling of
11889         copy_relocs_.
11890         * sparc.cc: Include "copy-relocs.h".
11891         (class Target_sparc): Change type of copy_relocs_ to variable,
11892         update initializer.
11893         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11894         Change all callers.
11895         (Target_sparc::do_finalize_sections): Change handling of
11896         copy_relocs_.
11897         * x86_64.cc: Include "copy-relocs.h".
11898         (class Target_x86_64): Change type of copy_relocs_ to variable,
11899         update initializer.
11900         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11901         class.  Change all callers.
11902         (Target_x86_64::do_finalize_sections): Change handling of
11903         copy_relocs_.
11904         * Makefile.am (CCFILES): Add copy-relocs.cc.
11905         (HFILES): Add copy-relocs.h.
11906
11907         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11908
11909         * testsuite/script_test_4.sh: Permit leading zeroes.
11910
11911 2008-04-15  Ian Lance Taylor  <iant@google.com>
11912
11913         * script-sections.cc (Script_sections::create_segments): Use
11914         header_size_adjustment even when there is enough room for the
11915         headers.
11916         * testsuite/script_test_4.sh: New file.
11917         * testsuite/script_test_4.t: New file.
11918         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11919         (check_DATA): Add script_test_4.stdout.
11920         (MOSTLYCLEANFILES): Likewise.
11921         (script_test_4): New target.
11922         (script_test_4.stdout): New target.
11923         * testsuite/Makefile.in: Rebuild.
11924
11925         * sparc.cc: Add definitions for Output_data_plt_sparc class
11926         constants.
11927
11928 2008-04-14  David S. Miller  <davem@davemloft.net>
11929
11930         * sparc.cc: New file.
11931         * Makefile.am (TARGETSOURCES): Add sparc.cc
11932         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11933         * configure.tgt: Document targ_extra_size and
11934         targ_extra_big_endian.  Add entries for sparc-* and
11935         sparc64-*.
11936         * configure.ac: Handle targ_extra_size and
11937         targ_extra_big_endian.
11938         * Makefile.in: Rebuild.
11939         * configure: Likewise.
11940         * po/POTFILES.in: Likewise.
11941         * po/gold.pot: Likewise.
11942
11943 2008-04-14  Ian Lance Taylor  <iant@google.com>
11944
11945         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11946         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11947         in the name/type/flags to section mapping.  Don't call
11948         allocate_output_section.
11949         (Layout::choose_output_section): Change parameter from adjust_name
11950         to is_input_section.  Don't permit input sections after sections
11951         are attached to segments.  Don't call allocate_output_section.
11952         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11953         not write_enable_output_section.
11954         (Layout::make_output_section): Don't push to
11955         unattached_section_list_ nor call attach_to_segment.  Call
11956         attach_section_to_segment if sections are attached.
11957         (Layout::attach_sections_to_segments): New function.
11958         (Layout::attach_section_to_segment): New function.
11959         (Layout::attach_allocated_section_to_segment): Rename from
11960         attach_to_segment.  Remove flags parameter.
11961         (Layout::allocate_output_section): Remove function.
11962         (Layout::write_enable_output_section): Remove function.
11963         * layout.h (class Layout): Update for above changes.  Add new
11964         field sections_are_attached_.
11965         * output.h (Output_section::update_flags_for_input_section): New
11966         function.
11967         * output.cc (Output_section::add_input_section): Call
11968         update_flags_for_input_section.
11969         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11970
11971 2008-04-11  Cary Coutant  <ccoutant@google.com>
11972
11973         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11974         thought unnecessary.
11975         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11976
11977 2008-04-11  Ian Lance Taylor  <iant@google.com>
11978
11979         * output.h (class Output_section_data): Remove inline definition
11980         of set_addralign.
11981         * output.cc (Output_section_data::set_addralign): New function.
11982
11983 2008-04-11  Cary Coutant  <ccoutant@google.com>
11984
11985         Add support for TLS descriptors for i386 and x86_64.
11986         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11987         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11988         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11989         GOT_TYPE_TLS_DESC.
11990         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11991         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11992         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11993         relocations.
11994         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11995         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11996         Fix problem with initial-exec relocations.
11997         (Target_i386::Relocate::relocate_tls): Likewise.
11998         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11999         relaxation.
12000         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12001         support for section-plus-offset dynamic table entries.
12002         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12003         (Output_data_dynamic::Dynamic_entry): Add support for
12004         section-plus-offset dynamic table entries.
12005         (Output_data_dynamic::Classification): Likewise.
12006         (Output_data_dynamic::classification_): Renamed offset_.
12007         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12008         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12009         (Target_x86_64::make_plt_section): New function.
12010         (Target_x86_64::reserve_tlsdesc_entries): New function.
12011         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12012         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12013         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12014         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12015         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12016         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12017         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12018         add extra PLT entry for TLS descriptors.
12019         (Output_data_plt_x86_64::got_): New field.
12020         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12021         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12022         fields.
12023         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12024         descriptors.
12025         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12026         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12027         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12028         R_386_TLS_DESC_CALL relocations.
12029         (Target_x86_64::Scan::global): Likewise.
12030         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12031         for TLS descriptors.
12032         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12033         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12034         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12035         GD-to-IE relaxation.
12036         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12037         and TLS_DESCRIPTORS.
12038         * Makefile.in: Rebuild.
12039         * configure: Rebuild.
12040         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12041         (tls_test_shared2.so): New target.
12042         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12043         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12044         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12045         (tls_shared_gd_to_ie_test_LDADD): New variable.
12046         (tls_shared_gnu2_gd_to_ie_test): New target.
12047         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12048         New targets.
12049         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12050         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12051         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12052         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12053         (tls_shared_gnu2_test): New target.
12054         (tls_test_gnu2_shared.so): New target.
12055         (tls_shared_gnu2_test_SOURCES): New variable.
12056         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12057         (tls_shared_gnu2_test_LDFLAGS): New variable.
12058         (tls_shared_gnu2_test_LDADD): New variable.
12059         * testsuite/Makefile.in: Rebuild.
12060         * testsuite/Makefile.
12061
12062 2008-04-11  Ian Lance Taylor  <iant@google.com>
12063
12064         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12065         justsyms.t.
12066         * testsuite/Makefile.in: Rebuild.
12067
12068         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12069         long.
12070         * testsuite/script_test_2.cc (main): Adjust test.
12071
12072 2008-04-11  David S. Miller  <davem@davemloft.net>
12073             Ian Lance Taylor  <iant@google.com>
12074
12075         * options.h (General_options): Add entries for '-Y' and
12076         '-relax'.
12077         * options.cc (General_options:finalize): If -Y was used, add those
12078         entries to the library path instead of the default "/lib" and
12079         "/usr/lib".
12080
12081 2008-04-11  David S. Miller  <davem@davemloft.net>
12082
12083         * testsuite/justsyms.t: Start at 0x100.
12084         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12085         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12086         long.
12087         * testsuite/script_test_2.cc: Adjust string and section length
12088         checks.
12089
12090 2008-04-09  Ian Lance Taylor  <iant@google.com>
12091
12092         PR gold/5996
12093         * script-sections.cc (Sections_element::allocate_to_segment): Add
12094         orphan parameter.
12095         (Output_section_definition::allocate_to_segment): Likewise.
12096         (Orphan_output_section::allocate_to_segment): Likewise.
12097         (Script_sections::attach_sections_using_phdrs_clause): Don't
12098         propagate non-PT_LOAD segments to orphan sections.
12099         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12100         readelf rather than objdump.
12101         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12102         .interp section and PT_INTERP segment are the same size.
12103         * testsuite/Makefile.in: Rebuild.
12104
12105         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12106         aliases for symbols defined in the same object.
12107         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12108         (weak_alias_test_SOURCES): New variable.
12109         (weak_alias_test_DEPENDENCIES): New variable.
12110         (weak_alias_test_LDFLAGS): New variable.
12111         (weak_alias_test_LDADD): New variable.
12112         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12113         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12114         (weak_alias_test_3.o): New target.
12115         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12116         * testsuite/weak_alias_test_main.cc: New file.
12117         * testsuite/weak_alias_test_1.cc: New file.
12118         * testsuite/weak_alias_test_2.cc: New file.
12119         * testsuite/weak_alias_test_3.cc: New file.
12120
12121 2008-04-08  Ian Lance Taylor  <iant@google.com>
12122
12123         * options.h (class General_options): Add --noinhibit-exec option.
12124         * main.cc (main): Check --noinhibit-exec.
12125
12126         * options.h (class General_options): Define --wrap as a special
12127         option.  Add wrap_symbols_ field.
12128         (General_options::any_wrap_symbols): New function.
12129         (General_options::is_wrap_symbol): New function.
12130         * options.cc (General_options::parse_wrap): New function.
12131         (General_options::General_options): Initialize wrap_symbols_.
12132         * symtab.cc (Symbol_table::wrap_symbol): New function.
12133         (Symbol_table::add_from_object): Handle --wrap.
12134         * symtab.h (class Symbol_table): Declare wrap_symbol.
12135         * target.h (Target::wrap_char): New function.
12136         (Target::Target_info): Add wrap_char field.
12137         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12138         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12139         * testsuite/testfile.cc (Target_test::test_target_info):
12140         Likewise.
12141
12142         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12143         there is one.
12144
12145         * layout.h (class Layout): Add added_eh_frame_data_ field.
12146         * layout.cc (Layout::Layout): Initialize new field.
12147         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12148         output section until we find a section we merged successfully.
12149         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12150         that the size be non-zero.
12151
12152         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12153         qualifier.
12154
12155 2008-04-08  Craig Silverstein  <csilvers@google.com>
12156
12157         * configure.ac: Export new conditional variable HAVE_ZLIB.
12158         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12159         on HAVE_ZLIB.
12160         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12161         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12162
12163 2008-04-07  Ian Lance Taylor  <iant@google.com>
12164
12165         * version.cc (version_string): Set to "1.5".
12166
12167         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12168         Add issued_non_pic_error_ field.  Declare check_non_pic.
12169         (Target_x86_64::Scan::check_non_pic): New function.
12170         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12171         (Target_x86_64::Scan::global): Likewise.
12172
12173         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12174         addend parameter.  Change caller.  Handle merge sections.
12175         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12176         Address to Addend.  Don't add in the result of
12177         local_section_offset, pass down the addend and use the returned
12178         value.
12179         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12180         Update declarations of local_section_offset and symbol_value.
12181         * testsuite/two_file_test_1.cc (t18): New function.
12182         * testsuite/two_file_test_2.cc (f18): New function.
12183         * testsuite/two_file_test_main.cc (main): Call t18.
12184         * testsuite/two_file_test.h (t18, f18): Declare.
12185
12186         * configure.ac: Don't test for objdump, c++filt, or readelf.
12187         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12188         conditionals.
12189         (TEST_READELF): New variable.
12190         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12191         (check_PROGRAMS): Add two_file_strip_test.
12192         (two_file_strip_test): New target.
12193         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12194         (two_file_same_shared_strip_test_SOURCES): New variable.
12195         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12196         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12197         (two_file_same_shared_strip_test_LDADD): New variable.
12198         (two_file_shared_strip.so): New target.
12199         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12200         (ver_test_5.syms, ver_test_7.syms): Likewise.
12201         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12202         (strip_test_3.stdout): Use TEST_OBJDUMP.
12203         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12204
12205 2008-04-04  Cary Coutant  <ccoutant@google.com>
12206
12207         * symtab.h (Symbol::is_weak_undefined): New function.
12208         (Symbol::is_strong_undefined): New function.
12209         (Symbol::is_absolute): New function.
12210         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12211         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12212         absolute symbols.
12213         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12214         (weak_undef_test): New target.
12215         * testsuite/Makefile.in: Rebuild.
12216         * testsuite/weak_undef_file1.cc: New file.
12217         * testsuite/weak_undef_file2.cc: New file.
12218         * testsuite/weak_undef_test.cc: New file.
12219
12220 2008-04-03  Craig Silverstein  <csilvers@google.com>
12221
12222         * compressed_output.h (class Output_compressed_section): Use
12223         unsigned buffer.
12224         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12225         add zlib header.
12226         (zlib_compressed_suffix): Removed.
12227         (Output_compressed_section::set_final_data_size): Use unsigned
12228         buffers.
12229         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12230         Fix linker invocation.
12231         (flagstest_o_specialfile_and_compress_debug_sections):
12232         Likewise.
12233         * testsuite/Makefile.in: Regenerated.
12234
12235 2008-04-02  David S. Miller  <davem@davemloft.net>
12236
12237         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12238         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12239
12240 2008-04-02  Craig Silverstein  <csilvers@google.com>
12241
12242         * TODO: New file.
12243
12244 2008-04-02  Ian Lance Taylor  <iant@google.com>
12245
12246         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12247         parameters.  Update for new key type to views_.  Change all
12248         callers.
12249         (File_read::read): Adjust for byteshift in returned view.
12250         (File_read::add_view): New function, broken out of
12251         find_and_make_view.
12252         (File_read::make_view): New function, broken out of
12253         find_and_make_view.
12254         (File_read::find_or_make_view): Add offset and aligned
12255         parameters.  Rewrite accordingly.  Change all callers.
12256         (File_read::get_view): Add offset and aligned parameters.  Adjust
12257         for byteshift in return value.
12258         (File_read::get_lasting_view): Likewise.
12259         * fileread.h (class File_read): Update declarations.
12260         (class File_read::View): Add byteshift_ field.  Add byteshift to
12261         constructor.  Add byteshift method.
12262         * archive.h (Archive::clear_uncached_views): New function.
12263         (Archive::get_view): Add aligned parameter.  Change all callers.
12264         * object.h (Object::get_view): Add aligned parameter.  Change all
12265         callers.
12266         (Object::get_lasting_view): Likewise.
12267
12268         * fileread.cc (File_read::release): Don't call clear_views if
12269         there are multiple objects.
12270         * fileread.h (File_read::clear_uncached_views): New function.
12271         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12272         on the archive.
12273
12274 2008-03-31  Cary Coutant  <ccoutant@google.com>
12275
12276         Add thin archive support.
12277         * archive.cc (Archive::armagt): New const.
12278         (Archive::setup): Remove task parameter and calls to unlock.
12279         (Archive::unlock_nested_archives): New function.
12280         (Archive::read_header): Add nested_off parameter. Change
12281         all callers.
12282         (Archive::interpret_header): Likewise.
12283         (Archive::include_all_members): Change to handle thin
12284         archives.
12285         (Archive::include_member): Likewise.
12286         * archive.h (Archive::Archive): Add new parameters and
12287         initializers.
12288         (Archive::armagt): New const.
12289         (Archive::setup): Remove task parameter.
12290         (Archive::unlock_nested_archives): New function.
12291         (Archive::read_header): Add nested_off parameter.
12292         (Archive::interpret_header): Likewise.
12293         (Archive::Nested_archive_table): New typedef.
12294         (Archive::is_thin_archive_): New field.
12295         (Archive::nested_archives_): New field.
12296         (Archive::options_): New field.
12297         (Archive::dirpath_): New field.
12298         (Archive::task_): New field.
12299         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12300         for thin archives.  Pass additional parameters to
12301         Archive::Archive.  Unlock the archive file after calling
12302         Archive::setup.
12303
12304 2008-03-29  Ian Lance Taylor  <iant@google.com>
12305
12306         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12307         version symbol to be local.
12308         * testsuite/ver_test_4.sh: New file.
12309         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12310         (check_DATA): Add ver_test_4.syms.
12311         (ver_test_4.syms): New target.
12312         * testsuite/Makefile.in: Rebuild.
12313
12314         * output.cc
12315         (Output_section::Input_section_sort_entry::has_priority): New
12316         function.
12317         (Output_section::Input_section_sort_entry::match_file_name): New
12318         function.
12319         (Output_section::Input_section_sort_entry::match_section_name):
12320         Remove.
12321         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12322         Remove.
12323         (Output_section::Input_section_sort_entry::match_section_file):
12324         Remove.
12325         (Output_section::Input_section_sort_compare::operator()): Rewrite
12326         using new Input_section_sort_entry functions.  Sort crtbegin and
12327         crtend first.  Sort sections with no priority before sections with
12328         a priority.
12329         * testsuite/initpri1.c (d3): Check j != 4.
12330         (cd5): New constructor/destructor function.
12331         (main): Check j != 2.
12332
12333         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12334         new symbol when resolving, don't call set_is_default.
12335         * testsuite/ver_test_7.cc: New file.
12336         * testsuite/ver_test_7.sh: New file.
12337         * testsuite/Makefile.am (ver_test_7.so): New target.
12338         (ver_test_7.o): New target.
12339         (check_SCRIPTS): Add ver_test_7.sh.
12340         (check_DATA): Add ver_test_7.syms.
12341         (ver_test_7.syms): New target.
12342
12343 2008-03-28  Ian Lance Taylor  <iant@google.com>
12344
12345         * layout.cc (Layout::layout): If we see an input section with a
12346         name that needs sorting, set the must_sort flag for the output
12347         section.
12348         (Layout::make_output_section): If the name of the output section
12349         indicates that it might require sorting, set the may_sort flag.
12350         * output.h (Output_section::may_sort_attached_input_sections): New
12351         function.
12352         (Output_section::set_may_sort_attached_input_sections): New
12353         function.
12354         (Output_section::must_sort_attached_input_sections): New
12355         function.
12356         (Output_section::set_must_sort_attached_input_sections): New
12357         function.
12358         (class Output_section): Declare Input_section_sort_entry.  Define
12359         Input_section_sort_compare.  Declare
12360         sort_attached_input_sections.  Add new fields:
12361         may_sort_attached_input_sections_,
12362         must_sort_attached_input_sections_,
12363         attached_input_sections_are_sorted_.
12364         * output.cc (Output_section::Output_section): Initialize new
12365         fields.
12366         (Output_section::add_input_section): Add an entry to
12367         input_sections_ if may_sort or must_sort are true.
12368         (Output_section::set_final_data_size): Call
12369         sort_attached_input_sections if necessary.
12370         (Output_section::Input_section_sort_entry): Define new class.
12371         (Output_section::Input_section_sort_compare::operator()): New
12372         function.
12373         (Output_section::sort_attached_input_sections): New function.
12374         * configure.ac: Check whether the compiler supports constructor
12375         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12376         * testsuite/initpri1.c: New file.
12377         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12378         CONSTRUCTOR_PRIORITY.
12379         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12380         (initpri1_LDFLAGS): New variable.
12381         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12382
12383 2008-03-27  Ian Lance Taylor  <iant@google.com>
12384
12385         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12386         * testsuite/common_test_1.c: New file.
12387         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12388         (common_test_1_SOURCES): New variable.
12389         (common_test_1_DEPENDENCIES): New variable.
12390         (common_test_1_LDFLAGS): New variable.
12391
12392         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12393         and commons_ correctly when NAME/VERSION does not override
12394         NAME/NULL.
12395         * testsuite/ver_test_6.c: New file.
12396         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12397         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12398         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12399
12400 2008-03-26  Ian Lance Taylor  <iant@google.com>
12401
12402         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12403         of an undefined symbol from a version script.
12404         * testsuite/Makefile.am (ver_test_5.so): New target.
12405         (ver_test_5.o): New target.
12406         (check_SCRIPTS): Add ver_test_5.sh.
12407         (check_DATA): Add ver_test_5.syms.
12408         (ver_test_5.syms): New target.
12409         * testsuite/ver_test_5.cc: New file.
12410         * testsuite/ver_test_5.script: New file.
12411         * testsuite/ver_test_5.sh: New file.
12412         * Makefile.in, testsuite/Makefile.in: Rebuild.
12413
12414         PR gold/5986
12415         Fix problems building gold with gcc 4.3.0.
12416         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12417         (gold_error_at_location, gold_warning_at_location): Use it.
12418         * configure.ac: Check whether we can compile and use a template
12419         function with a printf attribute.
12420         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12421         when jumping over bytes.
12422         * object.cc: Instantiate Object::read_section_data.
12423         * debug.h: Include <cstring>
12424         * dwarf_reader.cc: Include <algorithm>
12425         * main.cc: Include <cstring>.
12426         * options.cc: Include <cstring>.
12427         * output.cc: Include <cstring>.
12428         * script.cc: Include <cstring>.
12429         * script.h: Include <string>.
12430         * symtab.cc: Include <cstring> and <algorithm>.
12431         * target-select.cc: Include <cstring>.
12432         * version.cc: Include <string>.
12433         * testsuite/testmain.cc: Include <cstdlib>.
12434         * configure, config.in: Rebuild.
12435
12436 2008-03-25  Ian Lance Taylor  <iant@google.com>
12437
12438         * options.cc: Include "../bfd/bfdver.h".
12439         (options::help): Print bug reporting address.
12440
12441         * version.cc (print_version): Adjust output for current value of
12442         BFD_VERSION_STRING.
12443
12444         * NEWS: New file.
12445
12446         * options.cc (options::help): Print list of supported targets.
12447         * target-select.h: Include <vector>.
12448         (class Target_selector): Make machine_, size_, and is_big_endian_
12449         fields const.  Add bfd_name_ and instantiated_target_ fields.
12450         (Target_selector::Target_selector): Add bfd_name parameter.
12451         (Target_selector::recognize): Make non-virtual, call
12452         do_recognize.
12453         (Target_selector::recognize_by_name): Make non-virtual, call
12454         do_recognize_by_name.
12455         (Target_selector::supported_names): New function.
12456         (Target_selector::bfd_name): New function.
12457         (Target_selector::do_instantiate_target): New pure virtual
12458         function.
12459         (Target_selector::do_recognize): New virtual function.
12460         (Target_selector::do_recognize_by_name): New virtual function.
12461         (Target_selector::instantiate_target): New private function.
12462         (supported_target_names): Declare.
12463         * target-select.cc (Target_selector::Target_selector): Update for
12464         new parameter and fields.
12465         (select_target_by_name): Check that the name matches before
12466         calling recognize_by_name.
12467         (supported_target_names): New function.
12468         * i386.cc (class Target_selector_i386): Update Target_selector
12469         constructor call.  Remove recognize and recognize_by_name.  Add
12470         do_instantiate_target.
12471         * x86_64.cc (class Target_selector_x86_64): Likewise.
12472         * testsuite/testfile.cc (class Target_selector_test): Update for
12473         changes to Target_selector.
12474
12475         * README: Rewrite, with some notes on unsupported features.
12476
12477 2008-03-24  Cary Coutant  <ccoutant@google.com>
12478
12479         * i386.cc (Target_i386::Got_type): New enum declaration.
12480         (Target_i386::Scan::local): Updated callers of Output_data_got
12481         member functions.
12482         (Target_i386::Scan::global): Likewise.
12483         (Target_i386::Relocate::relocate): Likewise.
12484         (Target_i386::Relocate::relocate_tls): Likewise.
12485         * object.h (Got_offset_list): New class.
12486         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12487         (Sized_relobj::local_got_offset): Likewise.
12488         (Sized_relobj::set_local_got_offset): Likewise.
12489         (Sized_relobj::local_has_tls_got_offset): Removed.
12490         (Sized_relobj::local_tls_got_offset): Removed.
12491         (Sized_relobj::set_local_tls_got_offset): Removed.
12492         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12493         * output.cc (Output_data_got::add_global): Added got_type parameter.
12494         (Output_data_got::add_global_with_rel): Likewise.
12495         (Output_data_got::add_global_with_rela): Likewise.
12496         (Output_data_got::add_global_pair_with_rel): New function.
12497         (Output_data_got::add_global_pair_with_rela): New function.
12498         (Output_data_got::add_local): Added got_type parameter.
12499         (Output_data_got::add_local_with_rel): Likewise.
12500         (Output_data_got::add_local_with_rela): Likewise.
12501         (Output_data_got::add_local_pair_with_rel): New function.
12502         (Output_data_got::add_local_pair_with_rela): New function.
12503         (Output_data_got::add_global_tls): Removed.
12504         (Output_data_got::add_global_tls_with_rel): Removed.
12505         (Output_data_got::add_global_tls_with_rela): Removed.
12506         (Output_data_got::add_local_tls): Removed.
12507         (Output_data_got::add_local_tls_with_rel): Removed.
12508         (Output_data_got::add_local_tls_with_rela): Removed.
12509         * output.h (Output_data_got::add_global): Added got_type parameter.
12510         (Output_data_got::add_global_with_rel): Likewise.
12511         (Output_data_got::add_global_with_rela): Likewise.
12512         (Output_data_got::add_global_pair_with_rel): New function.
12513         (Output_data_got::add_global_pair_with_rela): New function.
12514         (Output_data_got::add_local): Added got_type parameter.
12515         (Output_data_got::add_local_with_rel): Likewise.
12516         (Output_data_got::add_local_with_rela): Likewise.
12517         (Output_data_got::add_local_pair_with_rel): New function.
12518         (Output_data_got::add_local_pair_with_rela): New function.
12519         (Output_data_got::add_global_tls): Removed.
12520         (Output_data_got::add_global_tls_with_rel): Removed.
12521         (Output_data_got::add_global_tls_with_rela): Removed.
12522         (Output_data_got::add_local_tls): Removed.
12523         (Output_data_got::add_local_tls_with_rel): Removed.
12524         (Output_data_got::add_local_tls_with_rela): Removed.
12525         * resolve.cc (Symbol::override_base_with_special): Removed
12526         reference to has_got_offset_ field.
12527         * symtab.cc (Symbol::init_fields): Replaced initialization
12528         of got_offset_ with got_offsets_.  Removed initialization
12529         of has_got_offset_
12530         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12531         (Symbol::got_offset): Likewise.
12532         (Symbol::set_got_offset): Likewise.
12533         (Symbol::has_tls_got_offset): Removed.
12534         (Symbol::tls_got_offset): Removed.
12535         (Symbol::set_tls_got_offset): Removed.
12536         (Symbol::got_offset_): Removed.
12537         (Symbol::tls_mod_got_offset_): Removed.
12538         (Symbol::tls_pair_got_offset_): Removed.
12539         (Symbol::got_offsets_): New field.
12540         (Symbol::has_got_offset): Removed.
12541         (Symbol::has_tls_mod_got_offset): Removed.
12542         (Symbol::has_tls_pair_got_offset): Removed.
12543         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12544         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12545         member functions.
12546         (Target_x86_64::Scan::global): Likewise.
12547         (Target_x86_64::Relocate::relocate): Likewise.
12548         (Target_x86_64::Relocate::relocate_tls): Likewise.
12549
12550 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12551
12552         * yyscript.y: Fix spelling error in comment.
12553
12554 2008-03-24  Ian Lance Taylor  <iant@google.com>
12555
12556         * options.h (class General_options): Define build_id option.
12557         * layout.h (class Layout): Declare write_build_id, create_note,
12558         create_build_id.  Add build_id_note_ member.
12559         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12560         "libiberty.h", "md5.h", "sha1.h".
12561         (Layout::Layout): Initialize eh_frame_data_,
12562         eh_frame_hdr_section_, and build_id_note_.
12563         (Layout::finalize): Call create_build_id.
12564         (Layout::create_note): New function, broken out of
12565         Layout::create_gold_note.
12566         (Layout::create_gold_note): Call create_note.
12567         (Layout::create_build_id): New function.
12568         (Layout::write_build_id): New function.
12569         (Close_task_runner::run): Call write_build_id.
12570
12571         * x86_64.cc: Correct license to GPLv3.
12572
12573 2008-03-23  Ian Lance Taylor  <iant@google.com>
12574
12575         * options.cc: Include "demangle.h".
12576         (parse_optional_string): New function.
12577         (parse_long_option): Handle takes_optional_argument.
12578         (parse_short_option): Update dash_z initializer.  Handle
12579         takes_optional_argument.
12580         (General_options::General_options): Initialize do_demangle_.
12581         (General_options::finalize): Set do_demangle_.  Handle demangling
12582         style.
12583         * options.h (parse_optional_string): Declare.
12584         (struct One_option): Add optional_arg field.  Update constructor.
12585         Update call constructor calls.  Add takes_optional_argument
12586         function.
12587         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12588         (DEFINE_optional_string): Define.
12589         (General_options::demangle): Change from DEFINE_bool to
12590         DEFINE_optional_string.
12591         (General_options::no_demangle): New function.
12592         (General_options::do_demangle): New function.
12593         (General_options::set_do_demangle): New function.
12594         (General_options::execstack_status_): Move definition to end of
12595         class definition.
12596         (General_options::static_): Likewise.
12597         (General_options::do_demangle_): New field.
12598         * object.cc (big_endian>::get_symbol_location_info): Call
12599         Options::do_demangle, not Options::demangle.
12600         * symtab.cc (demangle): Likewise.
12601
12602 2008-03-22  Ian Lance Taylor  <iant@google.com>
12603
12604         * gold.h: Include <cstddef> and <sys/types.h>
12605         * options.h: Include <cstring>.
12606
12607 2008-03-21  Ian Lance Taylor  <iant@google.com>
12608
12609         * Added source code to GNU binutils.