* resolve.cc (Symbol_table::resolve): When merging common symbols,
[external/binutils.git] / gold / ChangeLog
1 2012-03-13  Ian Lance Taylor  <iant@google.com>
2
3         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4         keep the larger alignment.
5
6 2012-03-12  Cary Coutant  <ccoutant@google.com>
7
8         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
9         handling of DW_LNE_define_file.
10
11 2012-03-12  Cary Coutant  <ccoutant@google.com>
12
13         * reduced_debug_output.cc
14         (Output_reduced_debug_info_section::get_die_end): Add new FORM
15         codes to switch.
16
17 2012-02-29  Cary Coutant  <ccoutant@google.com>
18
19         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
20
21 2012-02-29  Cary Coutant  <ccoutant@google.com>
22
23         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
24         Call Object::decompressed_section_contents.
25         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
26         New dtor.
27         (Sized_dwarf_line_info::buffer_start_): New data member.
28         * merge.cc (Output_merge_data::do_add_input_section): Call
29         Object::decompressed_section_contents.
30         (Output_merge_string::do_add_input_section): Likewise.
31         * object.cc (need_decompressed_section): New function.
32         (build_compressed_section_map): Decompress sections needed later.
33         (Sized_relobj_file::do_decompressed_section_contents): New function.
34         (Sized_relobj_file::do_discard_decompressed_sections): New function.
35         * object.h (Object::decompressed_section_contents): New function.
36         (Object::discard_decompressed_sections): New function.
37         (Object::do_decompressed_section_contents): New function.
38         (Object::do_discard_decompressed_sections): New function.
39         (Compressed_section_info): New type.
40         (Compressed_section_map): Include decompressed section contents.
41         (Sized_relobj_file::do_decompressed_section_contents): New function.
42         (Sized_relobj_file::do_discard_decompressed_sections): New function.
43
44 2012-02-16  Cary Coutant  <ccoutant@google.com>
45
46         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
47         * testsuite/Makefile.in: Regenerate.
48
49 2012-02-14  Cary Coutant  <ccoutant@google.com>
50
51         * options.cc (General_options::finalize): Disallow -pie and -static.
52
53 2012-02-03  Doug Kwan  <dougkwan@google.com>
54
55         * arm.cc (Arm_relocate_functions::abs8,
56         Arm_relocate_functions::abs16): Use
57         Bits::has_signed_unsigned_overflow32.
58         (Arm_relocate_functions::thm_abs8): Correct range of
59         overflow check.
60         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
61         in assertions.
62
63 2012-02-02  Doug Kwan  <dougkwan@google.com>
64
65         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
66         position independent outputs, not just shared objects.
67
68 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
69
70         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
71         * configure: Regenerated.
72
73 2012-01-27  Ian Lance Taylor  <iant@google.com>
74
75         * reloc.h (Bits): New class with static functions, copied from
76         namespace utils in arm.cc.
77         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
78         instead.
79
80 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
81
82         * incremental.cc (write_info_blocks): Correct relocation offset.
83
84 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
85
86         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
87         (Relocate::tls_gd_to_le): Likewise.
88
89 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
90
91         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
92
93 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
94
95         * configure.ac: Check if -mcmodel=medium works.
96         * configure: Regenerated.
97
98 2012-01-24  Cary Coutant  <ccoutant@google.com>
99
100         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
101         definition and ...
102         (read_unsigned_LEB_128_x): ... this new function.
103         (read_signed_LEB_128): Replaced with inline definition and ...
104         (read_signed_LEB_128_x): ... this new function.
105         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
106         (read_unsigned_LEB_128): Add inline definition.
107         (read_signed_LEB_128_x): New function.
108         (read_signed_LEB_128): Add inline definition.
109         * testsuite/Makefile.am (leb128_unittest): New unit test.
110         * testsuite/Makefile.in: Regenerate.
111         * testsuite/leb128_unittest.cc: New unit test.
112
113 2012-01-23  Ian Lance Taylor  <iant@google.com>
114
115         PR gold/13617
116         * i386.cc (Target_i386::do_code_fill): When using a jmp
117         instruction, pad with nop instructions.
118         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
119
120 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
121
122         * x86_64.cc (gc_process_relocs): Add typename on types used in
123         template.
124         (scan_relocs): Likewise.
125         (relocate_section): Likewise.
126         (apply_relocation): Likewise.
127
128 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
129
130         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
131         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
132         under x32.
133
134 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
135
136         * x86_64.cc: Initial support for x32.
137
138 2012-01-03  Cary Coutant  <ccoutant@google.com>
139
140         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
141         Use abstract base class for GOT.
142         * gold/output.h (class Output_data_got_base): New abstract base class.
143         (class Output_data_got): Derive from new base class, adjust ctors.
144         (Output_data_got::reserve_slot): Make virtual; rename to
145         do_reserve_slot; Adjust callers.
146         * gold/target.h (Sized_target::init_got_plt_for_update): Return
147         pointer to abstract base class.
148         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
149
150 2011-12-18  Ian Lance Taylor  <iant@google.com>
151
152         * object.h (Relobj::local_symbol_value): New function.
153         (Relobj::local_plt_offset): New function.
154         (Relobj::local_has_got_offset): New function.
155         (Relobj::local_got_offset): New function.
156         (Relobj::set_local_got_offset): New function.
157         (Relobj::do_local_symbol_value): New pure virtual function.
158         (Relobj::do_local_plt_offset): Likewise.
159         (Relobj::do_local_has_got_offset): Likewise.
160         (Relobj::do_local_got_offset): Likewise.
161         (Relobj::do_set_local_got_offset): Likewise.
162         (Sized_relobj::do_local_has_got_offset): Rename from
163         local_has_got_offset.
164         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
165         (Sized_relobj::do_set_local_got_offset): Rename from
166         set_local_got_offset.
167         (Sized_relobj_file::do_local_plt_offset): Rename from
168         local_plt_offset.
169         (Sized_relobj_file::do_local_symbol_value): New function.
170         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
171         local_plt_offset.
172         * output.cc (Output_data_got::Got_entry::write): Change object to
173         Relobj.  Use local_symbol_value.
174         (Output_data_got::add_global_with_rel): Change rel_dyn to
175         Output_data_reloc_generic*.  Use add_global_generic.
176         (Output_data_got::add_global_with_rela): Remove.  Change all
177         callers to use add_global_with_rel.
178         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
179         Output_data_reloc_generic*.  Use add_global_generic.
180         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
181         callers to use add_global_pair_with_rel.
182         (Output_data_got::add_local): Change object to Relobj*.
183         (Output_data_got::add_local_plt): Likewise.
184         (Output_data_got::add_local_with_rel): Change object to Relobj*,
185         change rel_dyn to Output_data_reloc_generic*.  Use
186         add_local_generic.
187         (Output_data_got::add_local_with_rela): Remove.  Change all
188         callers to use all_local_with_rel.
189         (Output_data_got::add_local_pair_with_rel): Change object to
190         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
191         add_output_section_generic.
192         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
193         callers to use add_local_pair_with_rel.
194         (Output_data_got::reserve_local): Change object to Relobj*.
195         * output.h: (class Output_data_reloc_generic): Add pure virtual
196         declarations for add_global_generic, add_local_generic,
197         add_output_section_generic.
198         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
199         functions for Output_data_reloc_generic.  Update declarations for
200         changes listed in output.cc.
201         (class Output_data_got): Change template parameter to got_size.
202         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
203         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
204         function.
205         (Sized_relobj_incr::do_local_plt_offset): New function.
206         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
207         add_global_generic.
208
209 2011-12-17  Cary Coutant  <ccoutant@google.com>
210
211         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
212         * resolve.cc (Symbol_table::resolve): Likewise.
213         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
214         arrays.
215         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
216
217 2011-12-16  Ian Lance Taylor  <iant@google.com>
218
219         * output.h (Output_data_reloc_generic::add): Only call
220         add_dynamic_reloc if this is a dynamic reloc section.
221
222 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
223
224         PR gold/13505
225         * target-reloc.h (apply_relocation): Replace <64, false> with
226         <size, big_endian>.
227
228 2011-11-25  Nick Clifton  <nickc@redhat.com>
229
230         * po/it.po: New Italian translation.
231
232 2011-11-17  Sterling Augustine  <saugustine@google.com>
233
234         * script.cc (script_include_directive): Implement.
235         (read_script_file): New local variables name and search_path. Update
236         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
237         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
238         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
239
240 2011-11-11  Sterling Augustine  <saugustine@google.com>
241
242         * yyscript.y (section_cmd): Add support for INCLUDE directive.
243         (file_or_sections_cmd): Likewise.
244
245 2011-11-11  Doug Kwan  <dougkwan@google.com>
246
247         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
248         if --just-symbols is given.
249
250 2011-11-10  Doug Kwan  <dougkwan@google.com>
251
252         PR gold/13362
253         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
254         when processing data relocs.
255         * reloc.h (Relocate_functions::rel_unaligned): New method.
256         (Relocate_functions::pcrel_unaligned): Ditto.
257         (Relocate_functions::rel32_unaligned): Ditto.
258         (Relocate_functions::pcrel32_unaligned): Ditto.
259
260 2011-11-09  Doug Kwan  <dougkwan@google.com>
261
262         PR gold/13362
263         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
264         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
265         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
266         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
267         (Relocate_functions::rel_unaligned): New.
268         (Relocate_functions::rel32_unaligned): New.
269         * target-reloc.h (relocate_for_relocatable): Add code to handle
270         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
271         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
272         arm_unaligned_reloc_r): New targets.
273         * testsuite/Makefile.in: Regenerate.
274         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
275         linking.
276
277 2011-11-02  Ian Lance Taylor  <iant@google.com>
278
279         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
280         NATIVE_LINKER.
281         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
282         * options.cc (General_options::finalize): Use library search path
283         from configure script if specified.  If not native and no sysroot,
284         only search TOOLLIBDIR.
285         * options.h (Search_directory::Search_directory): Change name to
286         const std::string&.
287         (General_options::add_to_library_path_with_sysroot): Change arg to
288         const std::string&.
289         * configure, Makefile.in, config.in: Rebuild.
290
291 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
292
293         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
294         we are working around the ARM1176 Erratum.
295         * options.h (General_options::fix_arm1176): Add option.
296         * testsuite/Makefile.am: Add testcases, and keep current ones
297         working.
298         * testsuite/Makefile.in: Regenerate.
299         * testsuite/arm_fix_1176.s: New file.
300         * testsuite/arm_fix_1176.sh: Likewise.
301
302 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
303
304         * arm.cc (Target_arm::Target_arm): Remove initialisation of
305         may_use_blx_.
306         (Target_arm::may_use_blx): Remove method.
307         (Target_arm::set_may_use_blx): Likewise.
308         (Target_arm::may_use_v4t_interworking): New method.
309         (Target_arm::may_use_v5t_interworking): Likewise.
310         (Target_arm::may_use_blx_): Remove member variable.
311         (Arm_relocate_functions::arm_branch_common): Check for v5T
312         interworking.
313         (Arm_relocate_functions::thumb_branch_common): Likewise.
314         (Reloc_stub::stub_type_for_reloc): Likewise.
315         (Target_arm::do_finalize_sections): Correct interworking checks.
316         * testsuite/Makefile.am: Add new tests.
317         * testsuite/Makefile.in: Regenerate.
318         * testsuite/arm_farcall_arm_arm.s: New test.
319         * testsuite/arm_farcall_arm_arm.sh: Likewise.
320         * testsuite/arm_farcall_arm_thumb.s: Likewise.
321         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
322         * testsuite/arm_farcall_thumb_arm.s: Likewise.
323         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
324         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
325         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
326
327 2011-10-31  Cary Coutant  <ccoutant@google.com>
328
329         PR gold/13023
330         * expression.cc (Expression::eval_with_dot): Add
331         is_section_dot_assignment parameter.
332         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
333         absolute and assigning to dot within a section.
334         * script-sections.cc
335         (Output_section_element_assignment::set_section_addresses): Pass
336         dot_section to set_if_absolute.
337         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
338         as is_section_dot_assignment flag to eval_with_dot.
339         (Output_section_element_dot_assignment::set_section_addresses):
340         Likewise.
341         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
342         parameter.  Also set value if relative to dot_section; set the
343         symbol's output_section.
344         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
345         parameter.  Adjust all callers.
346         (Expression::eval_maybe_dot): Likewise.
347         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
348         Adjust all callers.
349         * testsuite/script_test_2.t: Test assignment of an absolute value
350         to dot within an output section element.
351
352 2011-10-31  Cary Coutant  <ccoutant@google.com>
353
354         * options.h (class General_options): Add --[no-]gnu-unique options.
355         * symtab.cc (Symbol_table::sized_write_globals): Convert
356         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
357
358 2011-10-31  Cary Coutant  <ccoutant@google.com>
359
360         PR gold/13359
361         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
362         unnecessary assertion.
363         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
364
365 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
366
367         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
368         gc_mark_symbol.
369         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
370         gc_mark_symbol.
371         Change to just keep the section associated with symbol.
372         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
373         they are externally visible and --export-dynamic is turned on.
374         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
375
376 2011-10-19  Ian Lance Taylor  <iant@google.com>
377
378         PR gold/13163
379         * script-sections.cc
380         (Output_section_element_dot_assignment::needs_output_section): New
381         function.
382
383 2011-10-19  Ian Lance Taylor  <iant@google.com>
384
385         PR gold/13204
386         * layout.cc (Layout::segment_precedes): Don't assert failure if a
387         --section-start option was seen.
388         * options.h (General_options::any_section_start): New function.
389
390 2011-10-18  David S. Miller  <davem@davemloft.net>
391
392         PR binutils/13301
393         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
394         member to track relocation locations that have moved during TLS
395         reloc optimizations.
396         (Target_sparc::Relocate::Relocate): Initialize to NULL.
397         (Target_sparc::Relocate::relocate): Adjust view down by 4
398         bytes if it matches reloc_adjust_addr_.
399         (Target_sparc::Relocate::relocate_tls): Always move the
400         __tls_get_addr call delay slot instruction forward 4 bytes when
401         performing relaxation.
402
403 2011-10-18  Cary Coutant  <ccoutant@google.com>
404
405         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
406         (Output_file::map_no_anonymous): Check for non-zero
407         return code from posix_fallocate.
408
409 2011-10-17  Cary Coutant  <ccoutant@google.com>
410
411         PR gold/13245
412         * plugin.cc (is_visible_from_outside): Check for symbols
413         referenced from dynamic objects.
414         * resolve.cc (Symbol_table::resolve): Don't count references
415         from dynamic objects as references from real ELF files.
416         * testsuite/plugin_test_2.sh: Adjust expected result.
417
418 2011-10-17  Cary Coutant  <ccoutant@google.com>
419
420         * gold.cc: Include timer.h.
421         (queue_middle_tasks): Stamp time.
422         (queue_final_tasks): Likewise.
423         * main.cc (main): Store timer in parameters.  Print timers
424         for each pass.
425         * parameters.cc (Parameters::Parameters): Initialize timer_.
426         (Parameters::set_timer): New function.
427         (set_parameters_timer): New function.
428         * parameters.h (Parameters::set_timer): New function.
429         (Parameters::timer): New function.
430         (Parameters::timer_): New data member.
431         (set_parameters_timer): New function.
432         * timer.cc (Timer::stamp): New function.
433         (Timer::get_pass_time): New function.
434         * timer.h (Timer::stamp): New function.
435         (Timer::get_pass_time): New function.
436         (Timer::pass_times_): New data member.
437
438 2011-10-17  Cary Coutant  <ccoutant@google.com>
439
440         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
441         task for members of lib groups.
442
443 2011-10-17  Cary Coutant  <ccoutant@google.com>
444
445         PR gold/13288
446         * fileread.cc (File_read::find_view): Add assert.
447         (File_read::make_view): Move bounds check (replace with assert)...
448         (File_read::find_or_make_view): ... to here.
449
450 2011-10-12  Cary Coutant  <ccoutant@google.com>
451
452         * output.cc (Output_file::open_base_file): Handle case where
453         ::read returns less than requested size.
454
455 2011-10-10  Cary Coutant  <ccoutant@google.com>
456
457         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
458         Initialize defined_count_.
459         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
460         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
461         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
462         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
463         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
464         * incremental.h (Sized_relobj_incr::defined_count_): New data
465         member.
466         (Sized_incr_dynobj::defined_count_): New data member.
467         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
468         Return zeroes instead of internal error.
469
470 2011-10-10  Cary Coutant  <ccoutant@google.com>
471
472         PR gold/13249
473         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
474         (Output_reloc::symbol_value): Return PLT offset if flag is set.
475         * output.h (class Output_reloc): Add use_plt_offset flag.
476         (Output_reloc::type_): Adjust size of bit field.
477         (Output_reloc::use_plt_offset_): New bit field.
478         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
479         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
480         flag.  Adjust all callers.
481         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
482         creating RELATIVE relocations.
483
484 2011-10-10  Nick Clifton  <nickc@redhat.com>
485
486         * po/es.po: Updated Spanish translation.
487         * po/fi.po: Updated Finnish translation.
488
489 2011-10-03   Diego Novillo  <dnovillo@google.com>
490
491         * options.cc (parse_uint): Fix dereference of RETVAL.
492
493 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
494
495         * layout.h (section_order_map_): New member.
496         (get_section_order_map): New member function.
497         * output.cc (Output_section::add_input_section): Check for patterns
498         only when --section-ordering-file is specified.
499         * gold.cc (queue_middle_tasks): Delay updating order of sections till
500         output_sections have been formed.
501         * layout.cc (Layout_Layout): Initialize section_order_map_.
502         * plugin.cc (update_section_order): Store order in order_map. Do not
503         update the order.
504         * testsuite/Makefile.am: Add test case for plugin_final_layout.
505         * testsuite/Makefile.in: Regenerate.
506         * testsuite/plugin_section_order.c: New file.
507         * testsuite/plugin_final_layout.cc: New file.
508         * testsuite/plugin_final_layout.sh: New file.
509
510 2011-09-29  Cary Coutant  <ccoutant@google.com>
511
512         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
513         Check for NULL.
514         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
515         symbols during incremental update.
516         (Symbol_table::add_from_dynobj): Likewise.
517
518 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
519             Ian Lance Taylor  <iant@google.com>
520
521         * symtab.cc (Symbol_table::define_special_symbol): Always
522         canonicalize version string.
523
524 2011-09-26  Cary Coutant  <ccoutant@google.com>
525
526         * gold.cc (queue_initial_tasks): Move option checks ...
527         * options.cc (General_options::finalize): ... to here. Disable
528         some options; make others fatal.
529
530 2011-09-26  Cary Coutant  <ccoutant@google.com>
531
532         gcc PR lto/47247
533         * plugin.cc (get_symbols_v2): New function.
534         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
535         (is_referenced_from_outside): New function.
536         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
537         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
538         (get_symbols): Pass version parameter.
539         (get_symbols_v2): New function.
540         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
541         parameter.
542         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
543         (onload): Add LDPT_GET_SYMBOLS_V2.
544         (all_symbols_read_hook): Use get_symbols_v2; check for
545         LDPR_PREVAILING_DEF_IRONLY_EXP.
546         * testsuite/plugin_test_3.sh: Update expected results.
547
548 2011-09-23  Simon Baldwin  <simonb@google.com>
549
550         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
551         configuration options.
552         * configure: Regenerate.
553         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
554         * Makefile.in: Regenerate.
555         * testsuite/Makefile.in: Regenerate.
556
557 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
558
559         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
560
561 2011-09-19  Cary Coutant  <ccoutant@google.com>
562
563         * incremental.cc (can_incremental_update): Fix typo in comment.
564         * incremental.h (can_incremental_update): Likewise.
565
566 2011-09-18  Cary Coutant  <ccoutant@google.com>
567
568         * incremental.cc (can_incremental_update): New function.
569         * incremental.h (can_incremental_update): New function.
570         * layout.cc (Layout::init_fixed_output_section): Call it.
571         (Layout::make_output_section): Don't allow patch space in .eh_frame.
572         * object.cc (Sized_relobj_file::do_layout): Call
573         can_incremental_update.
574
575 2011-09-13  Cary Coutant  <ccoutant@google.com>
576
577         * configure.ac: Check for glibc support for gnu_indirect_function
578         support with static linking, setting automake conditional
579         IFUNC_STATIC.
580         * Makefile.in: Regenerate.
581         * configure: Regenerate.
582
583         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
584         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
585         for IFUNC_STATIC.
586         * testsuite/Makefile.in: Regenerate.
587
588 2011-09-13  Cary Coutant  <ccoutant@google.com>
589
590         * incremental.cc (Sized_relobj_incr::do_layout): Call
591         report_comdat_group for kept comdat sections.
592         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
593         * testsuite/Makefile.in: Regenerate.
594         * testsuite/incr_comdat_test_1.cc: New source file.
595         * testsuite/incr_comdat_test_2_v1.cc: New source file.
596         * testsuite/incr_comdat_test_2_v2.cc: New source file.
597         * testsuite/incr_comdat_test_2_v3.cc: New source file.
598
599 2011-09-13  Ian Lance Taylor  <iant@google.com>
600
601         * object.cc (Sized_relobj_file::do_layout): Remove unused local
602         variable external_symbols_offset.
603
604 2011-09-12  Ian Lance Taylor  <iant@google.com>
605
606         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
607         triggered if object has no symbols.
608
609 2011-09-09  David S. Miller  <davem@davemloft.net>
610
611         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
612         (Output_fill_debug_line::do_write): Likewise.
613
614 2011-08-29  Cary Coutant  <ccoutant@google.com>
615
616         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
617         casts to match formatting specs.
618         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
619
620 2011-08-26  Cary Coutant  <ccoutant@google.com>
621
622         * layout.cc (Free_list::allocate): Provide guarantee of minimum
623         remaining hole size when allocating.
624         (Layout::make_output_section): Set fill methods for debug sections.
625         * layout.h (Free_list::Free_list_node): Move from private to
626         public.
627         (Free_list::set_min_hole_size): New function.
628         (Free_list::begin, Free_list::end): New functions.
629         (Free_list::min_hole_): New data member.
630         * output.cc: Include dwarf.h.
631         (Output_fill_debug_info::do_minimum_hole_size): New function.
632         (Output_fill_debug_info::do_write): New function.
633         (Output_fill_debug_line::do_minimum_hole_size): New function.
634         (Output_fill_debug_line::do_write): New function.
635         (Output_section::Output_section): Initialize new data member.
636         (Output_section::set_final_data_size): Ensure patch space is larger
637         than minimum hole size.
638         (Output_section::do_write): Fill holes in debug sections.
639         * output.h (Output_fill): New class.
640         (Output_fill_debug_info): New class.
641         (Output_fill_debug_line): New class.
642         (Output_section::set_free_space_fill): New function.
643         (Output_section::free_space_fill_): New data member.
644         * testsuite/Makefile.am (incremental_test_3): Add
645         --incremental-patch option.
646         (incremental_test_4): Likewise.
647         (incremental_test_5): Likewise.
648         (incremental_test_6): Likewise.
649         (incremental_copy_test): Likewise.
650         (incremental_common_test_1): Likewise.
651         * testsuite/Makefile.in: Regenerate.
652
653 2011-08-26  Nick Clifton  <nickc@redhat.com>
654
655         * po/es.po: Updated Spanish translation.
656
657 2011-08-01  Cary Coutant  <ccoutant@google.com>
658
659         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
660         * gold/testsuite/Makefile.in: Regenerate.
661         * gold/testsuite/justsyms_exec.c: New source file.
662         * gold/testsuite/justsyms_lib.c: New source file.
663
664 2011-08-01  Cary Coutant  <ccoutant@google.com>
665
666         * layout.cc (Layout::set_segment_offsets): Don't realign text
667         segment if -Ttext was specified.
668         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
669         file type.
670         * object.h (Sized_relobj_file::e_type): New function.
671         (Sized_relobj_file::e_type_): New data member.
672         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
673         base address for ET_EXEC files.
674         * target.cc (Target::do_make_elf_object_implementation): Allow
675         ET_EXEC files with --just-symbols option.
676
677 2011-07-28  Cary Coutant  <ccoutant@google.com>
678
679         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
680         Add thread_number parameter.
681         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
682         * workqueue-threads.cc
683         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
684         current thread if its thread number is greater than desired thread
685         count.
686         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
687         Add thread_number parameter.
688         (Workqueue::should_cancel_thread): Likewise.
689         (Workqueue::find_runnable_or_wait): Pass thread_number to
690         should_cancel_thread.
691         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
692         parameter.
693
694 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
695
696         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
697         only after checking if it cannot be forced local.
698         * symtab.h (is_externally_visible): Check if the symbol is not forced
699         local.
700
701 2011-07-15  Ian Lance Taylor  <iant@google.com>
702
703         * options.h (class General_options): Add --print-output-format.
704         Move -EL next to -EB, for  better --help output.
705         * target-select.cc: Include <cstdio>, "options.h", and
706         "parameters.h".
707         (Target_selector::do_target_bfd_name): New function.
708         (print_output_format): New function.
709         * target-select.h (class Target_selector): Update declarations.
710         (Target_selector::target_bfd_name): New function.
711         (print_output_format): Declare.
712         * main.cc: Include "target-select.h".
713         (main): Handle --print-output-format.
714         * gold.cc: Include "target-select.h".
715         (queue_initial_tasks): Handle --print-output-format when there are
716         no input files.
717         * parameters.cc (parameters_force_valid_target): Give a better
718         error message if -EB/-EL does not match target.
719         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
720         function.
721
722 2011-07-15  Ian Lance Taylor  <iant@google.com>
723
724         * i386.cc (class Output_data_plt_i386): Add layout_ field.
725         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
726         (Output_data_plt_i386::do_write): Write address of .dynamic
727         section to first entry in .got.plt section.
728         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
729         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
730         Initialize layout_.
731         (Output_data_plt_x86_64::do_write): Write address of .dynamic
732         section to first entry in .got.plt section.
733         * layout.h (Layout::dynamic_section): New function.
734
735 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
736
737         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
738         to claim_file call.
739         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
740         input_section_position_, and input_section_glob_.
741         (read_layout_from_file): Call function section_ordering_specified.
742         * layout.h (is_section_ordering_specified): New function.
743         (section_ordering_specified): New function.
744         (section_ordering_specified_): New boolean member.
745         * main.cc(main): Call load_plugins after layout object is defined.
746         * output.cc (Output_section::add_input_section): Use
747         function section_ordering_specified to check if section ordering is
748         needed.
749         * output.cc (Output_section::add_relaxed_input_section): Use
750         function section_ordering_specified to check if section ordering is
751         needed.
752         (Output_section::update_section_layout): New function.
753         (Output_section::sort_attached_input_sections): Check if input section
754         must be reordered.
755         * output.h (Output_section::update_section_layout): New function.
756         * plugin.cc (get_section_count): New function.
757         (get_section_type): New function.
758         (get_section_name): New function.
759         (get_section_contents): New function.
760         (update_section_order): New function.
761         (allow_section_ordering): New function. 
762         (Plugin::load): Add the new interfaces to the transfer vector.
763         (Plugin_manager::load_plugins): New parameter.
764         (Plugin_manager::all_symbols_read): New parameter.
765         (Plugin_manager::claim_file): New parameter. Save the elf object for
766         unclaimed objects.
767         (Plugin_manager::get_elf_object): New function.
768         (Plugin_manager::get_view): Change to directly use the bool to check
769         if get_view is called from claim_file_hook.
770         * plugin.h (input_objects): New function
771         (Plugin__manager::load_plugins): New parameter.
772         (Plugin_manager::claim_file): New parameter.
773         (Plugin_manager::get_elf_object): New function.
774         (Plugin_manager::in_claim_file_handler): New function.
775         (Plugin_manager::in_claim_file_handler_): New member.
776         (layout): New function.
777         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
778         handler with an extra parameter. Make the elf object before calling
779         claim_file handler.
780         * testsuite/plugin_test.c (get_section_count): New function pointer.
781         (get_section_type): New function pointer.
782         (get_section_name): New function pointer.
783         (get_section_contents): New function pointer.
784         (update_section_order): New function pointer.
785         (allow_section_ordering): New function pointer.
786         (onload): Check if the new interfaces exist.
787
788 2011-07-13  Ian Lance Taylor  <iant@google.com>
789
790         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
791         relro section.
792         * x86_64.cc (Target_x86_64::got_section): Likewise.
793         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
794         (relro_now_test_SOURCES): New variable.
795         (relro_now_test_DEPENDENCIES): New variable.
796         (relro_now_test_LDFLAGS): New variable.
797         (relro_now_test_LDADD): New variable.
798         (relro_now_test.so): New target.
799         * testsuite/Makefile.in: Rebuild.
800
801 2011-07-12  Ian Lance Taylor  <iant@google.com>
802
803         PR gold/12980
804         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
805         GLOB_DAT relocation rather than a RELATIVE relocation for a
806         protected symbol when creating a shared library.
807         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
808         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
809         * testsuite/protected_main_1.cc (main): Test that protected
810         function has same address.
811
812 2011-07-11  Ian Lance Taylor  <iant@google.com>
813
814         PR gold/12979
815         * options.h (class General_options): Add -Bgroup.
816         * options.cc (General_options::finalize): If -Bgroup is set,
817         default to --unresolved-symbols=report-all.
818         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
819         * target-reloc.h (issue_undefined_symbol_error): Handle
820         --unresolved-symbols=report-all.
821
822 2011-07-08  Ian Lance Taylor  <iant@google.com>
823
824         PR gold/11985
825         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
826         if linker script discards key sections.
827         (Layout::create_dynamic_symtab): Likewise.
828         (Layout::assign_local_dynsym_offsets): Likewise.
829         (Layout::sized_create_version_sections): Likewise.
830         (Layout::create_interp): Likewise.
831         (Layout::finish_dynamic_section): Likewise.
832         (Layout::set_dynamic_symbol_size): Likewise.
833
834 2011-07-08  Ian Lance Taylor  <iant@google.com>
835
836         PR gold/12386
837         * options.h (class General_options): Add --unresolved-symbols.
838         * target-reloc.h (issue_undefined_symbol_error): Check
839         --unresolved-symbols.  Add comments.
840
841 2011-07-08  Ian Lance Taylor  <iant@google.com>
842
843         * testsuite/odr_violation2.cc (Ordering::operator()): Make
844         expression more complex.
845
846 2011-07-08  Ian Lance Taylor  <iant@google.com>
847
848         PR gold/11317
849         * target-reloc.h (issue_undefined_symbol_error): New inline
850         function, broken out of relocate_section.
851         (relocate_section): Call issue_undefined_symbol_error.
852         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
853         there is no TLS segment if we are about to issue an undefined
854         symbol error.
855         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
856
857 2011-07-08  Ian Lance Taylor  <iant@google.com>
858
859         PR gold/12279
860         * resolve.cc (Symbol_table::should_override): Add fromtype
861         parameter.  Change all callers.  Give error when linking together
862         TLS and non-TLS symbol.
863         (Symbol_table::should_override_with_special): Add fromtype
864         parameter.  Change all callers.
865         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
866         there is no TLS segment if we have reported some errors.
867         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
868
869 2011-07-08  Ian Lance Taylor  <iant@google.com>
870
871         PR gold/12372
872         * target.h (Target::plt_address_for_global): New function.
873         (Target::plt_address_for_local): New function.
874         (Target::plt_section_for_global): Remove.
875         (Target::plt_section_for_local): Remove.
876         (Target::do_plt_address_for_global): New virtual function.
877         (Target::do_plt_address_for_local): New virtual function.
878         (Target::do_plt_section_for_global): Remove.
879         (Target::do_plt_section_for_local): Remove.
880         (Target::register_global_plt_entry): Add Symbol_table and Layout
881         parameters.
882         * output.cc (Output_data_got::Got_entry::write): Use
883         plt_address_for_global and plt_address_for_local.
884         * layout.cc (Layout::add_target_dynamic_tags): Use size and
885         address of output section.
886         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
887         got_irelative_, and irelative_count_ fields.  Update
888         declarations.
889         (Output_data_plt_i386::has_irelative_section): New function.
890         (Output_data_plt_i386::entry_count): Add irelative_count_.
891         (Output_data_plt_i386::set_final_data_size): Likewise.
892         (class Target_i386): Add got_irelative_ and rel_irelative_
893         fields.  Update declarations.
894         (Target_i386::Target_i386): Initialize new fields.
895         (Target_i386::do_plt_address_for_global): New function replacing
896         do_plt_section_for_global.
897         (Target_i386::do_plt_address_for_local): New function replacing
898         do_plt_section_for_local.
899         (Target_i386::got_section): Create got_irelative_.
900         (Target_i386::rel_irelative_section): New function.
901         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
902         fields.  Don't define __rel_iplt_{start,end}.
903         (Output_data_plt_i386::add_entry): Add symtab and layout
904         parameters.  Change all callers.  Use different PLT and GOT for
905         IFUNC symbols.
906         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
907         layout parameters.  Change all callers.  Use different PLT and
908         GOT.
909         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
910         (Output_data_plt_i386::rel_irelative): New function.
911         (Output_data_plt_i386::address_for_global): New function.
912         (Output_data_plt_i386::address_for_local): New function.
913         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
914         IRELATIVE GOT when changing IFUNC GOT entries.
915         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
916         reloc.
917         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
918         if we didn't create an IRELATIVE GOT.
919         (Target_i386::Relocate::relocate): Use plt_address_for_global and
920         plt_address_for_local.
921         (Target_i386::do_dynsym_value): Use plt_address_for_global.
922         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
923         got_irelative_, and irelative_count_ fields.  Update
924         declarations.
925         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
926         Initialize new fields.  Remove symtab parameter.  Change all
927         callers.
928         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
929         irelative_count_.
930         (Output_data_plt_x86_64::has_irelative_section): New function.
931         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
932         (class Target_x86_64): Add got_irelative_ and rel_irelative_
933         fields.  Update declarations.
934         (Target_x86_64::Target_x86_64): Initialize new fields.
935         (Target_x86_64::do_plt_address_for_global): New function replacing
936         do_plt_section_for_global.
937         (Target_x86_64::do_plt_address_for_local): New function replacing
938         do_plt_section_for_local.
939         (Target_x86_64::got_section): Create got_irelative_.
940         (Target_x86_64::rela_irelative_section): New function.
941         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
942         all callers.  Don't create __rel_iplt_{start,end}.
943         (Output_data_plt_x86_64::add_entry): Add symtab and layout
944         parameters.  Change all callers.  Use different PLT and GOT for
945         IFUNC symbols.
946         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
947         layout parameters.  Change all callers.  Use different PLT and
948         GOT.
949         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
950         parameters.  Change all callers.  Use different PLT and GOT for
951         IFUNC symbols.
952         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
953         (Output_data_plt_x86_64::rela_irelative): New function.
954         (Output_data_plt_x86_64::address_for_global): New function.
955         (Output_data_plt_x86_64::address_for_local): New function.
956         (Output_data_plt_x86_64::set_final_data_size): Likewise.
957         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
958         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
959         (Target_x86_64::register_global_plt_entry): Add symtab and layout
960         parameters.
961         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
962         reloc.
963         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
964         symbols if we didn't create an IRELATIVE GOT.
965         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
966         plt_address_for_local.
967         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
968         * testsuite/ifuncvar1.c: New test file.
969         * testsuite/ifuncvar2.c: New test file.
970         * testsuite/ifuncvar3.c: New test file.
971         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
972         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
973         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
974         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
975         * testsuite/Makefile.in: Rebuild.
976
977 2011-07-07  Cary Coutant  <ccoutant@google.com>
978
979         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
980         (two_file_test_1_ndebug.o): Likewise.
981         (two_file_test_1b_ndebug.o): Likewise.
982         (two_file_test_2_ndebug.o): Likewise.
983         (two_file_test_main_ndebug.o): Likewise.
984         (incremental_test_2): Link with no-debug versions.
985
986 2011-07-06  Cary Coutant  <ccoutant@google.com>
987
988         * gold/incremental.cc
989         (Output_section_incremental_inputs::write_info_blocks): Check for
990         hidden and internal symbols.
991
992 2011-07-06  Cary Coutant  <ccoutant@google.com>
993
994         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
995         Check disposition for startup file.
996         (Incremental_inputs::report_command_line): Ignore
997         --incremental-startup-unchanged option.
998         * options.cc (General_options::parse_incremental_startup_unchanged):
999         New function.
1000         (General_options::General_options): Initialize new data member.
1001         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1002         (General_options): Add --incremental-startup-unchanged option.
1003         (General_options::incremental_startup_disposition): New function.
1004         (General_options::incremental_startup_disposition_): New data member.
1005
1006 2011-07-06  Cary Coutant  <ccoutant@google.com>
1007
1008         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1009         input file index to Script_info ctor.
1010         (Sized_incremental_binary::do_file_has_changed): Find the
1011         command-line argument for files named in scripts.
1012         * incremental.h (Script_info::Script_info): New ctor
1013         with input file index.
1014         (Script_info::input_file_index): New function.
1015         (Script_info::input_file_index_): New data member.
1016         (Incremental_binary::get_library): Add const.
1017         (Incremental_binary::get_script_info): Add const.
1018         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1019         * testsuite/Makefile.am (incremental_test_5): New test case.
1020         (incremental_test_6): New test case.
1021         * testsuite/Makefile.in: Regenerate.
1022
1023 2011-07-06  Cary Coutant  <ccoutant@google.com>
1024
1025         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1026         debug output when command lines differ.
1027
1028 2011-07-06  Cary Coutant  <ccoutant@google.com>
1029
1030         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1031         --incremental-patch option.
1032         * layout.cc (Free_list::allocate): Extend allocation beyond original
1033         end if enabled.
1034         (Layout::make_output_section): Mark sections that should get
1035         patch space.
1036         * options.cc (parse_percent): New function.
1037         * options.h (parse_percent): New function.
1038         (DEFINE_percent): New macro.
1039         (General_options): Add --incremental-patch option.
1040         * output.cc (Output_section::Output_section): Initialize new data
1041         members.
1042         (Output_section::add_input_section): Print section name when out
1043         of patch space.
1044         (Output_section::add_output_section_data): Likewise.
1045         (Output_section::set_final_data_size): Add patch space when
1046         doing --incremental-full.
1047         (Output_section::do_reset_address_and_file_offset): Remove patch
1048         space.
1049         (Output_segment::set_section_list_addresses): Print debug output
1050         only if --incremental-update.
1051         * output.h (Output_section::set_is_patch_space_allowed): New function.
1052         (Output_section::is_patch_space_allowed_): New data member.
1053         (Output_section::patch_space_): New data member.
1054         * parameters.cc (Parameters::incremental_full): New function.
1055         * parameters.h (Parameters::incremental_full): New function
1056         * testsuite/Makefile.am (incremental_test_2): Add test for
1057         --incremental-patch option.
1058         * testsuite/Makefile.in: Regenerate.
1059         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1060         (t18): Remove function body.
1061
1062 2011-07-05  Doug Kwan  <dougkwan@google.com>
1063
1064         PR gold/12771
1065         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1066         Arm_Address type for relocation result.
1067         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1068         overflow check.
1069         (Arm_relocate_functions::abs32): Use unaligned access.
1070         (Arm_relocate_functions::rel32): Ditto.
1071         (Arm_relocate_functions::prel31): Ditto.
1072         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1073         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1074         static data relocations.
1075         * testsuite/Makefile.in: Regnerate.
1076         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1077
1078 2011-07-05  Ian Lance Taylor  <iant@google.com>
1079
1080         PR gold/12392
1081         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1082         symbols if necessary.
1083         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1084
1085 2011-07-05  Ian Lance Taylor  <iant@google.com>
1086
1087         PR gold/12952
1088         * resolve.cc (Symbol::override_base_with_special): Simply override
1089         version with special symbol version, ignoring previous version.
1090
1091 2011-07-05  Ian Lance Taylor  <iant@google.com>
1092
1093         * object.cc (Sized_relobj_file::include_section_group): Add
1094         information to comment about signature location.
1095
1096 2011-07-02  Ian Lance Taylor  <iant@google.com>
1097
1098         PR gold/12957
1099         * options.h (class General_options): Add -f and -F.
1100         * options.cc (General_options::finalize): Fatal error if -f/-F
1101         are used without -shared.
1102         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1103
1104 2011-07-02  Ian Lance Taylor  <iant@google.com>
1105
1106         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1107
1108 2011-07-01  Ian Lance Taylor  <iant@google.com>
1109
1110         PR gold/12525
1111         PR gold/12952
1112         * resolve.cc (Symbol::override_base_with_special): Don't override
1113         the version if the overriding symbol has a different name.
1114         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1115         all callers.  If we give an error about an undefined version,
1116         define the base version if necessary.
1117         * dynobj.h (class Versions): Update declaration.
1118         * testsuite/weak_alias_test_5.cc: New file.
1119         * testsuite/weak_alias_test.script: New file.
1120         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1121         and versioned_alias have the right value, and call t2.
1122         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1123         weak_alias_test_5.so.
1124         (weak_alias_test_LDADD): Likewise.
1125         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1126         * testsuite/Makefile.in: Rebuild.
1127
1128 2011-07-01  Ian Lance Taylor  <iant@google.com>
1129
1130         PR gold/12525
1131         * options.h (class General_options): Support -z notext.
1132         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1133         -Wl,-z,notext.
1134         (two_file_shared_nonpic.so): Likewise.
1135         (two_file_shared_mixed.so): Likewise.
1136         (two_file_shared_mixed_1.so): Likewise.
1137         (weak_undef_lib_nonpic.so): Likewise.
1138         (alt/weak_undef_lib_nonpic.so): Likewise.
1139         (tls_test_shared_nonpic.so): Likewise.
1140         * testsuite/Makefile.in: Rebuild.
1141
1142 2011-07-01  Ian Lance Taylor  <iant@google.com>
1143
1144         PR gold/12525
1145         * configure.ac: Test whether static linking works, setting
1146         the automake conditional HAVE_STATIC.
1147         * testsuite/Makefile.am: Disable tests using -static if
1148         HAVE_STATIC is not true.
1149         * configure, testsuite/Makefile.in: Rebuild.
1150
1151 2011-07-01  Ian Lance Taylor  <iant@google.com>
1152
1153         PR gold/12525
1154         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1155         Assert if we see DW_EH_PE_indirect.
1156         * target.h (Target::ehframe_datarel_base): New function.
1157         (Target::do_ehframe_datarel_base): New target function.
1158         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1159         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1160         function.
1161
1162 2011-07-01  Ian Lance Taylor  <iant@google.com>
1163
1164         PR gold/12571
1165         * options.h (class General_options): Add
1166         --ld-generated-unwind-info.
1167         * ehframe.cc (Fde::write): Add address parameter.  Change all
1168         callers.  If associated with PLT, fill in address and size.
1169         (Cie::set_output_offset): Only add merge mapping if there is an
1170         object.
1171         (Cie::write): Add address parameter.  Change all callers.
1172         (Eh_frame::add_ehframe_for_plt): New function.
1173         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1174         input_offset_ fields into union u_, with new plt field.
1175         (Fde::Fde): Adjust for new union field.
1176         (Fde::Fde) [Output_data version]: New constructor.
1177         (Fde::add_mapping): Only add merge mapping if there is an object.
1178         (class Cie): Update declarations.
1179         (class Eh_frame): Declare add_ehframe_for_plt.
1180         * layout.cc (Layout::layout_eh_frame): Break out code into
1181         make_eh_frame_section, and call it.
1182         (Layout::make_eh_frame_section): New function.
1183         (Layout::add_eh_frame_for_plt): New function.
1184         * layout.h (class Layout): Update declarations.
1185         * merge.cc (Merge_map::add_mapping): Add assertion.
1186         * i386.cc: Include "dwarf.h".
1187         (class Output_data_plt_i386): Make first_plt_entry,
1188         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1189         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1190         and plt_eh_frame_fde.
1191         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1192         boundary.  Call add_eh_frame_for_plt if appropriate.
1193         * x86_64.cc: Include "dwarf.h".
1194         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1195         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1196         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1197         and plt_eh_frame_fde.
1198         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1199         appropriate.
1200
1201 2011-06-29  Ian Lance Taylor  <iant@google.com>
1202
1203         PR gold/12629
1204         * object.cc (Sized_relobj_file::layout_section): Change shdr
1205         parameter to be const.
1206         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1207         out of do_layout.
1208         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1209         appropriate.  Call layout_eh_frame_section.
1210         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1211         sections.
1212         * object.h (class Sized_relobj_file): Update declarations.
1213
1214 2011-06-29  Ian Lance Taylor  <iant@google.com>
1215
1216         PR gold/12652
1217         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1218         modifier.
1219         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1220
1221 2011-06-29  Ian Lance Taylor  <iant@google.com>
1222
1223         PR gold/12675
1224         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1225         SHT_X86_64_UNWIND.
1226         * layout.cc (Layout::layout_eh_frame): Likewise.
1227
1228 2011-06-29  Ian Lance Taylor  <iant@google.com>
1229
1230         PR gold/12695
1231         * layout.cc (Layout::symtab_section_shndx): New function.
1232         * layout.h (class Layout): Declare symtab_section_shndx.
1233         * output.cc (Output_section::write_header): Call it.
1234
1235 2011-06-29  Ian Lance Taylor  <iant@google.com>
1236
1237         PR gold/12818
1238         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1239         symbols which are not used in a relocation.
1240
1241 2011-06-28  Ian Lance Taylor  <iant@google.com>
1242
1243         PR gold/12898
1244         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1245         script create indistinguishable segments.
1246         (Layout::set_segment_offsets): Use stable_sort when sorting
1247         segments.  Pass this to Compare_segments constructor.
1248         * layout.h (class Layout): Make segment_precedes non-static.
1249         (class Compare_segments): Change from struct to class.  Add
1250         layout_ field.  Add constructor.
1251         * script-sections.cc
1252         (Script_sections::attach_sections_using_phdrs_clause): Rename
1253         local orphan to is_orphan.  Don't report failure to put empty
1254         section in segment.  On attachment failure, report name of
1255         section, and attach to first PT_LOAD segment.
1256
1257 2011-06-28  Ian Lance Taylor  <iant@google.com>
1258
1259         PR gold/12934
1260         * target-select.cc (Target_selector::Target_selector): Add
1261         emulation parameter.  Change all callers.
1262         (select_target_by_bfd_name): Rename from select_target_by_name.
1263         Change all callers.
1264         (select_target_by_emulation): New function.
1265         (supported_emulation_names): New function.
1266         * target-select.h (class Target_selector): Add emulation_ field.
1267         Update declarations.
1268         (Target_selector::recognize_by_bfd_name): Rename from
1269         recognize_by_name.  Change all callers.
1270         (Target_selector::supported_bfd_names): Rename from
1271         supported_names.  Change all callers.
1272         (Target_selector::recognize_by_emulation): New function.
1273         (Target_selector::supported_emulations): New function.
1274         (Target_selector::emulation): New function.
1275         (Target_selector::do_recognize_by_bfd_name): Rename from
1276         do_recognize_by_name.  Change all callers.
1277         (Target_selector::do_supported_bfd_names): Rename from
1278         do_supported_names.  Change all callers.
1279         (Target_selector::do_recognize_by_emulation): New function.
1280         (Target_selector::do_supported_emulations): New function.
1281         (select_target_by_bfd_name): Change name in declaration.
1282         (select_target_by_emulation): Declare.
1283         (supported_emulation_names): Declare.
1284         * parameters.cc (parameters_force_valid_target): Try to find
1285         target based on emulation from -m option.
1286         * options.h (class General_options): Change doc string for -m.
1287         * options.cc (help): Print emulations.
1288         (General_options::parse_V): Likewise.
1289         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1290         Add emulation parameter.  Change all callers.
1291
1292 2011-06-28  Ian Lance Taylor  <iant@google.com>
1293
1294         * target.h (class Target): Add osabi_ field.
1295         (Target::osabi): New function.
1296         (Target::set_osabi): New function.
1297         (Target::Target): Initialize osabi_.
1298         (Target::do_adjust_elf_header): Make pure virtual.
1299         (Sized_target::do_adjust_elf_header): Declare.
1300         * target.cc (Sized_target::do_adjust_elf_header): New function.
1301         (class Sized_target): Instantiate all versions.
1302         * freebsd.h (class Target_freebsd): Remove.
1303         (Target_selector_freebsd::do_recognize): Call set_osabi on
1304         Target.
1305         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1306         (Target_selector_freebsd::set_osabi): Remove.
1307         * i386.cc (class Target_i386): Inherit from Sized_target rather
1308         than Target_freebsd.
1309         * x86_64.cc (class Target_x86_64): Likewise.
1310
1311 2011-06-28  Ian Lance Taylor  <iant@google.com>
1312
1313         * target.h (Target::can_check_for_function_pointers): Rewrite.
1314         Make non-virtual.
1315         (Target::can_icf_inline_merge_sections): Likewise.
1316         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1317         (Target::Target_info): Add can_icf_inline_merge_sections field.
1318         (Target::do_can_check_for_function_pointers): New virtual
1319         function.
1320         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1321         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1322         from can_check_for_function_pointers, move in file.
1323         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1324         section_may_have_icf_unsafe_poineters, move in file.
1325         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1326         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1327         Rename from can_check_for_function_pointers, move in file.
1328         (Target_i386::can_icf_inline_merge_sections): Remove.
1329         (Target_i386::i386_info): Initialize
1330         can_icf_inline_merge_sections.
1331         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1332         Initialize can_icf_inline_merge_sections.
1333         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1334         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1335         Rename from can_check_for_function_pointers, move in file.
1336         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1337         (Target_x86_64::x86_64_info): Initialize
1338         can_icf_inline_merge_sections.
1339         * testsuite/testfile.cc (Target_test::test_target_info):
1340         Likewise.
1341         * icf.cc (get_section_contents): Correct formatting.
1342
1343 2011-06-27  Ian Lance Taylor  <iant@google.com>
1344
1345         * symtab.cc (Symbol::versioned_name): New function.
1346         (Symbol_table::add_to_final_symtab): Use versioned_name when
1347         appropriate.
1348         (Symbol_table::sized_write_symbol): Likewise.
1349         * symtab.h (class Symbol): Declare versioned_name.
1350         * stringpool.h (class Stringpool_template): Add variant of add
1351         which takes a std::basic_string.
1352         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1353         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1354         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1355         (ver_test_12.o): New target.
1356         * testsuite/Makefile.in: Rebuild.
1357
1358 2011-06-27  Doug Kwan  <dougkwan@google.com>
1359
1360         * arm.cc (Arm_relocate_functions::thm_jump8,
1361         Arm_relocate_functions::thm_jump11): Use a wider signed
1362         type to compute offset.
1363         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1364         arm_thm_jump8.
1365         * testsuite/Makefile.in: Regenerate.
1366         * testsuite/arm_branch_in_range.sh: Check test results of
1367         arm_thm_jump11 and arm_thm_jump8.
1368         * testsuite/arm_thm_jump11.s: New test source file.
1369         * testsuite/arm_thm_jump11.t: New linker script.
1370         * testsuite/arm_thm_jump8.s: New test source file.
1371         * testsuite/arm_thm_jump8.t: New linker script.
1372
1373 2011-06-24  Ian Lance Taylor  <iant@google.com>
1374
1375         * layout.cc: Include "object.h".
1376         (ctors_sections_in_init_array): New static variable.
1377         (Layout::is_ctors_in_init_array): New function.
1378         (Layout::layout): Add entry to ctors_sections_in_init_array if
1379         appropriate.
1380         * layout.h (class Layout): Declare is_ctors_in_init_array.
1381         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1382         is_ctors_reverse_view is set.
1383         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1384         all callers.  Set is_ctors_reverse_view field of View_size.
1385         (Sized_relobj_file::reverse_words): New function.
1386         * object.h (Sized_relobj_file::View_size): Add
1387         is_ctors_reverse_view field.
1388         (class Sized_relobj_file): Update declarations.
1389         * testsuite/initpri3.c: New test.
1390         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1391         initpri3b.
1392         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1393         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1394         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1395         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1396         * testsuite/Makefile.in: Rebuild.
1397
1398 2011-06-24  Cary Coutant  <ccoutant@google.com>
1399
1400         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1401         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1402         (debug_msg_cdebug.err): New targets.
1403         * testsuite/Makefile.in: Regenerate.
1404         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1405         Fix checks for link with shared library.
1406
1407 2011-06-24  Doug Kwan  <dougkwan@google.com>
1408
1409         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1410         skip empty text sections.
1411         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1412
1413 2011-06-22  Ian Lance Taylor  <iant@google.com>
1414
1415         PR gold/12910
1416         * options.h (class General_options): Add --ctors-in-init-array.
1417         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1418         friends as SHT_PROGBITS for merging sections.
1419         (Layout::layout): Remove special handling of .init_array and
1420         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1421         and .dtors if ctors_in_init_array.
1422         (Layout::make_output_section): Force correct section types for
1423         .init_array and friends.  Don't sort if doing relocatable link,
1424         Don't sort .ctors and .dtors if ctors_in_init_array.
1425         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1426         (Layout::output_section_name): Add relobj parameter.  Change all
1427         callers.  Handle .ctors. and .dtors. in code rather than table.
1428         Handle .ctors and .dtors if ctors_in_init_array.
1429         (Layout::match_file_name): New function, moved from output.cc.
1430         * layout.h (class Layout): Update declarations.
1431         * output.cc: Include "layout.h".
1432         (Input_section_sort_entry::get_priority): New function.
1433         (Input_section_sort_entry::match_file_name): Just call
1434         Layout::match_file_name.
1435         (Output_section::Input_section_sort_init_fini_compare::operator()):
1436         Handle .ctors and .dtors.  Sort by explicit priority rather than
1437         by name.
1438         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1439         * testsuite/initpri2.c: New test.
1440         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1441         (check_PROGRAMS): Add initpri2.
1442         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1443         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1444         * configure, testsuite/Makefile.in: Rebuild.
1445
1446 2011-06-19  Ian Lance Taylor  <iant@google.com>
1447
1448         PR gold/12880
1449         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1450         .interp section to a PT_INTERP segment even if we have seen a
1451         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1452         clause in a linker script.
1453         (Layout::finalize): Don't create a .interp section if we've
1454         already create a PT_INTERP segment.
1455         (Layout::create_interp): Always call choose_output_section (revert
1456         patch of 2011-06-17).  Don't create PT_INTERP segment.
1457         * script-sections.cc
1458         (Script_sections::create_note_and_tls_segments): Add a .interp
1459         section to a PT_INTERP segment even if we have seen a
1460         --dynamic-linker option.
1461
1462 2011-06-18  Ian Lance Taylor  <iant@google.com>
1463
1464         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1465         merely because a non-PT_LOAD segment has a dynamic reloc.
1466
1467 2011-06-18  Ian Lance Taylor  <iant@google.com>
1468
1469         * layout.cc (Layout::finish_dynamic_section): Don't create
1470         DT_FLAGS entry if not needed.
1471
1472 2011-06-18  Ian Lance Taylor  <iant@google.com>
1473
1474         PR gold/12745
1475         * layout.cc (Layout::layout_eh_frame): Correct handling of
1476         writable .eh_frame section.
1477
1478 2011-06-17  Ian Lance Taylor  <iant@google.com>
1479
1480         PR gold/12893
1481         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1482         symbol is redefined with the exact same object and value.
1483
1484 2011-06-17  Ian Lance Taylor  <iant@google.com>
1485
1486         PR gold/12880
1487         * layout.h (class Layout): Add interp_segment_ field.
1488         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1489         (Layout::attach_allocated_section_to_segment): If making shared
1490         library, put .interp section in PT_INTERP segment.
1491         (Layout::finalize): Also call create_interp if -dynamic-linker
1492         option was used.
1493         (Layout::create_interp): Assert that there is no PT_INTERP
1494         segment.  If not using a SECTIONS clause, use make_output_section.
1495         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1496         * script-sections.cc
1497         (Script_sections::create_note_and_tls_segments): If making shared
1498         library, put .interp section in PT_INTERP segment.
1499
1500 2011-06-17  Ian Lance Taylor  <iant@google.com>
1501
1502         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1503         when making a shared library.
1504
1505 2011-06-17  Ian Lance Taylor  <iant@google.com>
1506
1507         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1508         parameter.  Change all callers.  Don't issue warning about PC32
1509         against locally defined symbol.
1510
1511 2011-06-16  Ian Lance Taylor  <iant@google.com>
1512
1513         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1514         occurs in same object.
1515
1516 2011-06-14  Alan Modra  <amodra@gmail.com>
1517
1518         * po/POTFILES.in: Regenerate.
1519
1520 2011-06-09  Ian Lance Taylor  <iant@google.com>
1521
1522         * script-sections.cc
1523         (Orphan_output_section::set_section_addresses): For a relocatable
1524         link set address to 0.
1525
1526 2011-06-09  Cary Coutant  <ccoutant@google.com>
1527
1528         PR gold/12804
1529         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1530         used with --compress-debug-sections.
1531         * gold/object.cc (Sized_relobj_file::do_layout): Report
1532         uncompressed size of compressed input sections.
1533
1534 2011-06-08  Cary Coutant  <ccoutant@google.com>
1535
1536         PR gold/12804
1537         * testsuite/two_file_test_2_v1.cc: Change initialization of
1538         v2 to keep it in .data.
1539
1540 2011-06-07  Cary Coutant  <ccoutant@google.com>
1541
1542         * common.cc (Symbol_table::do_allocate_commons_list): Call
1543         gold_fallback.
1544         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1545         (Errors::fallback): New function.
1546         (gold_fallback): New function.
1547         * errors.h (Errors::fallback): New function.
1548         * gold.cc (gold_exit): Change status parameter to enum; adjust
1549         all callers.
1550         (queue_initial_tasks): Call gold_fallback.
1551         * gold.h: Include cstdlib.
1552         (Exit_status): New enum type.
1553         (gold_exit): Change status parameter to enum.
1554         (gold_fallback): New function.
1555         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1556         (Layout::create_symtab_sections): Likewise.
1557         (Layout::create_shdrs): Likewise.
1558         * main.cc (main): Adjust call to gold_exit.
1559         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1560         (Output_data_got::add_got_entry_pair): Likewise.
1561         (Output_section::add_input_section): Likewise.
1562         (Output_section::add_output_section_data): Likewise.
1563         (Output_segment::set_section_list_addresses): Likewise.
1564         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1565
1566 2011-06-07  Cary Coutant  <ccoutant@google.com>
1567
1568         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1569         for incremental links.
1570         * output.cc (Output_segment::set_section_list_addresses): Remove
1571         FIXME and test for TLS or BSS.
1572
1573 2011-06-07  Cary Coutant  <ccoutant@google.com>
1574
1575         * testsuite/Makefile.am: Add incremental_copy_test,
1576         incremental_common_test_1.
1577         * testsuite/Makefile.in: Regenerate.
1578         * testsuite/common_test_1_v1.c: New source file.
1579         * testsuite/common_test_1_v2.c: New source file.
1580         * testsuite/copy_test_v1.cc: New source file.
1581
1582 2011-06-07  Cary Coutant  <ccoutant@google.com>
1583
1584         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1585         update, allocate common from bss section's free list.
1586         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1587         linker-defined symbols.
1588         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1589         Skip GOT and PLT entries that are no longer referenced.
1590         (Output_section_incremental_inputs::write_info_blocks): Mark
1591         linker-defined symbols.
1592         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1593         * output.cc (Output_section::allocate): New function.
1594         * output.h (Output_section::allocate): New function.
1595         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1596         linker-defined symbols.
1597         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1598         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1599         (Symbol::init_base_output_data): Likewise.
1600         (Symbol::init_base_output_segment): Likewise.
1601         (Symbol::init_base_constant): Likewise.
1602         (Sized_symbol::init_output_data): Likewise.
1603         (Sized_symbol::init_output_segment): Likewise.
1604         (Sized_symbol::init_constant): Likewise.
1605         (Symbol_table::do_define_in_output_data): Likewise.
1606         (Symbol_table::do_define_in_output_segment): Likewise.
1607         (Symbol_table::do_define_as_constant): Likewise.
1608         * symtab.h (Symbol::is_predefined): New function.
1609         (Symbol::init_base_output_data): Add is_predefined parameter.
1610         (Symbol::init_base_output_segment): Likewise.
1611         (Symbol::init_base_constant): Likewise.
1612         (Symbol::is_predefined_): New data member.
1613         (Sized_symbol::init_output_data): Add is_predefined parameter.
1614         (Sized_symbol::init_output_segment): Likewise.
1615         (Sized_symbol::init_constant): Likewise.
1616         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1617
1618 2011-06-07  Cary Coutant  <ccoutant@google.com>
1619
1620         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1621         instead of emit_copy_reloc.
1622         (Copy_relocs::emit_copy_reloc): Refactor.
1623         (Copy_relocs::make_copy_reloc): New function.
1624         (Copy_relocs::add_copy_reloc): Remove.
1625         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1626         section.
1627         (Copy_relocs::make_copy_reloc): New function.
1628         (Copy_relocs::add_copy_reloc): Remove.
1629         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1630         unchanged input files.
1631         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1632         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1633         Reserve BSS space for COPY relocations.
1634         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1635         (Output_section_incremental_inputs::write_info_blocks): Record
1636         whether a symbol is copied from a shared object.
1637         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1638         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1639         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1640         (Incremental_input_entry_reader::get_output_symbol_index): Add
1641         is_copy parameter.
1642         (Incremental_binary::emit_copy_relocs): New function.
1643         (Incremental_binary::do_emit_copy_relocs): New function.
1644         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1645         new data member.
1646         (Sized_incremental_binary::add_copy_reloc): New function.
1647         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1648         (Sized_incremental_binary::Copy_reloc): New struct.
1649         (Sized_incremental_binary::Copy_relocs): New typedef.
1650         (Sized_incremental_binary::copy_relocs_): New data member.
1651         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1652         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1653         * target.h (Sized_target::emit_copy_reloc): New function.
1654         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1655
1656 2011-06-02  Cary Coutant  <ccoutant@google.com>
1657
1658         PR gold/12163
1659         * gold/archive.cc (Archive::Archive): Initialize new data member.
1660         (Archive::include_all_members): Return if archive has already been
1661         included.
1662         * gold/archive.h (Archive::include_all_members_): New data member.
1663
1664 2011-06-02  Nick Clifton  <nickc@redhat.com>
1665
1666         * dynobj.h: Fix spelling mistake in comment.
1667         * output.cc: Likewise.
1668
1669 2011-05-31  Doug Kwan  <dougkwan@google.com>
1670             Asier Llano
1671
1672         PR gold/12826
1673         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1674         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1675         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1676         redundant arm_exidx_test.so.
1677         * testsuite/Makefile.in: Regenerate.
1678         (check_SCRIPTS): Add pr12826.sh
1679         (check_DATA): Add pr12826.stdout
1680         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1681         * testsuite/pr12826.sh: New file.
1682         * testsuite/pr12826_1.s: Ditto.
1683         * testsuite/pr12826_1.s: Ditto.
1684
1685 2011-05-30  Ian Lance Taylor  <iant@google.com>
1686
1687         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1688         sections.
1689
1690 2011-05-29  Ian Lance Taylor  <iant@google.com>
1691
1692         PR gold/12804
1693         * testsuite/Makefile.am: Use different file name for two_file_test
1694         temporary file for each incremental test.
1695         * testsuite/Makefile.in: Rebuild.
1696
1697 2011-05-29  Ian Lance Taylor  <iant@google.com>
1698
1699         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1700         binary input file is empty.
1701
1702 2011-05-27  Ian Lance Taylor  <iant@google.com>
1703
1704         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1705         (ver_test_9.so): Likewise.
1706         * testsuite/Makefile.in: Rebuild.
1707
1708 2011-05-26 Cary Coutant  <ccoutant@google.com>
1709
1710         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1711         * incremental.cc (Incremental_inputs::report_input_section): Fix
1712         comment, indentation.
1713         (Incremental_inputs::report_comdat_group): New function.
1714         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1715         of data for incremental input file entry.
1716         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1717         group count, COMDAT group signatures.
1718         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1719         an unchanged input file.
1720         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1721         Initialize new data member.
1722         (Incremental_object_entry::add_comdat_group): New function.
1723         (Incremental_object_entry::get_comdat_group_count): New function.
1724         (Incremental_object_entry::get_comdat_signature_key): New function.
1725         (Incremental_object_entry::groups_): New data member.
1726         (Incremental_inputs::report_comdat_group): New function.
1727         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1728         data for incremental input file entry.
1729         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1730         (Incremental_input_entry_reader::get_input_section): Adjust size of
1731         data for incremental input file entry.
1732         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1733         (Incremental_input_entry_reader::get_comdat_group_signature): New
1734         function.
1735         * object.cc (Sized_relobj::include_section_group): Report kept
1736         COMDAT groups for incremental links.
1737
1738 2011-05-24  David Meyer  <pdox@google.com>
1739
1740         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1741         with name parameter.  Add found_name parameter.
1742         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1743         * dirsearch.h (class Dirsearch): Update declaration.
1744
1745 2011-05-24  Ian Lance Taylor  <iant@google.com>
1746
1747         * archive.cc (Library_base::should_include_member): Pull in object
1748         from archive if it defines the entry symbol.
1749         * parameters.cc (Parameters::entry): New function.
1750         * parameters.h (class Parameters): Declare entry.
1751         * output.h (class Output_file_header): Remove entry_ field.
1752         * output.cc (Output_file_header::Output_file_header): Remove entry
1753         parameter.  Change all callers.
1754         (Output_file_header::entry): Use parameters->entry.
1755         * gold.cc (queue_middle_tasks): Likewise.
1756         * plugin.cc (Plugin_hook::run): Likewise.
1757
1758 2011-05-24 Cary Coutant  <ccoutant@google.com>
1759
1760         * gold.cc (queue_initial_tasks): Pass incremental base filename
1761         to Output_file::open_base_file; don't print error message.
1762         * incremental-dump.cc (main): Adjust call to
1763         Output_file::open_for_modification.
1764         * incremental-dump.cc (main): Likewise.
1765         * incremental.cc (Incremental_inputs::report_command_line):
1766         Ignore --incremental-base option when comparing command lines.
1767         Ignore parameter when given as separate argument.
1768         * options.h (class General_options): Add --incremental-base.
1769         * output.cc (Output_file::Output_file):
1770         (Output_file::open_base_file): Add base_name and writable parameters;
1771         read base file into new file; print error message here.
1772         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1773         callers.
1774         * output.h (Output_file::open_for_modification): Rename to...
1775         (Output_file::open_base_file): ...this; add base_name and
1776         writable parameters; adjust all callers.
1777         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1778         callers.
1779         * testsuite/Makefile.am (incremental_test_4): Test
1780         --incremental-base.
1781         * testsuite/Makefile.in: Regenerate.
1782
1783 2011-05-24 Cary Coutant  <ccoutant@google.com>
1784
1785         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1786         incremental_test_4.
1787         * testsuite/Makefile.in: Regenerate.
1788         * testsuite/two_file_test_1_v1.cc: New test source file.
1789         * testsuite/two_file_test_1b_v1.cc: New test source file.
1790         * testsuite/two_file_test_2_v1.cc: New test source file.
1791
1792 2011-05-24 Cary Coutant  <ccoutant@google.com>
1793
1794         * dynobj.h (Dynobj::do_dynobj): New function.
1795         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1796         flag and soname for shared objects.
1797         * incremental.cc (Incremental_inputs::report_object): Make
1798         either Incremental_object_entry or Incremental_dynobj_entry; add
1799         soname to string table.
1800         (Incremental_inputs::report_input_section): Add assertion.
1801         (Output_section_incremental_inputs::set_final_data_size): Adjust
1802         type of input file entry for shared libraries; adjust size of
1803         shared library info entry.
1804         (Output_section_incremental_inputs::write_input_files): Write
1805         as_needed flag for shared libraries.
1806         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1807         of input file entry for shared libraries; write soname.
1808         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1809         soname from incremental info.
1810         * incremental.h (enum Incremental_input_flags): Add
1811         INCREMENTAL_INPUT_AS_NEEDED.
1812         (Incremental_input_entry::Incremental_input_entry): Initialize new
1813         data member.
1814         (Incremental_input_entry::set_as_needed): New function.
1815         (Incremental_input_entry::as_needed): New function.
1816         (Incremental_input_entry::do_dynobj_entry): New function.
1817         (Incremental_input_entry::as_needed_): New data member.
1818         (Incremental_object_entry::Incremental_object_entry): Don't check
1819         for shared library.
1820         (Incremental_object_entry::do_type): Likewise.
1821         (class Incremental_dynobj_entry): New class.
1822         (Incremental_input_entry_reader::as_needed): New function.
1823         (Incremental_input_entry_reader::get_soname): New function.
1824         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1825         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1826         size of shared library info entry.
1827         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1828         incremental link when adding DT_NEEDED entries.
1829         * object.h (Object::Object): Initialize new data member.
1830         (Object::dynobj): New function.
1831         (Object::set_as_needed): New function.
1832         (Object::as_needed): New function.
1833         (Object::do_dynobj): New function.
1834         (Object::as_needed_): New data member.
1835
1836 2011-05-24 Cary Coutant  <ccoutant@google.com>
1837
1838         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1839         info; adjust display of GOT entries.
1840         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1841         vector of input objects; remove file_status_.
1842         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1843         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1844         got_plt reader; call target hooks to reserve GOT entries.
1845         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1846         of input file info header and GOT info entry.
1847         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1848         relocation info.
1849         (Got_plt_view_info::got_descriptor): Remove.
1850         (Got_plt_view_info::sym_index): New data member.
1851         (Got_plt_view_info::input_index): New data member.
1852         (Local_got_offset_visitor::visit): Write input file index.
1853         (Global_got_offset_visitor::visit): Write 0 for input file index.
1854         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1855         with sym_index and input_index.
1856         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1857         incremental info GOT entry; replace got_descriptor with input_index.
1858         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1859         map from input file index to object.
1860         (Sized_relobj_incr::do_layout): Replace direct data member reference
1861         with accessor function.
1862         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1863         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1864         Adjust size of input file info header.
1865         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1866         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1867         (Incremental_input_entry_reader::get_input_section): Adjust size of
1868         input file info header.
1869         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1870         of incremental info GOT entry.
1871         (Incremental_got_plt_reader::get_got_desc): Remove.
1872         (Incremental_got_plt_reader::get_got_symndx): New function.
1873         (Incremental_got_plt_reader::get_got_input_index): New function.
1874         (Sized_incremental_binary::Sized_incremental_binary): Remove
1875         file_status_; add input_objects_.
1876         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1877         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1878         (Sized_incremental_binary::file_is_unchanged): Remove.
1879         (Sized_incremental_binary::set_input_object): New function.
1880         (Sized_incremental_binary::input_object): New function.
1881         (Sized_incremental_binary::file_status_): Remove.
1882         (Sized_incremental_binary::input_objects_): New data member.
1883         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1884         references.
1885         (Sized_relobj_incr::invalid_address): Move to base class.
1886         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1887         class.
1888         (Sized_relobj_incr::do_output_section_offset): Likewise.
1889         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1890         (Sized_relobj_incr::section_offsets_): Likewise.
1891         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1892         function.
1893         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1894         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1895         with accessor function.
1896         (Sized_relobj_file::do_layout): Likewise.
1897         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1898         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1899         (Sized_relobj_file::compute_final_local_value): Replace refs to
1900         section_offsets_ with accessor function.
1901         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1902         * object.h (Relobj::Relobj): Initialize new data members.
1903         (Relobj::add_dyn_reloc): New function.
1904         (Relobj::first_dyn_reloc): New function.
1905         (Relobj::dyn_reloc_count): New function.
1906         (Relobj::first_dyn_reloc_): New data member.
1907         (Relobj::dyn_reloc_count_): New data member.
1908         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1909         references.
1910         (Sized_relobj::Address): New typedef.
1911         (Sized_relobj::invalid_address): Move here from child class.
1912         (Sized_relobj::Sized_relobj): Initialize new data members.
1913         (Sized_relobj::sized_relobj): New function.
1914         (Sized_relobj::is_output_section_offset_invalid): Move here from
1915         child class.
1916         (Sized_relobj::get_output_section_offset): Likewise.
1917         (Sized_relobj::local_has_got_offset): Likewise.
1918         (Sized_relobj::local_got_offset): Likewise.
1919         (Sized_relobj::set_local_got_offset): Likewise.
1920         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1921         (Sized_relobj::clear_got_offsets): New function.
1922         (Sized_relobj::section_offsets): Move here from child class.
1923         (Sized_relobj::do_output_section_offset): Likewise.
1924         (Sized_relobj::do_set_section_offset): Likewise.
1925         (Sized_relobj::Local_got_offsets): Likewise.
1926         (Sized_relobj::local_got_offsets_): Likewise.
1927         (Sized_relobj::section_offsets_): Likewise.
1928         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1929         references.
1930         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1931         class.
1932         (Sized_relobj_file::sized_relobj): New function
1933         (Sized_relobj_file::local_has_got_offset): Move to base class.
1934         (Sized_relobj_file::local_got_offset): Likewise.
1935         (Sized_relobj_file::set_local_got_offset): Likewise.
1936         (Sized_relobj_file::get_output_section_offset): Likewise.
1937         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1938         (Sized_relobj_file::do_output_section_offset): Likewise.
1939         (Sized_relobj_file::do_set_section_offset): Likewise.
1940         (Sized_relobj_file::Local_got_offsets): Likewise.
1941         (Sized_relobj_file::local_got_offsets_): Likewise.
1942         (Sized_relobj_file::section_offsets_): Likewise.
1943         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1944         (all constructors).
1945         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1946         (Output_reloc::get_symbol_index): Likewise.
1947         (Output_reloc::local_section_offset): Likewise.
1948         (Output_reloc::get_address): Likewise.
1949         (Output_reloc::symbol_value): Likewise.
1950         (Output_data_got::reserve_slot): Move to class definition.
1951         (Output_data_got::reserve_local): New function.
1952         (Output_data_got::reserve_slot_for_global): Remove.
1953         (Output_data_got::reserve_global): New function.
1954         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1955         (all constructors, two instantiations).
1956         (Output_reloc::get_relobj): New function (two instantiations).
1957         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1958         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1959         (Output_data_reloc::add_global): Adjust type of relobj.
1960         (Output_data_reloc::add_global_relative): Likewise.
1961         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1962         (Output_data_reloc::add_local): Likewise.
1963         (Output_data_reloc::add_local_relative): Likewise.
1964         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1965         (Output_data_reloc::add_local_section): Likewise.
1966         (Output_data_reloc::add_output_section): Likewise.
1967         (Output_data_reloc::add_absolute): Likewise.
1968         (Output_data_reloc::add_target_specific): Likewise.
1969         (Output_data_got::reserve_slot): Move definition here.
1970         (Output_data_got::reserve_local): New function.
1971         (Output_data_got::reserve_global): New function.
1972         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1973         section_offsets_ with accessor function.
1974         (Sized_relobj_file::write_sections): Likewise.
1975         (Sized_relobj_file::do_relocate_sections): Likewise.
1976         * target.h (Sized_target::reserve_local_got_entry): New function.
1977         (Sized_target::reserve_global_got_entry): New function.
1978         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1979         (Target_x86_64::reserve_global_got_entry): New function.
1980         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1981
1982 2011-05-23 Cary Coutant  <ccoutant@google.com>
1983
1984         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1985         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1986         bit when checking got_type.
1987         * incremental.cc (Sized_incremental_binary::setup_readers):
1988         Store symbol table and string table locations; initialize bit vector
1989         of file status flags.
1990         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1991         unchanged files.
1992         (Sized_incremental_binary::do_process_got_plt): New function.
1993         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1994         (Output_section_incremental_inputs::set_final_data_size): Record
1995         file index for each input file.
1996         (Output_section_incremental_inputs::write_got_plt): Store file index
1997         instead of input entry offset for each GOT entry.
1998         * incremental.h
1999         (Incremental_input_entry::Incremental_input_entry): Initialize new
2000         data member.
2001         (Incremental_input_entry::set_offset): Store file index.
2002         (Incremental_input_entry::get_file_index): New function.
2003         (Incremental_input_entry::file_index_): New data member.
2004         (Incremental_binary::process_got_plt): New function.
2005         (Incremental_binary::do_process_got_plt): New function.
2006         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2007         data members.
2008         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2009         (Sized_incremental_binary::set_file_is_unchanged): New function.
2010         (Sized_incremental_binary::file_is_unchanged): New function.
2011         (Sized_incremental_binary::do_process_got_plt): New function.
2012         (Sized_incremental_binary::file_status_): New data member.
2013         (Sized_incremental_binary::main_symtab_loc_): New data member.
2014         (Sized_incremental_binary::main_strtab_loc_): New data member.
2015         * output.cc (Output_data_got::Got_entry::write): Add case
2016         RESERVED_CODE.
2017         (Output_data_got::add_global): Call add_got_entry.
2018         (Output_data_got::add_global_plt): Likewise.
2019         (Output_data_got::add_global_with_rel): Likewise.
2020         (Output_data_got::add_global_with_rela): Likewise.
2021         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2022         (Output_data_got::add_global_pair_with_rela): Likewise.
2023         (Output_data_got::add_local): Call add_got_entry.
2024         (Output_data_got::add_local_plt): Likewise.
2025         (Output_data_got::add_local_with_rel): Likewise.
2026         (Output_data_got::add_local_with_rela): Likewise.
2027         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2028         (Output_data_got::add_local_pair_with_rela): Likewise.
2029         (Output_data_got::reserve_slot): New function.
2030         (Output_data_got::reserve_slot_for_global): New function.
2031         (Output_data_got::add_got_entry): New function.
2032         (Output_data_got::add_got_entry_pair): New function.
2033         (Output_section::add_output_section_data): Edit FIXME.
2034         * output.h
2035         (Output_section_data_build::Output_section_data_build): New
2036         constructor with size parameter.
2037         (Output_data_space::Output_data_space): Likewise.
2038         (Output_data_got::Output_data_got): Initialize new data member; new
2039         constructor with size parameter.
2040         (Output_data_got::add_constant): Call add_got_entry.
2041         (Output_data_got::reserve_slot): New function.
2042         (Output_data_got::reserve_slot_for_global): New function.
2043         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2044         (Output_data_got::add_got_entry): New function.
2045         (Output_data_got::add_got_entry_pair): New function.
2046         (Output_data_got::free_list_): New data member.
2047         * target.h (Sized_target::init_got_plt_for_update): New function.
2048         (Sized_target::register_global_plt_entry): New function.
2049         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2050         Initialize new data member; call init; add constructor with PLT count.
2051         (Output_data_plt_x86_64::init): New function.
2052         (Output_data_plt_x86_64::add_relocation): New function.
2053         (Output_data_plt_x86_64::reserve_slot): New function.
2054         (Output_data_plt_x86_64::free_list_): New data member.
2055         (Target_x86_64::init_got_plt_for_update): New function.
2056         (Target_x86_64::register_global_plt_entry): New function.
2057         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2058         incremental updates.
2059         (Output_data_plt_x86_64::add_relocation): New function.
2060         * testsuite/object_unittest.cc (Object_test): Set default options.
2061
2062 2011-05-16  Ian Lance Taylor  <iant@google.com>
2063
2064         * options.h (class General_options): Make -i a synonym for -r.
2065
2066 2011-05-16  Ian Lance Taylor  <iant@google.com>
2067
2068         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2069
2070 2011-05-10 Cary Coutant  <ccoutant@google.com>
2071
2072         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2073         strip_all (-s).
2074
2075 2011-05-06  Ian Lance Taylor  <iant@google.com>
2076
2077         * layout.cc (Layout::layout): If the output section flags change,
2078         update the ordering.
2079
2080 2011-04-25 Cary Coutant  <ccoutant@google.com>
2081
2082         * incremental-dump.cc (dump_incremental_inputs): Print local
2083         symbol info for each input file.
2084         * incremental.cc
2085         (Output_section_incremental_inputs::set_final_data_size): Add local
2086         symbol info to input file entries in incremental info.
2087         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2088         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2089         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2090         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2091         implementation.
2092         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2093         (Sized_incr_relobj::do_relocate): Write the local symbols.
2094         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2095         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2096         Adjust size of input file header.
2097         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2098         (Incremental_inputs_reader::get_local_symbol_count): New function.
2099         (Incremental_inputs_reader::get_input_section): Adjust size of input
2100         file header.
2101         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2102         (Sized_incr_relobj::This): New typedef.
2103         (Sized_incr_relobj::sym_size): New const data member.
2104         (Sized_incr_relobj::Local_symbol): New struct.
2105         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2106         (Sized_incr_relobj::do_local_symbol_offset): New function.
2107         (Sized_incr_relobj::local_symbol_count_): New data member.
2108         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2109         (Sized_incr_relobj::local_symbol_index_): New data member.
2110         (Sized_incr_relobj::local_symbol_offset_): New data member.
2111         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2112         (Sized_incr_relobj::local_symbols_): New data member.
2113         * object.h (Relobj::output_local_symbol_count): New function.
2114         (Relobj::local_symbol_offset): New function.
2115         (Relobj::do_output_local_symbol_count): New function.
2116         (Relobj::do_local_symbol_offset): New function.
2117         (Sized_relobj::do_output_local_symbol_count): New function.
2118         (Sized_relobj::do_local_symbol_offset): New function.
2119
2120 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2121
2122         * descriptors.cc (set_close_on_exec): New function.
2123         (Descriptors::open): Use set_close_on_exec.
2124         * output.cc (S_ISLNK): Define if not defined.
2125
2126 2011-04-22 Cary Coutant  <ccoutant@google.com>
2127
2128         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2129         global symbol map.
2130         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2131         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2132         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2133         relocations.
2134         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2135         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2136         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2137         * incremental.h
2138         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2139         function.
2140         (Incremental_binary::apply_incremental_relocs): New function.
2141         (Incremental_binary::do_apply_incremental_relocs): New function.
2142         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2143         data member.
2144         (Sized_incremental_binary::add_global_symbol): New function.
2145         (Sized_incremental_binary::global_symbol): New function.
2146         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2147         (Sized_incremental_binary::symbol_map_): New data member.
2148         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2149         * target.h (Sized_target::apply_relocation): New function.
2150         * target-reloc.h (apply_relocation): New function.
2151         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2152
2153 2011-04-22  Doug Kwan  <dougkwan@google.com>
2154
2155         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2156         flag of a SHT_ARM_EXIDX section.
2157         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2158         * testsuite/Makefile.in: Regenerate.
2159         * testsuite/arm_exidx_test.s: New file.
2160         * testsuite/arm_exidx_test.sh: Same.
2161
2162 2011-04-20 Cary Coutant  <ccoutant@google.com>
2163
2164         PR gold/12689
2165         * archive.h (Incremental_archive_entry::Archive_member):
2166         Initialize arg_serial_ (second constructor).
2167
2168 2011-04-17  Ian Lance Taylor  <iant@google.com>
2169
2170         * object.cc (Relocate_info::location): Simplify location string.
2171         * errors.cc (Errors::error_at_location): Don't print program
2172         name.
2173         (Errors::warning_at_location): Likewise.
2174         (Errors::undefined_symbol): Likewise.
2175         * testsuite/debug_msg.sh: Update accordingly.
2176
2177 2011-04-14 Cary Coutant  <ccoutant@google.com>
2178
2179         * gold/layout.cc (Layout::symtab_section_offset): New function.
2180         * gold/layout.h (Layout::symtab_section_offset): New function.
2181         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2182
2183 2011-04-12  Ian Lance Taylor  <iant@google.com>
2184
2185         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2186         with MREMAP_MAYMOVE.
2187         * output.h (class Output_file): Add map_is_allocated_ field.
2188         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2189         not available, provide stubs.  If mremap is not available, #define
2190         it to gold_mremap.
2191         (MREMAP_MAYMOVE): Define if not defined.
2192         (Output_file::Output_file): Initialize map_is_allocated_.
2193         (Output_file::resize): Check map_is_allocated_.
2194         (Output_file::map_anonymous): If mmap fails, use malloc.
2195         (Output_file::unmap): Don't do anything for an anonymous map.
2196         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2197         is not available, provide stubs.
2198         (File_read::View::~View): Use free rather than delete[].
2199         (File_read::make_view): Use malloc rather than new[].  If mmap
2200         fails, use malloc.
2201         (File_read::find_or_make_view): Use malloc rather than new[].
2202         * gold.h: Remove HAVE_REMAP code.
2203         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2204         exists.  Rename mremap to gold_mremap.  If mmap is not available
2205         don't do anything.
2206         * configure, config.in: Rebuild.
2207
2208 2011-04-11  Ian Lance Taylor  <iant@google.com>
2209
2210         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2211         initialize local variable v.
2212
2213 2011-04-11  Cary Coutant  <ccoutant@google.com>
2214
2215         * archive.cc (Archive::include_member): Adjust call to
2216         report_object.
2217         (Add_archive_symbols::run): Track argument serial numbers.
2218         (Lib_group::include_member): Likewise.
2219         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2220         * archive.h (Incremental_archive_entry::Archive_member):
2221         Initialize arg_serial_.
2222         (Archive_member::arg_serial_): New data member.
2223         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2224         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2225         incremental link.
2226         (Sized_dynobj::do_for_all_local_got_entries): New function.
2227         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2228         function.
2229         * fileread.cc (get_mtime): New function.
2230         * fileread.h (get_mtime): New function.
2231         * gold.cc (queue_initial_tasks): Check for incremental update.
2232         (process_incremental_input): New function.
2233         (queue_middle_tasks): Don't force valid target for incremental
2234         update.
2235         * incremental-dump.cc (find_input_containing_global): Adjust
2236         size of symbol info entry.
2237         (dump_incremental_inputs): Dump argument serial number and
2238         in_system_directory flag; bias shndx by 1; print symbol names
2239         when dumping per-file symbol lists; use new symbol info readers.
2240         * incremental.cc
2241         (Output_section_incremental_inputs:update_data_size): New function.
2242         (Sized_incremental_binary::setup_readers): Setup input readers
2243         for each input file; build maps for files added from libraries
2244         and scripts.
2245         (Sized_incremental_binary::check_input_args): New function.
2246         (Sized_incremental_binary::do_check_inputs): Build map of argument
2247         serial numbers to input arguments.
2248         (Sized_incremental_binary::do_file_has_changed): Rename
2249         do_file_is_unchanged to this; compare file modification times.
2250         (Sized_incremental_binary::do_init_layout): New function.
2251         (Sized_incremental_binary::do_reserve_layout): New function.
2252         (Sized_incremental_binary::do_get_input_reader): Remove.
2253         (Sized_incremental_binary::get_symtab_view): New function.
2254         (Incremental_checker::can_incrementally_link_output_file): Remove.
2255         (Incremental_inputs::report_command_line): Exclude --debug options.
2256         (Incremental_inputs::report_archive_begin): Add parameter; track
2257         argument serial numbers; don't put input file entry for archive
2258         before archive members.
2259         (Incremental_inputs::report_archive_end): Put input file entry
2260         for archive after archive members.
2261         (Incremental_inputs::report_object): Add parameter; track argument
2262         serial numbers and in_system_directory flag.
2263         (Incremental_inputs::report_script): Add parameter; track argument
2264         serial numbers.
2265         (Output_section_incremental_inputs::set_final_data_size): Adjust
2266         size of symbol info entry; check for forwarding symbols.
2267         (Output_section_incremental_inputs::write_input_files): Write
2268         in_system_directory flag and argument serial number.
2269         (Output_section_incremental_inputs::write_info_blocks): Map section
2270         indices between incremental info and original input file; store
2271         input section index for each symbol.
2272         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2273         change operator() to visit().
2274         (class Global_got_offset_visitor): Likewise.
2275         (class Global_symbol_visitor_got_plt):
2276         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2277         classes.
2278         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2279         (Sized_incr_relobj::do_read_symbols): New function.
2280         (Sized_incr_relobj::do_layout): New function.
2281         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2282         (Sized_incr_relobj::do_add_symbols): New function.
2283         (Sized_incr_relobj::do_should_include_member): New function.
2284         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2285         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2286         (Sized_incr_relobj::do_section_size): New function.
2287         (Sized_incr_relobj::do_section_name): New function.
2288         (Sized_incr_relobj::do_section_contents): New function.
2289         (Sized_incr_relobj::do_section_flags): New function.
2290         (Sized_incr_relobj::do_section_entsize): New function.
2291         (Sized_incr_relobj::do_section_address): New function.
2292         (Sized_incr_relobj::do_section_type): New function.
2293         (Sized_incr_relobj::do_section_link): New function.
2294         (Sized_incr_relobj::do_section_info): New function.
2295         (Sized_incr_relobj::do_section_addralign): New function.
2296         (Sized_incr_relobj::do_initialize_xindex): New function.
2297         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2298         (Sized_incr_relobj::do_read_relocs): New function.
2299         (Sized_incr_relobj::do_gc_process_relocs): New function.
2300         (Sized_incr_relobj::do_scan_relocs): New function.
2301         (Sized_incr_relobj::do_count_local_symbols): New function.
2302         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2303         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2304         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2305         (Sized_incr_relobj::do_relocate): New function.
2306         (Sized_incr_relobj::do_set_section_offset): New function.
2307         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2308         (Sized_incr_dynobj::do_read_symbols): New function.
2309         (Sized_incr_dynobj::do_layout): New function.
2310         (Sized_incr_dynobj::do_add_symbols): New function.
2311         (Sized_incr_dynobj::do_should_include_member): New function.
2312         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2313         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2314         (Sized_incr_dynobj::do_section_size): New function.
2315         (Sized_incr_dynobj::do_section_name): New function.
2316         (Sized_incr_dynobj::do_section_contents): New function.
2317         (Sized_incr_dynobj::do_section_flags): New function.
2318         (Sized_incr_dynobj::do_section_entsize): New function.
2319         (Sized_incr_dynobj::do_section_address): New function.
2320         (Sized_incr_dynobj::do_section_type): New function.
2321         (Sized_incr_dynobj::do_section_link): New function.
2322         (Sized_incr_dynobj::do_section_info): New function.
2323         (Sized_incr_dynobj::do_section_addralign): New function.
2324         (Sized_incr_dynobj::do_initialize_xindex): New function.
2325         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2326         (make_sized_incremental_object): New function.
2327         (Incremental_library::copy_unused_symbols): New function.
2328         (Incremental_library::do_for_all_unused_symbols): New function.
2329         * incremental.h (enum Incremental_input_flags): New type.
2330         (class Incremental_checker): Remove.
2331         (Incremental_input_entry::Incremental_input_entry): Add argument
2332         serial number.
2333         (Incremental_input_entry::arg_serial): New function.
2334         (Incremental_input_entry::set_is_in_system_directory): New function.
2335         (Incremental_input_entry::is_in_system_directory): New function.
2336         (Incremental_input_entry::arg_serial_): New data member.
2337         (Incremental_input_entry::is_in_system_directory_): New data member.
2338         (class Script_info): Move here from script.h.
2339         (Script_info::Script_info): Add filename parameter.
2340         (Script_info::filename): New function.
2341         (Script_info::filename_): New data member.
2342         (Incremental_script_entry::Incremental_script_entry): Add argument
2343         serial number.
2344         (Incremental_object_entry::Incremental_object_entry): Likewise.
2345         (Incremental_object_entry::add_input_section): Build list of input
2346         sections with map to original shndx.
2347         (Incremental_object_entry::get_input_section_index): New function.
2348         (Incremental_object_entry::shndx_): New data member.
2349         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2350         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2351         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2352         serial number.
2353         (Incremental_inputs::report_archive_begin): Likewise.
2354         (Incremental_inputs::report_object): Likewise.
2355         (Incremental_inputs::report_script): Likewise.
2356         (class Incremental_global_symbol_reader): New class.
2357         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2358         and store flags and input file type.
2359         (Incremental_input_entry_reader::arg_serial): New function.
2360         (Incremental_input_entry_reader::type): Extract type from flags.
2361         (Incremental_input_entry_reader::is_in_system_directory): New function.
2362         (Incremental_input_entry_reader::get_input_section_count): Call
2363         accessor function for type.
2364         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2365         function for type; adjust size of global symbol entry.
2366         (Incremental_input_entry_reader::get_global_symbol_count): Call
2367         accessor function for type.
2368         (Incremental_input_entry_reader::get_object_count): Likewise.
2369         (Incremental_input_entry_reader::get_object_offset): Likewise.
2370         (Incremental_input_entry_reader::get_member_count): Likewise.
2371         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2372         (Incremental_input_entry_reader::get_member_offset): Likewise.
2373         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2374         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2375         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2376         (Incremental_input_entry_reader::get_global_symbol_reader): New
2377         function.
2378         (Incremental_input_entry_reader::get_output_symbol_index): New
2379         function.
2380         (Incremental_input_entry_reader::type_): Remove.
2381         (Incremental_input_entry_reader::flags_): New data member.
2382         (Incremental_inputs_reader::input_file_offset): New function.
2383         (Incremental_inputs_reader::input_file_index): New function.
2384         (Incremental_inputs_reader::input_file): Call input_file_offset.
2385         (Incremental_inputs_reader::input_file_at_offset): New function.
2386         (Incremental_relocs_reader::get_r_type): Reformat.
2387         (Incremental_relocs_reader::get_r_shndx): Reformat.
2388         (Incremental_relocs_reader::get_r_offset): Reformat.
2389         (Incremental_relocs_reader::data): New function.
2390         (Incremental_binary::Incremental_binary): Initialize new data members.
2391         (Incremental_binary::check_inputs): Add cmdline parameter.
2392         (Incremental_binary::file_is_unchanged): Remove.
2393         (Input_reader::arg_serial): New function.
2394         (Input_reader::get_unused_symbol_count): New function.
2395         (Input_reader::get_unused_symbol): New function.
2396         (Input_reader::do_arg_serial): New function.
2397         (Input_reader::do_get_unused_symbol_count): New function.
2398         (Input_reader::do_get_unused_symbol): New function.
2399         (Incremental_binary::input_file_count): New function.
2400         (Incremental_binary::get_input_reader): Change signature to use
2401         index instead of filename.
2402         (Incremental_binary::file_has_changed): New function.
2403         (Incremental_binary::get_input_argument): New function.
2404         (Incremental_binary::get_library): New function.
2405         (Incremental_binary::get_script_info): New function.
2406         (Incremental_binary::init_layout): New function.
2407         (Incremental_binary::reserve_layout): New function.
2408         (Incremental_binary::output_file): New function.
2409         (Incremental_binary::do_check_inputs): New function.
2410         (Incremental_binary::do_file_is_unchanged): Remove.
2411         (Incremental_binary::do_file_has_changed): New function.
2412         (Incremental_binary::do_init_layout): New function.
2413         (Incremental_binary::do_reserve_layout): New function.
2414         (Incremental_binary::do_input_file_count): New function.
2415         (Incremental_binary::do_get_input_reader): Change signature.
2416         (Incremental_binary::input_args_map_): New data member.
2417         (Incremental_binary::library_map_): New data member.
2418         (Incremental_binary::script_map_): New data member.
2419         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2420         new data members.
2421         (Sized_incremental_binary::output_section): New function.
2422         (Sized_incremental_binary::inputs_reader): Add const.
2423         (Sized_incremental_binary::symtab_reader): Add const.
2424         (Sized_incremental_binary::relocs_reader): Add const.
2425         (Sized_incremental_binary::got_plt_reader): Add const.
2426         (Sized_incremental_binary::get_symtab_view): New function.
2427         (Sized_incremental_binary::Inputs_reader): New typedef.
2428         (Sized_incremental_binary::Input_entry_reader): New typedef.
2429         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2430         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2431         (Sized_incremental_binary::do_file_has_changed): New function.
2432         (Sized_incremental_binary::do_init_layout): New function.
2433         (Sized_incremental_binary::do_reserve_layout): New function.
2434         (Sized_input_reader::Inputs_reader): Remove.
2435         (Sized_input_reader::Input_entry_reader): Remove.
2436         (Sized_input_reader::do_arg_serial): New function.
2437         (Sized_input_reader::do_get_unused_symbol_count): New function.
2438         (Sized_input_reader::do_get_unused_symbol): New function.
2439         (Sized_incremental_binary::do_input_file_count): New function.
2440         (Sized_incremental_binary::do_get_input_reader): Change signature;
2441         use index instead of filename.
2442         (Sized_incremental_binary::section_map_): New data member.
2443         (Sized_incremental_binary::input_entry_readers_): New data member.
2444         (class Sized_incr_relobj): New class.
2445         (class Sized_incr_dynobj): New class.
2446         (make_sized_incremental_object): New function.
2447         (class Incremental_library): New class.
2448         * layout.cc (Free_list::num_lists): New static data member.
2449         (Free_list::num_nodes): New static data member.
2450         (Free_list::num_removes): New static data member.
2451         (Free_list::num_remove_visits): New static data member.
2452         (Free_list::num_allocates): New static data member.
2453         (Free_list::num_allocate_visits): New static data member.
2454         (Free_list::init): New function.
2455         (Free_list::remove): New function.
2456         (Free_list::allocate): New function.
2457         (Free_list::dump): New function.
2458         (Free_list::print_stats): New function.
2459         (Layout_task_runner::run): Resize output file for incremental updates.
2460         (Layout::Layout): Initialize new data members.
2461         (Layout::set_incremental_base): New function.
2462         (Layout::init_fixed_output_section): New function.
2463         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2464         incremental updates.
2465         (Layout::create_gold_note): Do not create gold note section for
2466         incremental updates.
2467         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2468         for incremental updates.
2469         (Layout::set_section_offsets): For incremental updates, allocate space
2470         from free list.
2471         (Layout::create_symtab_sections): Layout with offsets relative to
2472         start of section; for incremental updates, allocate space from free
2473         list.
2474         (Layout::create_shdrs): For incremental updates, allocate space from
2475         free list.
2476         (Layout::finish_dynamic_section): For incremental updates, do not
2477         check --as-needed (fixed in subsequent patch).
2478         * layout.h (class Free_list): New class.
2479         (Layout::set_incremental_base): New function.
2480         (Layout::incremental_base): New function.
2481         (Layout::init_fixed_output_section): New function.
2482         (Layout::allocate): New function.
2483         (Layout::incremental_base_): New data member.
2484         (Layout::free_list_): New data member.
2485         * main.cc (main): Print Free_list statistics.
2486         * object.cc (Relobj::finalize_incremental_relocs): Add
2487         clear_counts parameter; clear counts only when clear_counts is set.
2488         (Sized_relobj::Sized_relobj): Initialize new base class.
2489         (Sized_relobj::do_layout): Don't report special sections.
2490         (Sized_relobj::do_for_all_local_got_entries): New function.
2491         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2492         symtab_off to all symbol table offsets.
2493         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2494         * object.h (class Got_offset_list): Move to top of file.
2495         (Object::Object): Allow case where input_file == NULL.
2496         (Object::~Object): Likewise.
2497         (Object::input_file): Assert that input_file != NULL.
2498         (Object::lock): Allow case where input_file == NULL.
2499         (Object::unlock): Likewise.
2500         (Object::is_locked): Likewise.
2501         (Object::token): Likewise.
2502         (Object::release): Likewise.
2503         (Object::is_incremental): New function.
2504         (Object::get_mtime): New function.
2505         (Object::for_all_local_got_entries): New function.
2506         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2507         (Object::set_is_in_system_directory): New function.
2508         (Object::is_in_system_directory): New function.
2509         (Object::do_is_incremental): New function.
2510         (Object::do_get_mtime): New function.
2511         (Object::do_for_all_local_got_entries): New function.
2512         (Object::is_in_system_directory_): New data member.
2513         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2514         (class Sized_relobj_base): New class.
2515         (class Sized_relobj): Derive from Sized_relobj_base.
2516         (class Sized_relobj::Symbols): Redeclare from base class.
2517         (class Sized_relobj::local_got_offset_list): Remove.
2518         (class Sized_relobj::Output_sections): Redeclare from base class.
2519         (class Sized_relobj::do_for_all_local_got_entries): New function.
2520         (class Sized_relobj::write_local_symbols): Add offset parameter.
2521         (class Sized_relobj::local_symbol_offset_): Update comment.
2522         (class Sized_relobj::local_dynsym_offset_): Update comment.
2523         * options.cc (Input_arguments::add_file): Remove const.
2524         * options.h (Input_file_argument::Input_file_argument):
2525         Initialize arg_serial_ (all constructors).
2526         (Input_file_argument::set_arg_serial): New function.
2527         (Input_file_argument::arg_serial): New function.
2528         (Input_file_argument::arg_serial_): New data member.
2529         (Input_arguments::Input_arguments): Initialize file_count_.
2530         (Input_arguments::add_file): Remove const.
2531         (Input_arguments::number_of_input_files): New function.
2532         (Input_arguments::file_count_): New data member.
2533         (Command_line::number_of_input_files): Call
2534         Input_arguments::number_of_input_files.
2535         * output.cc (Output_segment_headers::Output_segment_headers):
2536         Set current size.
2537         (Output_section::Input_section::current_data_size): New function.
2538         (Output_section::Output_section): Initialize new data members.
2539         (Output_section::add_input_section): Don't do merge sections for
2540         an incremental link; allocate space from free list for an
2541         incremental update.
2542         (Output_section::add_output_section_data): Allocate space from
2543         free list for an incremental update.
2544         (Output_section::update_data_size): New function.
2545         (Output_section::set_fixed_layout): New function.
2546         (Output_section::reserve): New function.
2547         (Output_segment::set_section_addresses): Remove const.
2548         (Output_segment::set_section_list_addresses): Remove const; allocate
2549         space from free list for an incremental update.
2550         (Output_segment::set_offset): Adjust size of RELRO segment for an
2551         incremental update.
2552         * output.h (Output_data::current_data_size): Move here from
2553         child classes.
2554         (Output_data::pre_finalize_data_size): New function.
2555         (Output_data::update_data_size): New function.
2556         (Output_section_headers::update_data_size): new function.
2557         (Output_section_data_build::current_data_size): Move to Output_data.
2558         (Output_data_strtab::update_data_size): New function.
2559         (Output_section::current_data_size): Move to Output_data.
2560         (Output_section::set_fixed_layout): New function.
2561         (Output_section::has_fixed_layout): New function.
2562         (Output_section::reserve): New function.
2563         (Output_section::update_data_size): New function.
2564         (Output_section::has_fixed_layout_): New data member.
2565         (Output_section::free_list_): New data member.
2566         (Output_segment::set_section_addresses): Remove const.
2567         (Output_segment::set_section_list_addresses): Remove const.
2568         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2569         New function.
2570         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2571         New function.
2572         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2573         parameter when calling Add_symbols constructor; store argument
2574         serial number for members of a lib group.
2575         (Add_symbols::locks): Allow case where token == NULL.
2576         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2577         (Read_member::~Read_member): New function.
2578         (Read_member::is_runnable): New function.
2579         (Read_member::locks): New function.
2580         (Read_member::run): New function.
2581         (Check_script::~Check_script): New function.
2582         (Check_script::is_runnable): New function.
2583         (Check_script::locks): New function.
2584         (Check_script::run): New function.
2585         (Check_library::~Check_library): New function.
2586         (Check_library::is_runnable): New function.
2587         (Check_library::locks): New function.
2588         (Check_library::run): New function.
2589         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2590         (Add_symbols::library_): New data member.
2591         (class Read_member): New class.
2592         (class Check_script): New class.
2593         (class Check_library): New class.
2594         * reloc.cc (Read_relocs::is_runnable): Allow case where
2595         token == NULL.
2596         (Read_relocs::locks): Likewise.
2597         (Scan_relocs::locks): Likewise.
2598         (Relocate_task::locks): Likewise.
2599         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2600         to clear counters.
2601         (Sized_relobj::incremental_relocs_scan): Fix comment.
2602         (Sized_relobj::do_relocate): Pass output file offset to
2603         write_local_symbols.
2604         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2605         from class declaration.
2606         * script.cc (read_input_script): Allocate Script_info; pass
2607         argument serial number to report_script.
2608         * script.h (class Script_info): Move to incremental.h.
2609         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2610         * symtab.h (Symbol_table::add_from_incrobj): New function.
2611         (Symbol_table::set_file_offset): New function.
2612
2613 2011-04-05  Cary Coutant  <ccoutant@google.com>
2614
2615         * incremental-dump.cc (dump_incremental_inputs): Change signature
2616         to take a Sized_incremental_binary; change caller.  Use readers
2617         in Sized_incremental_binary.
2618         * incremental.cc
2619         (Sized_incremental_binary::find_incremental_inputs_sections):
2620         Rename do_find_incremental_inputs_sections to this.
2621         (Sized_incremental_binary::setup_readers): New function.
2622         (Sized_incremental_binary::do_check_inputs): Check
2623         has_incremental_info_ flag; move setup code to setup_readers;
2624         use input readers.
2625         (Sized_incremental_binary::do_file_is_unchanged): New function.
2626         (Sized_incremental_binary::do_get_input_reader): New function.
2627         * incremental.h (class Incremental_binary): Move to end of file.
2628         (Incremental_binary::file_is_unchanged): New function.
2629         (Incremental_binary::do_file_is_unchanged): New function.
2630         (Incremental_binary::Input_reader): New class.
2631         (Incremental_binary::get_input_reader): New function.
2632         (class Sized_incremental_binary): Move to end of file.
2633         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2634         input section reader classes.
2635         (Sized_incremental_binary::has_incremental_info): New function.
2636         (Sized_incremental_binary::inputs_reader): New function.
2637         (Sized_incremental_binary::symtab_reader): New function.
2638         (Sized_incremental_binary::relocs_reader): New function.
2639         (Sized_incremental_binary::got_plt_reader): New function.
2640         (Sized_incremental_binary::do_file_is_unchanged): New function.
2641         (Sized_incremental_binary::Sized_input_reader): New class.
2642         (Sized_incremental_binary::get_input_reader): New function.
2643         (Sized_incremental_binary::find_incremental_inputs_sections):
2644         Rename do_find_incremental_inputs_sections to this.
2645         (Sized_incremental_binary::setup_readers): New function.
2646         (Sized_incremental_binary::has_incremental_info_): New data member.
2647         (Sized_incremental_binary::inputs_reader_): New data member.
2648         (Sized_incremental_binary::symtab_reader_): New data member.
2649         (Sized_incremental_binary::relocs_reader_): New data member.
2650         (Sized_incremental_binary::got_plt_reader_): New data member.
2651         (Sized_incremental_binary::current_input_file_): New data member.
2652
2653 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2654
2655         PR gold/12640
2656         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2657         violation.
2658
2659 2011-03-30  Cary Coutant  <ccoutant@google.com>
2660
2661         * archive.cc (Archive::include_member): Adjust call to report_object.
2662         (Add_archive_symbols::run): Add script_info to call to
2663         report_archive_begin.
2664         (Lib_group::include_member): Adjust call to report_object.
2665         (Add_lib_group_symbols::run): Adjust call to report_object.
2666         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2667         blocks.  Add object count for script input files.
2668         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2669         script_info parameter; change all callers.
2670         (Incremental_inputs::report_object): Add script_info parameter;
2671         change all callers.
2672         (Incremental_inputs::report_script): Store backpointer to
2673         incremental info entry.
2674         (Output_section_incremental_inputs::set_final_data_size): Record
2675         additional information for scripts.
2676         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2677         * incremental.h (Incremental_script_entry::add_object): New function.
2678         (Incremental_script_entry::get_object_count): New function.
2679         (Incremental_script_entry::get_object): New function.
2680         (Incremental_script_entry::objects_): New data member; adjust
2681         constructor.
2682         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2683         (Incremental_inputs::report_object): Add script_info parameter.
2684         (Incremental_inputs_reader::get_object_count): New function.
2685         (Incremental_inputs_reader::get_object_offset): New function.
2686         * options.cc (Input_arguments::add_file): Return reference to
2687         new input argument.
2688         * options.h (Input_argument::set_script_info): New function.
2689         (Input_argument::script_info): New function.
2690         (Input_argument::script_info_): New data member; adjust all
2691         constructors.
2692         (Input_file_group::add_file): Return reference to new input argument.
2693         (Input_file_lib::add_file): Likewise.
2694         (Input_arguments::add_file): Likewise.
2695         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2696         * script.cc (Parser_closure::Parser_closure): Add script_info
2697         parameter; adjust all callers.
2698         (Parser_closure::script_info): New function.
2699         (Parser_closure::script_info_): New data member.
2700         (read_input_script): Report scripts earlier to incremental info.
2701         (script_add_file): Set script_info in Input_argument.
2702         (script_add_library): Likewise.
2703         * script.h (Script_options::Script_info): Rewrite class.
2704
2705 2011-03-29  Cary Coutant  <ccoutant@google.com>
2706
2707         * archive.cc (Library_base::should_include_member): Move
2708         method here from class Archive.
2709         (Archive::Archive): Initialize base class.
2710         (Archive::should_include_member): Move to base class.
2711         (Archive::do_for_all_unused_symbols): New function.
2712         (Add_archive_symbols::run): Remove redundant access to
2713         incremental_inputs.
2714         (Lib_group::Lib_group): Initialize base class.
2715         (Lib_group::do_filename): New function.
2716         (Lib_group::include_member): Pass pointer to Lib_group to
2717         report_object.
2718         (Lib_group::do_for_all_unused_symbols): New function.
2719         (Add_lib_group_symbols::run): Report archive information for
2720         incremental links.
2721         * archive.h (class Library_base): New base class.
2722         (class Archive): Derive from Library_base.
2723         (Archive::filename): Move to base class.
2724         (Archive::set_incremental_info): Likewise.
2725         (Archive::incremental_info): Likewise.
2726         (Archive::Should_include): Likewise.
2727         (Archive::should_include_member): Likewise.
2728         (Archive::Armap_entry): Remove.
2729         (Archive::Unused_symbol_iterator): Remove.
2730         (Archive::unused_symbols_begin): Remove.
2731         (Archive::unused_symbols_end): Remove.
2732         (Archive::do_filename): New function.
2733         (Archive::do_get_mtime): New function.
2734         (Archive::do_for_all_unused_symbols): New function.
2735         (Archive::task_): Move to base class.
2736         (Archive::incremental_info_): Likewise.
2737         (class Lib_group): Derive from Library_base.
2738         (Lib_group::do_filename): New function.
2739         (Lib_group::do_get_mtime): New function.
2740         (Lib_group::do_for_all_unused_symbols): New function.
2741         (Lib_group::task_): Move to base class.
2742         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2743         function.
2744         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2745         function.
2746         * incremental.cc (Incremental_inputs::report_archive_begin):
2747         Use Library_base; call library's get_mtime; add incremental inputs
2748         entry before members.
2749         (class Unused_symbol_visitor): New class.
2750         (Incremental_inputs::report_archive_end): Use Library_base; use
2751         visitor class to record unused symbols; don't add incremental inputs
2752         entry after members.
2753         (Incremental_inputs::report_object): Use Library_base.
2754         * incremental.h
2755         (Incremental_archive_entry::Incremental_archive_entry): Remove
2756         unused Archive parameter.
2757         (Incremental_inputs::report_archive_begin): Use Library_base.
2758         (Incremental_inputs::report_archive_end): Likewise.
2759         (Incremental_inputs::report_object): Likewise.
2760         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2761         function.
2762         * object.h (Object::for_all_global_symbols): New function.
2763         (Object::do_for_all_global_symbols): New function.
2764         (Sized_relobj::do_for_all_global_symbols): New function.
2765         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2766         function.
2767         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2768         function.
2769
2770 2011-03-27  Ian Lance Taylor  <iant@google.com>
2771
2772         * archive.cc (Archive::interpret_header): Return -1 if something
2773         goes wrong.  Change callers accordingly.
2774
2775 2011-03-25  Cary Coutant  <ccoutant@google.com>
2776
2777         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2778         * testsuite/Makefile.in: Regenerate.
2779
2780 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2781
2782         * plugin.cc (get_view): New.
2783         (Plugin::load): Pass get_view to the plugin.
2784         (Plugin_manager::get_view): New.
2785
2786 2011-03-21  Ian Lance Taylor  <iant@google.com>
2787
2788         * testsuite/final_layout.sh: Rewrite to not use dc.
2789         * testsuite/relro_test.sh: Fail if dc is not present.
2790
2791 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2792
2793         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2794         Change == to -eq.
2795         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2796         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2797         Change == to -eq.
2798         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2799         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2800
2801 2011-03-14  Ian Lance Taylor  <iant@google.com>
2802
2803         * script-sections.cc (Sort_output_sections::script_compare):
2804         Rename from is_before, change return type.
2805         (Sort_output_sections::operator()): Adjust accordingly.
2806
2807 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2808
2809         PR gold/12572
2810         * testsuite/odr_violation2.cc: Add comment to make all error line
2811         numbers double digits.
2812         * testsuite/debug_msg.sh: Adjust expected errors.
2813
2814 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2815
2816         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2817         but mark earlier ones as non-canonical
2818         (offset_to_iterator): Update search target and example
2819         (do_addr2line): Return extra lines in a vector*
2820         (format_file_lineno): Extract from do_addr2line
2821         (one_addr2line): Add vector* out-param
2822         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2823         when a lineno entry appeared last for its instruction
2824         (Dwarf_line_info): Add vector* out-param
2825         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2826         * symtab.cc (Odr_violation_compare): Include the lineno in the
2827         comparison again.
2828         (linenos_from_loc): New. Combine the canonical line for an
2829         address with its other lines.
2830         (True_if_intersect): New. Helper functor to make
2831         std::set_intersection a query.
2832         (detect_odr_violations): Compare sets of lines instead of just
2833         one line for each function. This became less deterministic, but
2834         has fewer false positives.
2835         * symtab.h: Declarations.
2836         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2837         mix an optimized and non-optimized object in the same binary
2838         (odr_violation2.so): Same.
2839         * testsuite/Makefile.in: Regenerate from Makefile.am.
2840         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2841         * testsuite/debug_msg.sh: Update line numbers and add
2842         assertions.
2843         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2844         non-optimized context.
2845         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2846         isn't inlined, and use OdrDerived in an optimized context.
2847         * testsuite/odr_header1.h: Defines OdrDerived, where
2848         optimization will change the
2849         first-instruction-in-the-destructor's file and line number.
2850         * testsuite/odr_header2.h: Defines OdrBase.
2851
2852 2011-03-09  Ian Lance Taylor  <iant@google.com>
2853
2854         * fileread.cc (File_read::clear_views): Don't delete the whole
2855         file view.
2856
2857 2011-03-08  Ian Lance Taylor  <iant@google.com>
2858
2859         PR gold/12525
2860         * fileread.cc: #include <climits>.
2861         (GOLD_IOV_MAX): Define.
2862         (File_read::read_multiple): Limit number of entries by iov_max.
2863         * fileread.h (class File_read): Always set max_readv_entries to
2864         128.
2865
2866 2011-03-07  Ian Lance Taylor  <iant@google.com>
2867
2868         PR gold/12525
2869         * options.h (class General_options): Add -dy and -dn.
2870
2871 2011-03-02  Cary Coutant  <ccoutant@google.com>
2872
2873         * testsuite/script_test_9.t: Add TLS segment.
2874
2875 2011-03-02  Simon Baldwin  <simonb@google.com>
2876
2877         * configure.ac: Add check for gnu_indirect_function support in
2878         the toolchain building binutils.
2879         * configure: Rebuild.
2880
2881 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2882
2883         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2884         plugin only symbols.
2885         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2886         in plugin files as not needed in the symbol table.
2887
2888 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2889
2890         * output.cc (Output_section::add_input_section): Delay fill
2891         generation for section ordering.
2892
2893 2011-02-09  Ian Lance Taylor  <iant@google.com>
2894
2895         PR gold/12316
2896         * object.h (class Sized_relobj): Remove clear_local_symbols.
2897         * reloc.cc (Sized_relobj::do_relocate): Don't call
2898         clear_local_symbols.
2899
2900 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2901
2902         * plugin.cc (is_visible_from_outside): Return true for symbols
2903         in the -u option.
2904
2905 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2906
2907         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2908         filename.
2909
2910 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2911
2912         * icf.h (is_section_foldable_candidate): Change type of parameter
2913         to std::string.
2914         * icf.cc (Icf::find_identical_sections): Change type of local variable
2915         section_name to be std::string.
2916         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2917
2918 2011-01-25  Ian Lance Taylor  <iant@google.com>
2919
2920         * script.cc (script_add_extern): Rewrite to use
2921         add_symbol_reference.
2922
2923 2011-01-25  Doug Kwan  <dougkwan@google.com>
2924
2925         * icf.cc (get_section_contents): Always lock section's object.
2926
2927 2011-01-24  Ian Lance Taylor  <iant@google.com>
2928
2929         * options.h (class General_options): Accept
2930         --no-detect-odr-violations.
2931
2932 2011-01-24  Ian Lance Taylor  <iant@google.com>
2933
2934         * version.cc (version_string): Bump to 1.11.
2935
2936 2011-01-24  Ian Lance Taylor  <iant@google.com>
2937
2938         * plugin.cc (class Plugin_rescan): Define new class.
2939         (Plugin_manager::claim_file): Set any_claimed_.
2940         (Plugin_manager::save_archive): New function.
2941         (Plugin_manager::save_input_group): New function.
2942         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2943         necessary.
2944         (Plugin_manager::new_undefined_symbol): New function.
2945         (Plugin_manager::rescan): New function.
2946         (Plugin_manager::rescannable_defines): New function.
2947         (Plugin_manager::add_input_file): Set any_added_.
2948         * plugin.h (class Plugin_manager): define new fields rescannable_,
2949         undefined_symbols_, any_claimed_, and any_added_.  Declare
2950         Plugin_rescan as friend.  Declare new functions.
2951         (Plugin_manager::Rescannable): Define type.
2952         (Plugin_manager::Rescannable_list): Define type.
2953         (Plugin_manager::Undefined_symbol_list): Define type.
2954         (Plugin_manager::Plugin_manager): Initialize new fields.
2955         * archive.cc (Archive::defines_symbol): New function.
2956         (Add_archive_symbols::run): Pass archive to plugins if any.
2957         * archive.h (class Archive): Declare defines_symbol.
2958         * readsyms.cc (Input_group::~Input_group): New function.
2959         (Finish_group::run): Pass input_group to plugins if any.
2960         * readsyms.h (class Input_group): Declare destructor.
2961         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2962         any.
2963
2964 2011-01-10  Ian Lance Taylor  <iant@google.com>
2965
2966         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2967         section as relro.
2968         (Layout::set_segment_offsets): Reset increase_relro before calling
2969         set_section_addresses a second time.
2970
2971 2011-01-04  Cary Coutant  <ccoutant@google.com>
2972
2973         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2974         sections before NOBITS sections.
2975
2976 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2977
2978         * version.cc (print_version): Update copyright to 2011.
2979
2980 2010-12-23  Cary Coutant  <ccoutant@google.com>
2981
2982         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2983         of OS to this->add.  Add OD parameter to second form of the function.
2984
2985 2010-12-20  Ian Lance Taylor  <iant@google.com>
2986
2987         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2988         second of two consecutive entries with same offset.
2989
2990 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2991
2992         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2993         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2994         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2995         to avoid unneeded links against $(LDADD).
2996         * testsuite/Makefile.in: Regenerate.
2997
2998 2010-12-15  Ian Lance Taylor  <iant@google.com>
2999
3000         PR gold/12324
3001         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3002         for R_X86_64_32 and R_X86_64_PC32.
3003         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3004         ver_matching_def_pic.o.
3005         (ver_matching_def_pic.o): New target.
3006
3007 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3008
3009         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3010         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3011         Move definition before File_read::View member definitions.
3012         (File_read::View::~View): Initialize and hold lock before
3013         updating current_mapped_bytes.
3014
3015 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3016
3017         * dwarf_reader.cc: Remove outdated comment.
3018         * gold-threads.cc: Fix typo in error message.
3019         * archive.cc: Fix typos in comments.
3020         * archive.h: Likewise.
3021         * arm-reloc-property.cc: Likewise.
3022         * arm-reloc-property.h: Likewise.
3023         * arm-reloc.def: Likewise.
3024         * arm.cc: Likewise.
3025         * attributes.h: Likewise.
3026         * cref.cc: Likewise.
3027         * ehframe.cc: Likewise.
3028         * fileread.h: Likewise.
3029         * gold.h: Likewise.
3030         * i386.cc: Likewise.
3031         * icf.cc: Likewise.
3032         * incremental.h: Likewise.
3033         * int_encoding.cc: Likewise.
3034         * layout.h: Likewise.
3035         * main.cc: Likewise.
3036         * merge.h: Likewise.
3037         * object.cc: Likewise.
3038         * object.h: Likewise.
3039         * options.cc: Likewise.
3040         * readsyms.cc: Likewise.
3041         * reduced_debug_output.cc: Likewise.
3042         * reloc.cc: Likewise.
3043         * script-sections.cc: Likewise.
3044         * sparc.cc: Likewise.
3045         * symtab.h: Likewise.
3046         * target-reloc.h: Likewise.
3047         * target.cc: Likewise.
3048         * target.h: Likewise.
3049         * timer.cc: Likewise.
3050         * timer.h: Likewise.
3051         * x86_64.cc: Likewise.
3052
3053 2010-12-09  Cary Coutant  <ccoutant@google.com>
3054
3055         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3056         stack.
3057         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3058         parameter; change all callers.
3059         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3060         * options.h (warn_execstack): New option.
3061
3062 2010-12-07  Doug Kwan  <dougkwan@google.com>
3063
3064         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3065         like function call relocations.
3066
3067 2010-12-07  Ian Lance Taylor  <iant@google.com>
3068
3069         * archive.cc (Archive::get_elf_object_for_member): Permit
3070         punconfigured to be NULL.
3071         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3072         (Archive::include_member): Pass NULL to get_elf_object_for_member
3073         if we searched for the archive and this is the first included
3074         object.
3075
3076 2010-12-01  Ian Lance Taylor  <iant@google.com>
3077
3078         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3079         track_relocs_type_ field.
3080         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3081         Set track_relocs_type_.
3082         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3083         contents when using RELA relocs.
3084         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3085         reloc_map_.
3086         * reloc.cc (Track_relocs::next_addend): New function.
3087         * reloc.h (class Track_relocs): Declare next_addend.
3088
3089 2010-12-01  Ian Lance Taylor  <iant@google.com>
3090
3091         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3092         virtual destructor.
3093
3094 2010-12-01  Ian Lance Taylor  <iant@google.com>
3095
3096         * README: Update compilers known to work and fail.
3097
3098 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3099
3100         * configure.in: For --enable-gold, handle value `default' instead of
3101         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3102         not the default.
3103         * configure: Regenerate.
3104
3105 2010-11-18  Doug Kwan  <dougkwan@google.com>
3106
3107         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3108         and right_alignment to be zero.  Store result alignment only if it is
3109         greater than existing alignment.
3110
3111 2010-11-16  Cary Coutant  <ccoutant@google.com>
3112
3113         PR gold/12220
3114         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3115         Check for ".zdebug_line".
3116
3117 2010-11-16  Doug Kwan  <dougkwan@google.com>
3118             Cary Coutant  <ccoutant@google.com>
3119
3120         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3121         by reference; adjust all callers.
3122         * output.cc (Output_segment::set_section_addresses): Adjust references
3123         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3124         list is empty.
3125         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3126         end at page boundary.
3127
3128 2010-11-16  Cary Coutant  <ccoutant@google.com>
3129
3130         PR gold/12220
3131         * layout.cc (Layout::choose_output_section): Transform names of
3132         compressed sections even when using a script with a SECTIONS clause.
3133         (Layout::output_section_name): Remove code to transform
3134         compressed debug section names.
3135         * output.cc (Output_section::add_input_section): Use uncompressed
3136         section size when tracking input sections.
3137
3138 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3139
3140         * symtab.h (Symbol::NON_PIC_REF): Remove.
3141         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3142         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3143         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3144         (Symbol::use_plt_offset): Take a flags argument and pass it
3145         directly to needs_dynamic_reloc.  Restrict check for undefined
3146         weak symbols to function calls.
3147         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3148         (Target_arm::Scan::global): Use it.
3149         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3150         (Target_arm::Relocate::relocate): Likewise.
3151         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3152         parameter with an r_type parameter.  Use get_reference_flags
3153         to get the flags.
3154         (Target_arm::Relocate::relocate): Update accordingly.
3155         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3156         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3157         (Target_i386::Scan::global): Likewise.
3158         (Target_i386::Relocate::relocate): Likewise.
3159         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3160         parameter with an r_type parameter.  Use get_reference_flags
3161         to get the flags.
3162         (Target_i386::Relocate::relocate): Update accordingly.
3163         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3164         (Target_powerpc::Scan::global): Use it.
3165         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3166         (Target_powerpc::Relocate::relocate): Likewise.
3167         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3168         (Target_sparc::Scan::global): Use it.
3169         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3170         (Target_sparc::Relocate::relocate): Likewise.
3171         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3172         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3173         (Target_x86_64::Scan::global): Likewise.
3174         (Target_x86_64::Relocate::relocate): Likewise.
3175
3176 2010-11-08  Doug Kwan  <dougkwan@google.com>
3177             Cary Coutant  <ccoutant@google.com>
3178
3179         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3180         (Arm_exidx_merge_section::section_contents_): New data member.
3181         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3182         (Arm_input_section::~Arm_input_section): De-allocate memory.
3183         (Arm_input_section::original_contents_): New data member.       
3184         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3185         in parameters instead of calling Object::section_contents without
3186         locking.
3187         (Arm_output_section::group_section): New parameter TASK.  Pass it
3188         to callees that need locking objects.
3189         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3190         to lock EXIDX input sections.  Fix a formatting issue.  Call
3191         Arm_exidx_merged_section::build_contents to create merged section
3192         contents.
3193         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3194         to lock object of stub table owner.
3195         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3196         TEXT_SIZE to initialize data member TEXT_SIZE_.
3197         (Arm_exidx_input_section::addralign): Fix typo in comment.
3198         (Arm_exidx_input_section::text_size): New method.
3199         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3200         that require locking objects.  Lock objects before scanning for stubs
3201         and updating local symbols.
3202         (Arm_input_section<big_endian>::init): Copy contents of original
3203         input section.
3204         (Arm_input_section<big_endian>::do_write): Use saved contents of
3205         original input section instead of calling Object::section_contents
3206         without locking.
3207         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3208         size without calling Object::section_size().
3209         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3210         for size.  Allocate a buffer for merged EXIDX entries.
3211         (Arm_exidx_merged_section::build_contents): New method.
3212         (Arm_exidx_merged_section::do_write): Move merge section contents
3213         building code to Arm_exidx_merged_section::build_contetns.  Write
3214         out contetns in buffer instead of building it on the fly.
3215         (Arm_relobj::make_exidx_input_section): Also pass text section size
3216         to Arm_exidx_input_section constructor.
3217         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3218         (Arm_dynobj::do_read_symbols): Fix memory leak.
3219         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3220         * target.h: (class Task): Add forward declaration.
3221         (Target::relax): Add new parameter TASK and pass it to
3222         Target::do_relax().
3223         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3224
3225 2010-11-05  Cary Coutant  <ccoutant@google.com>
3226
3227         PR gold/10708
3228         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3229         object when reading from the file.
3230         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3231         second layout pass.
3232         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3233         when reading section contents.
3234         (get_section_contents): Likewise.
3235         (icf::find_identical_sections): Likewise.
3236         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3237         object when reading from the file.
3238         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3239         the object when doing deferred section layout.
3240
3241 2010-11-03  Nick Clifton  <nickc@redhat.com>
3242
3243         PR gold/12001
3244         * script.h (class Symbol_assignment: name): New member.  Returns
3245         the name of the symbol.
3246         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3247         Returns true if the given symbol name is on the list of
3248         assignments wating to be processed.
3249         * archive.cc (should_incldue_member): If the symbol is undefined,
3250         check to see if it is on the list of symbols pending assignment.
3251
3252 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3253
3254         * script-sections.cc (Script_sections::find_memory_region): Check
3255         for a NULL output section pointer.
3256
3257 2010-10-29  Doug Kwan  <dougkwan@google.com>
3258
3259         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3260         Output_section::add_relaxed_input_section.
3261         * output.cc (Output_section::add_relaxed_input_section): Add new
3262         arguments LAYOUT and NAME.  Set section order index.
3263         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3264         Copy section order index.
3265         * output.h (Output_section::add_relaxed_input_section): Add new
3266         arguments LAYOUT and NAME.
3267
3268 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3269
3270         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3271         NATIVE_OR_CROSS_LINKER.
3272         * testsuite/Makefile.in: Regenerate.
3273
3274 2010-10-20  Doug Kwan  <dougkwan@google.com>
3275
3276         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3277         without SHF_LINK_ORDER flags.
3278         * layout.cc (Layout::choose_output_section): Do not filter
3279         SHF_LINK_ORDER flag in a relocatable link.
3280
3281 2010-10-17  Cary Coutant  <ccoutant@google.com>
3282
3283         * output.h (Output_segment::set_section_addresses): Change function
3284         signature.  Update all callers.
3285         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3286         sections.
3287         (Output_segment::set_section_addresses): Align after last TLS
3288         section.  Add padding before last relro section instead of after.
3289
3290 2010-10-17  Doug Kwan  <dougkwan@google.com>
3291
3292         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3293         GOT output section to be writable.
3294
3295 2010-10-14  Cary Coutant  <ccoutant@google.com>
3296
3297         * debug.h (DEBUG_INCREMENTAL): New flag.
3298         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3299         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3300         mode.
3301         * incremental.cc (report_command_line): Ignore all forms of
3302         --incremental.
3303         * layout.cc (Layout::Layout): Check parameters for incremental link
3304         mode.
3305         * options.cc (General_options::parse_incremental): New function.
3306         (General_options::parse_no_incremental): New function.
3307         (General_options::parse_incremental_full): New function.
3308         (General_options::parse_incremental_update): New function.
3309         (General_options::incremental_mode_): New data member.
3310         (General_options::finalize): Check incremental_mode_.
3311         * options.h (General_options): Update help text for --incremental.
3312         Add --no-incremental, --incremental-full, --incremental-update.
3313         (General_options::Incremental_mode): New enum type.
3314         (General_options::incremental_mode): New function.
3315         (General_options::incremental_mode_): New data member.
3316         * parameters.cc (Parameters::incremental_mode_): New data member.
3317         (Parameters::set_options): Set incremental_mode_.
3318         (Parameters::set_incremental_full): New function.
3319         (Parameters::incremental): New function.
3320         (Parameters::incremental_update): New function.
3321         (set_parameters_incremental_full): New function.
3322         * parameters.h (Parameters::set_incremental_full): New function.
3323         (Parameters::incremental): New function.
3324         (Parameters::incremental_update): New function.
3325         (Parameters::incremental_mode_): New data member.
3326         (set_parameters_incremental_full): New function.
3327         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3328         incremental link mode.
3329         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3330         (Sized_relobj::do_relocate_sections): Likewise.
3331         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3332         option.
3333         * testsuite/Makefile.in: Regenerate.
3334         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3335
3336 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3337
3338         * script-sections.h (class Script_sections): Make
3339         Sections_elements typedef public.
3340         * script-sections.cc (class Sort_output_sections): Add elements_
3341         field.  Add constructor which sets it; change all callers.
3342         (Sort_output_sections::is_before): New function.
3343         (Sort_output_sections::operator()): Call is_before.
3344         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3345         conditional.
3346         * testsuite/script_test_10.sh: New test. Test script section
3347         order.
3348         * testsuite/script_test_10.t: Likewise.
3349         * testsuite/script_test_10.s: Likewise.
3350         * testsuite/Makefile.am: Wrap the cross linker tests and the
3351         common tests into NATIVE_OR_CROSS_LINKER.
3352         (check_SCRIPTS): Add script_test_10.sh.
3353         (check_DATA): Add script_test_10.stdout.
3354         (script_test_10.o, script_test_10): New targets.
3355         (script_test_10.stdout): New target.
3356         * configure, testsuite/Makefile.in: Regenerate.
3357
3358 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3359
3360         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3361         error for the deprecated relocations.
3362         (Target_arm::Scan::global): Likewise.
3363         (Target_arm::Relocate::relocate): Likewise.
3364
3365 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3366
3367         * fileread.cc (Input_file::find_file): Initialize *found_name
3368         and *namep when using the fallback search for case 4.
3369
3370 2010-10-11  Cary Coutant  <ccoutant@google.com>
3371
3372         * options.h (class General_options): Redefine -z lazy as an alias for
3373         the negation of -z now.
3374
3375 2010-10-11  Ian Lance Taylor  <iant@google.com>
3376
3377         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3378         binding.
3379
3380 2010-10-06  Nick Clifton  <nickc@redhat.com>
3381
3382         * script-sections.cc(class Memory_region): Remove
3383         current_lma_offset_ field.  Rename current_vma_offset_ to
3384         current_offset_.  Add last_section_ field.
3385         (Memory_region::get_current_vma_address): Rename to
3386         get_current_address.
3387         (Memory_region::get_current_lma_address): Delete.
3388         (Memory_region::increment_vma_offset): Rename to
3389         increment_offset.
3390         (Memory_region::increment_lma_offset): Delete.
3391         (Memory_region::attributes_compatible): New method.  Returns
3392         true if the provided section is compatible with the region.
3393         (Memory_region::get_last_section): New method.  Returns the last
3394         section to use the region.
3395         (Memory_region::set_last_section): New method.  Stores the last
3396         section to use the region.
3397         (Script_sections::block_in_region): New method.  Returns true if
3398         a block of memory is contained within a region.
3399         (Script_sections::find_memory_region): New method.  Locates a
3400         memory region to be used to set a VMA or LMA address.
3401         (Output_section_definition::set_section_addresses): Add code to
3402         check for addresses set by memory regions.
3403         (Output_segment::set_section_addresses): Remove memory region
3404         walking code.
3405         (Script_sections::create_segment): Add a warning if a header
3406         segment is created outside of any region.
3407         * script-sections.h (class Script_sections): Add prototypes for
3408         find_memory_region and block_in_region methods.
3409         * testsuite/memory_test.s: Use .long instead of .word.
3410         * testsuite/memory_test.t: Add some more output sections.
3411         * testsuite/memory_test.sh: Update expected output.
3412
3413 2010-10-02  Doug Kwan  <dougkwan@google.com>
3414
3415         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3416         defintion to symtab.h
3417         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3418         declaration to defintion.
3419
3420 2010-10-01  Nick Clifton  <nickc@redhat.com>
3421
3422         * expression.cc (eval): Replace dummy argument with NULL.
3423         (eval_maybe_dot): Check for a NULL result section pointer.
3424         (Symbol_expression::value): Likewise.
3425         (Dot_expression::value): Likewise.
3426         (BINARY_EXPRESSION): Likewise.
3427         (Max_expression::value): Likewise.
3428         (Min_expression::value): Likewise.
3429         (Absolute_expression::value): Likewise.
3430         (Addr_expression::value_from_output_section): Likewise.
3431         (Loaddddr_expression::value_from_output_section): Likewise.
3432         (Segment_start_expression::value): Likewise.
3433         * script-sections.cc
3434         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3435         argument with NULL.
3436         (Sections_elememt_dot_assignment::set_section_addresses):
3437         Likewise.
3438         (Output_data_expression::do_write_to_buffer): Likewise.
3439         (Output_section_definition::finalize_symbols): Likewise.
3440         (Output_section_definition::set_section_addresses): Likewise.
3441
3442 2010-09-30  Doug Kwan  <dougkwan@google.com>
3443
3444         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3445
3446 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3447
3448         * target.h (Target::can_icf_inline_merge_sections): New virtual
3449         function.
3450         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3451         virtual function.
3452         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3453         virtual function.
3454         * icf.cc (get_section_contents): Inline merge sections only when
3455         target allows it.
3456
3457 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3458
3459         * configure: Regenerate.
3460
3461 2010-09-17  Ian Lance Taylor  <iant@google.com>
3462
3463         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3464         * testsuite/Makefile.am (memory_test.o): New target.
3465         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3466         memory_test.t.
3467         * testsuite/Makefile.in: Rebuild.
3468
3469 2010-09-17  Doug Kwan  <dougkwan@google.com>
3470
3471         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3472         defintion if relocation uses GOT entries of the symbol.
3473         * testsuite/icf_safe_test.sh: Fix test.
3474         * testsuite/icf_safe_so_test.sh: Fix test.
3475
3476 2010-09-16  Cary Coutant  <ccoutant@google.com>
3477
3478         * script_sections.cc (class Memory_region): Remove "NULL" from
3479         vector initializations.
3480
3481 2010-09-15  Cary Coutant  <ccoutant@google.com>
3482
3483         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3484         Resolve forwarding symbols.
3485
3486 2010-09-15  Doug Kwan  <dougkwan@google.com>
3487
3488         * gold/testsuite/script_test_3.t: Add ARM special sections.
3489         * gold/testsuite/script_test_4.t: Same.
3490         * gold/testsuite/script_test_5.t: Same.
3491         * gold/testsuite/script_test_6.t: Same.
3492         * gold/testsuite/script_test_7.t: Same.
3493         * gold/testsuite/script_test_7.t: Same.
3494         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3495
3496 2010-09-14  Cary Coutant  <ccoutant@google.com>
3497
3498         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3499         (Target_x86_64::Relocate::relocate_tls): Replace check for
3500         saw_tls_block_reloc_ with test for executable section.
3501
3502 2010-09-12  Cary Coutant  <ccoutant@google.com>
3503
3504         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3505         position-independent executables to shared libraries need dynamic
3506         relocations.
3507         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3508         position-independent executables.
3509         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3510         * testsuite/Makefile.in: Regenerate.
3511
3512 2010-09-10  Nick Clifton  <nickc@redhat.com>
3513
3514         PR gold/11997
3515         * testsuite/memory_test.t: Discard any sections that are not
3516         needed.
3517
3518 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3519
3520         PR gold/11996
3521         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3522         "This::" to work around a bug in gcc 4.2.
3523
3524         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3525
3526 2010-09-09  Rafael Espindola  <espindola@google.com>
3527
3528         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3529         sections with different PF_X flags in the same segment.
3530         (Layout::find_first_load_seg): Search all segments to find the first
3531         one.
3532         * options.h (rosegment): New.
3533
3534 2010-09-08  Rafael Espindola  <espindola@google.com>
3535
3536         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3537
3538 2010-09-08  Doug Kwan  <dougkwan@google.com>
3539
3540         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3541         (Arm_relobj::do_relocate_sections): Add new parameter for output
3542         file to match the parent.
3543         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3544         of local symbols instead of input values.  Update code to track
3545         changes in gold::relocate_section.
3546         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3547         (Sized_relobj::compute_final_local_value_internal): New methods.
3548         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3549         body into private version of Sized_relobj::compute_final_local_value.
3550         Call the inline method.
3551         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3552         merged symbol value if there is one.
3553         (Symbol_value::has_output_value): New method defintiion.
3554         (Sized_relobj::Compute_final_local_value_status): New enum type.
3555         (Sized_relobj::compute_final_local_value): New methods.
3556         (Sized_relobj::compute_final_local_value_internal): New methods.
3557         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3558         and arm_cortex_a8.sh.
3559         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3560         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3561         New tests.
3562         * Makefile.in: Regenerate.
3563         * testsuite/arm_bl_out_of_range.s: Update test.
3564         * testsuite/thumb_bl_out_of_range.s: Ditto.
3565         * testsuite/thumb_blx_out_of_range.s: Ditto.
3566         * testsuite/arm_branch_out_of_range.sh: New file.
3567         * testsuite/arm_cortex_a8.sh: Ditto.
3568         * testsuite/arm_cortex_a8_b.s: Ditto.
3569         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3570         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3571         * testsuite/arm_cortex_a8_bl.s: Ditto.
3572         * testsuite/arm_cortex_a8_blx.s: Ditto.
3573         * testsuite/arm_cortex_a8_local.s: Ditto.
3574         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3575         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3576
3577 2010-09-08  Rafael Espindola  <espindola@google.com>
3578
3579         * Makefile.am (memory_test.stdout): Run readelf with -W.
3580         * Makefile.in: Regenerate.
3581         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3582         64 bit output.
3583
3584 2010-09-08  Rafael Espindola  <espindola@google.com>
3585
3586         * script-sections.cc (Script_sections::add_memory_region): Convert
3587         field precision to int.
3588         * script.cc (script_set_section_region, script_set_section_region):
3589         Convert field precision to int.
3590
3591 2010-09-08  Rafael Espindola  <espindola@google.com>
3592
3593         * arm.cc (do_finalize_sections): Create the __exidx_start and
3594         __exdix_end symbols even when the section is missing.
3595
3596 2010-09-08  Nick Clifton  <nickc@redhat.com>
3597
3598         * README: Remove claim that MEMORY is not supported.
3599         * expression.cc (script_exp_function_origin)
3600         (script_exp_function_length): Move from here to ...
3601         * script.cc: ... here.
3602         (script_set_section_region, script_add_memory)
3603         (script_parse_memory_attr, script_include_directive): New
3604         functions.
3605         * script-sections.cc
3606         (class Memory_region): New class.
3607         (class Output_section_definition): Add set_memory_region,
3608         set_section_vma, set_section_lma and get_section_name methods.
3609         (class Script_Sections): Add add_memory_region,
3610         find_memory_region, find_memory_region_origin,
3611         find_memory_region_length and set_memory_region methods.
3612         Have set_section_addresses method walk the list of set memory
3613         regions.
3614         Extend the print methos to display memory regions.
3615         * script-sections.h: Add prototypes for new methods.
3616         Add enum for MEMORY region attributes.
3617         * yyscript.y: Add support for parsing MEMORY regions.
3618         * script-c.h: Add prototypes for new functions.
3619         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3620         * testsuite/Makefile.in: Regenerate.
3621         * testsuite/memory_test.sh: New script.
3622         * testsuite/memory_test.s: New assembler source file.
3623         * testsuite/memory_test.t: New linker script.
3624
3625 2010-08-27  Doug Kwan  <dougkwan@google.com>
3626
3627         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3628         reference override an existing dynamic weak reference.
3629         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3630         * testsuite/Makefile.in: Regenerate.
3631         * testsuite/dyn_weak_ref.sh: New file.
3632         * testsuite/dyn_weak_ref_1.c: Ditto.
3633         * testsuite/dyn_weak_ref_2.c: Ditto.
3634
3635 2010-08-27  Ian Lance Taylor  <iant@google.com>
3636
3637         * incremental.h (class Incremental_input_entry): Add virtual
3638         destructor.
3639
3640 2010-08-27  Ian Lance Taylor  <iant@google.com>
3641
3642         * testsuite/start_lib_test_3.c: Mark t3 as used.
3643
3644 2010-08-27  Nick Clifton  <nickc@redhat.com>
3645
3646         * options.cc (version_script): Fix small typo in previous
3647         whitespace tidyup.
3648
3649 2010-08-25  Nick Clifton  <nickc@redhat.com>
3650
3651         * archive.cc: Formatting fixes: Remove whitespace between
3652         typename and following asterisk.  Remove whitespace between
3653         function name and opening parenthesis.
3654         * archive.h: Likewise.
3655         * arm.cc: Likewise.
3656         * attributes.cc: Likewise.
3657         * attributes.h: Likewise.
3658         * common.cc: Likewise.
3659         * copy-relocs.cc: Likewise.
3660         * dirsearch.h: Likewise.
3661         * dynobj.cc: Likewise.
3662         * ehframe.cc: Likewise.
3663         * ehframe.h: Likewise.
3664         * expression.cc: Likewise.
3665         * fileread.cc: Likewise.
3666         * fileread.h: Likewise.
3667         * gc.h: Likewise.
3668         * gold-threads.cc: Likewise.
3669         * gold.cc: Likewise.
3670         * i386.cc: Likewise.
3671         * icf.h: Likewise.
3672         * incremental-dump.cc: Likewise.
3673         * incremental.cc: Likewise.
3674         * layout.cc: Likewise.
3675         * layout.h: Likewise.
3676         * main.cc: Likewise.
3677         * merge.cc: Likewise.
3678         * merge.h: Likewise.
3679         * object.cc: Likewise.
3680         * object.h: Likewise.
3681         * options.cc: Likewise.
3682         * options.h: Likewise.
3683         * output.cc: Likewise.
3684         * output.h: Likewise.
3685         * plugin.cc: Likewise.
3686         * plugin.h: Likewise.
3687         * powerpc.cc: Likewise.
3688         * reloc.cc: Likewise.
3689         * script-c.h: Likewise.
3690         * script-sections.cc: Likewise.
3691         * script.cc: Likewise.
3692         * stringpool.cc: Likewise.
3693         * symtab.cc: Likewise.
3694         * symtab.h: Likewise.
3695         * target.cc: Likewise.
3696         * timer.cc: Likewise.
3697         * timer.h: Likewise.
3698         * version.cc: Likewise.
3699         * x86_64.cc: Likewise.
3700
3701 2010-08-24  Nick Clifton  <nickc@redhat.com>
3702
3703         PR 11899
3704         * layout.cc (segment_precedes): Sort segments by their physical
3705         addresses, if they have been set.
3706
3707 2010-08-23  Cary Coutant  <ccoutant@google.com>
3708
3709         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3710         symbols data.
3711         (Lib_group::include_member): Unlock object after deleting its
3712         symbols data.
3713         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3714         the bug fixed here.
3715
3716 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3717             Cary Coutant  <ccoutant@google.com>
3718
3719         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3720         constructor, and set_blocker.
3721         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3722         readsyms_blocker_.
3723         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3724         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3725         * testsuite/Makefile.am (start_lib_test): New test case.
3726         * testsuite/Makefile.in: Regenerate.
3727         * testsuite/start_lib_test_main.c: New file.
3728         * testsuite/start_lib_test_1.c: New file.
3729         * testsuite/start_lib_test_2.c: New file.
3730         * testsuite/start_lib_test_3.c: New file.
3731
3732 2010-08-19  Ian Lance Taylor  <iant@google.com>
3733
3734         * Makefile.in: Rebuild with automake 1.11.1.
3735         * aclocal.m4: Likewise.
3736         * testsuite/Makefile.in: Likewise.
3737
3738 2010-08-19  Ian Lance Taylor  <iant@google.com>
3739
3740         PR 10893
3741         * i386.cc (class Output_data_plt_i386): Update declarations.
3742         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3743         local_ifuncs_ fields.
3744         (Target_i386::do_plt_section_for_global): New function.
3745         (Target_i386::do_plt_section_for_local): New function.
3746         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3747         parameter; change all callers.  Initialize global_ifuncs_ and
3748         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3749         __rel_iplt_end.
3750         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3751         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3752         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3753         symbols.
3754         (Target_i386::make_plt_section): New function, broken out of
3755         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3756         (Target_i386::make_plt_entry): Call make_plt_section.
3757         (Target_i386::make_local_ifunc_plt_entry): New function.
3758         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3759         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3760         R_386_IRELATIVE to switch.
3761         (Target_i386::Scan::global): Likewise.
3762         (Target_i386::Relocate::relocate): Likewise.
3763         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3764         switch.
3765         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3766         (Target_x86_64::do_plt_section_for_global): New function.
3767         (Target_x86_64::do_plt_section_for_local): New function.
3768         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3769         parameter; change all callers.  If doing a static link define
3770         __rela_iplt_start and __rela_iplt_end.
3771         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3772         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3773         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3774         to point to .plt.
3775         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3776         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3777         switch.
3778         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3779         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3780         R_X86_64_IRELATIVE to switch.
3781         (Target_x86_64::Scan::global): Likewise.
3782         (Target_x86_64::Relocate::relocate): Likewise.
3783         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3784         switch.
3785         * target.h (class Target): Add plt_section_for_global and
3786         plt_section_for_local functions.  Add do_plt_section_for_global
3787         and do_plt_section_for_local virtual functions.
3788         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3789         clarifying comments.
3790         (Symbol::use_plt_offset): Handle IFUNC symbol.
3791         * object.cc (Sized_relobj::Sized_relobj): Initialize
3792         local_plt_offsets_.
3793         (Sized_relobj::local_has_plt_offset): New function.
3794         (Sized_relobj::local_plt_offset): New function.
3795         (Sized_relobj::set_local_plt_offset): New function.
3796         (Sized_relobj::do_count): Handle IFUNC symbol.
3797         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3798         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3799         is_ifunc_symbol functions.
3800         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3801         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3802         local_plt_offsets_ field.
3803         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3804         * output.h (class Output_section_data): Add non-const
3805         output_section function.
3806         (class Output_data_got): Update declarations.
3807         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3808         Add use_plt_offset parameter to global and local constructors.
3809         Change all callers.  Change local_sym_index_ field to 31 bits.
3810         Change GSYM_CODE and CONSTANT_CODE accordingly.
3811         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3812         doing a static link don't set sh_link field.
3813         (Output_data_got::Got_entry::write): Use PLT offset if
3814         appropriate.
3815         (Output_data_got::add_global_plt): New function.
3816         (Output_data_got::add_local_plt): New function.
3817         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3818         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3819         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3820         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3821         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3822         IFUNC conditional.
3823         * testsuite/ifunc-sel.h: New file.
3824         * testsuite/ifuncmain1.c: New file.
3825         * testsuite/ifuncmain1vis.c: New file.
3826         * testsuite/ifuncmod1.c: New file.
3827         * testsuite/ifuncdep2.c: New file.
3828         * testsuite/ifuncmain2.c: New file.
3829         * testsuite/ifuncmain3.c: New file.
3830         * testsuite/ifuncmod3.c: New file.
3831         * testsuite/ifuncmain4.c: New file.
3832         * testsuite/ifuncmain5.c: New file.
3833         * testsuite/ifuncmod5.c: New file.
3834         * testsuite/ifuncmain6pie.c: New file.
3835         * testsuite/ifuncmod6.c: New file.
3836         * testsuite/ifuncmain7.c: New file.
3837         * configure, testsuite/Makefile.in: Rebuild.
3838
3839 2010-08-18  Ian Lance Taylor  <iant@google.com>
3840
3841         * incremental.cc
3842         (Output_section_incremental_inputs::write_input_files): Add cast
3843         to avoid signed/unsigned comparison warning.
3844         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3845
3846 2010-08-12  Cary Coutant  <ccoutant@google.com>
3847
3848         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3849
3850 2010-08-13  Ian Lance Taylor  <iant@google.com>
3851
3852         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3853
3854 2010-08-12  Cary Coutant  <ccoutant@google.com>
3855             Doug Kwan  <dougkwan@google.com>
3856
3857         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3858         defintion overrides non-weak undef, remember that the original undef
3859         is not weak.
3860         * symtab.cc (Symbol_table::sized_write_global): For undef without
3861         an original weak binding, set binding to global in output.
3862         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3863         * testsuite/Makefile.in: Regenerate.
3864         * testsuite/strong_ref_weak_def.sh: New file.
3865         * testsuite/strong_ref_weak_def_1.c: Ditto.
3866         * testsuite/strong_ref_weak_def_2.c: Ditto.
3867
3868 2010-08-12  Cary Coutant  <ccoutant@google.com>
3869
3870         * testsuite/incremental_test.sh: Rewrite.
3871         * testsuite/incremental_test_1.c: Rewrite.
3872         * testsuite/incremental_test_2.c: Rewrite.
3873
3874 2010-08-12  Cary Coutant  <ccoutant@google.com>
3875
3876         * arm.cc (Target_arm::got_size): Add const.
3877         (Target_arm::got_entry_count): New function.
3878         (Target_arm::plt_entry_count): New function.
3879         (Target_arm::first_plt_entry_offset): New function.
3880         (Target_arm::plt_entry_size): New function.
3881         (Output_data_plt_arm::entry_count): New function.
3882         (Output_data_plt_arm::first_plt_entry_offset): New function.
3883         (Output_data_plt_arm::get_plt_entry_size): New function.
3884         * i386.cc (Target_i386::got_size): Add const.
3885         (Target_i386::got_entry_count): New function.
3886         (Target_i386::plt_entry_count): New function.
3887         (Target_i386::first_plt_entry_offset): New function.
3888         (Target_i386::plt_entry_size): New function.
3889         (Output_data_plt_i386::entry_count): New function.
3890         (Output_data_plt_i386::first_plt_entry_offset): New function.
3891         (Output_data_plt_i386::get_plt_entry_size): New function.
3892         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3893         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3894         * incremental.cc: Include target.h.
3895         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3896         parameter.  Adjust all callers.  Find incremental_got_plt section.
3897         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3898         section.
3899         (Output_section_incremental_inputs::set_final_data_size): Calculate
3900         size of incremental_got_plt section.
3901         (Output_section_incremental_inputs::do_write): Write the
3902         incremental_got_plt section.
3903         (Got_plt_view_info): New struct.
3904         (Local_got_offset_visitor): New class.
3905         (Global_got_offset_visitor): New class.
3906         (Global_symbol_visitor_got_plt): New class.
3907         (Output_section_incremental_inputs::write_got_plt): New function.
3908         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3909         Add parameter.  Adjust all callers.
3910         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3911         (Incremental_inputs::got_plt_section): New function.
3912         (Incremental_inputs::got_plt_section_): New data member.
3913         (Incremental_got_plt_reader): New class.
3914         * layout.cc (Layout::create_incremental_info_sections): Add the
3915         incremental_got_plt section.
3916         * object.h (Got_offset_list::get_list): New function.
3917         (Got offset_list::for_all_got_offsets): New function.
3918         (Sized_relobj::local_got_offset_list): New function.
3919         * powerpc.cc (Target_powerpc::got_size): Add const.
3920         (Target_powerpc::got_entry_count): New function.
3921         (Target_powerpc::plt_entry_count): New function.
3922         (Target_powerpc::first_plt_entry_offset): New function.
3923         (Target_powerpc::plt_entry_size): New function.
3924         (Output_data_plt_powerpc::entry_count): New function.
3925         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3926         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3927         * sparc.cc (Target_sparc::got_size): Add const.
3928         (Target_sparc::got_entry_count): New function.
3929         (Target_sparc::plt_entry_count): New function.
3930         (Target_sparc::first_plt_entry_offset): New function.
3931         (Target_sparc::plt_entry_size): New function.
3932         (Output_data_plt_sparc::entry_count): New function.
3933         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3934         (Output_data_plt_sparc::get_plt_entry_size): New function.
3935         * symtab.h (Symbol::got_offset_list): New function.
3936         (Symbol_table::for_all_symbols): New function.
3937         * target.h (Sized_target::got_entry_count): New function.
3938         (Sized_target::plt_entry_count): New function.
3939         (Sized_target::plt_entry_size): New function.
3940         * x86_64.cc (Target_x86_64::got_size): Add const.
3941         (Target_x86_64::got_entry_count): New function.
3942         (Target_x86_64::plt_entry_count): New function.
3943         (Target_x86_64::first_plt_entry_offset): New function.
3944         (Target_x86_64::plt_entry_size): New function.
3945         (Output_data_plt_x86_64::entry_count): New function.
3946         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3947         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3948
3949 2010-08-12  Cary Coutant  <ccoutant@google.com>
3950
3951         * archive.cc: Include incremental.h.
3952         (Archive::Archive): Initialize incremental_info_.
3953         (Archive::include_member): Record archive members in incremental info.
3954         (Add_archive_symbols::run): Record begin and end of an archive in
3955         incremental info.
3956         (Lib_group::include_member): Record objects in incremental info.
3957         * archive.h (Incremental_archive_entry): Forward declaration.
3958         (Archive::set_incremental_info): New member function.
3959         (Archive::incremental_info): New member function.
3960         (Archive::Unused_symbol_iterator): New class.
3961         (Archive::unused_symbols_begin): New member function.
3962         (Archive::unused_symbols_end): New member function.
3963         (Archive::incremental_info_): New data member.
3964         * incremental-dump.cc (find_input_containing_global): New function.
3965         (dump_incremental_inputs): Dump new incremental info sections.
3966         * incremental.cc: Include symtab.h.
3967         (Output_section_incremental_inputs): New class.
3968         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3969         new incremental info sections.
3970         (Sized_incremental_binary::do_check_inputs): Likewise.
3971         (Incremental_inputs::report_archive): Remove.
3972         (Incremental_inputs::report_archive_begin): New function.
3973         (Incremental_inputs::report_archive_end): New function.
3974         (Incremental_inputs::report_object): New function.
3975         (Incremental_inputs::finalize_inputs): Remove.
3976         (Incremental_inputs::report_input_section): New function.
3977         (Incremental_inputs::report_script): Rewrite.
3978         (Incremental_inputs::finalize): Do nothing but finalize string table.
3979         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3980         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3981         (Incremental_inputs::create_data_sections): New function.
3982         (Incremental_inputs::relocs_entsize): New function.
3983         (Output_section_incremental_inputs::set_final_data_size): New function.
3984         (Output_section_incremental_inputs::do_write): New function.
3985         (Output_section_incremental_inputs::write_header): New function.
3986         (Output_section_incremental_inputs::write_input_files): New function.
3987         (Output_section_incremental_inputs::write_info_blocks): New function.
3988         (Output_section_incremental_inputs::write_symtab): New function.
3989         * incremental.h (Incremental_script_entry): Forward declaration.
3990         (Incremental_object_entry): Forward declaration.
3991         (Incremental_archive_entry): Forward declaration.
3992         (Incremental_inputs): Forward declaration.
3993         (Incremental_inputs_header_data): Remove.
3994         (Incremental_inputs_header): Remove.
3995         (Incremental_inputs_header_write): Remove.
3996         (Incremental_inputs_entry_data): Remove.
3997         (Incremental_inputs_entry): Remove.
3998         (Incremental_inputs_entry_write): Remove.
3999         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4000         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4001         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4002         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4003         Likewise.
4004         (Incremental_input_entry): New class.
4005         (Incremental_script_entry): New class.
4006         (Incremental_object_entry): New class.
4007         (Incremental_archive_entry): New class.
4008         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4009         (Incremental_inputs::report_inputs): Remove.
4010         (Incremental_inputs::report_archive): Remove.
4011         (Incremental_inputs::report_archive_begin): New function.
4012         (Incremental_inputs::report_archive_end): New function.
4013         (Incremental_inputs::report_object): Change prototype.
4014         (Incremental_inputs::report_input_section): New function.
4015         (Incremental_inputs::report_script): Change prototype.
4016         (Incremental_inputs::get_reloc_count): New function.
4017         (Incremental_inputs::set_reloc_count): New function.
4018         (Incremental_inputs::create_data_sections): New function.
4019         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4020         (Incremental_inputs::inputs_section): New function.
4021         (Incremental_inputs::symtab_section): New function.
4022         (Incremental_inputs::relocs_section): New function.
4023         (Incremental_inputs::get_stringpool): Add const.
4024         (Incremental_inputs::command_line): Add const.
4025         (Incremental_inputs::inputs): Remove.
4026         (Incremental_inputs::command_line_key): New function.
4027         (Incremental_inputs::input_file_count): New function.
4028         (Incremental_inputs::input_files): New function.
4029         (Incremental_inputs::relocs_entsize): New function.
4030         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4031         (Incremental_inputs::finalize_inputs): Remove.
4032         (Incremental_inputs::Input_info): Remove.
4033         (Incremental_inputs::lock_): Remove.
4034         (Incremental_inputs::inputs_): Change type.
4035         (Incremental_inputs::inputs_map_): Remove.
4036         (Incremental_inputs::current_object_entry_): New data member.
4037         (Incremental_inputs::inputs_section_): New data member.
4038         (Incremental_inputs::symtab_section_): New data member.
4039         (Incremental_inputs::relocs_section_): New data member.
4040         (Incremental_inputs::reloc_count_): New data member.
4041         (Incremental_inputs_reader): New class.
4042         (Incremental_symtab_reader): New class.
4043         (Incremental_relocs_reader): New class.
4044         * layout.cc (Layout::finalize): Move finalization of incremental info
4045         and creation of incremental info sections to follow finalization of
4046         symbol table.  Set offsets for postprocessing sections.
4047         (Layout::create_incremental_info_sections): Call
4048         Incremental_inputs::create_data_sections.  Add incremental symtab
4049         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4050         sections to layout after input sections.
4051         * layout.h (struct Timespec): Forward declaration.
4052         (Layout::incremental_inputs): Add const.
4053         (Layout::create_incremental_info_sections): Add parameter.
4054         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4055         * object.cc: Include incremental.h.
4056         (Relobj::finalize_incremental_relocs): New function.
4057         (Sized_relobj::do_layout): Record input sections in incremental info.
4058         * object.h (Object::output_section): New function.
4059         (Object::output_section_offset): Moved from Relobj.
4060         (Object::get_incremental_reloc_base): New function.
4061         (Object::get_incremental_reloc_count): New function.
4062         (Object::do_output_section): New function.
4063         (Object::do_output_section_offset): Moved from Relobj.
4064         (Object::do_get_incremental_reloc_base): New function.
4065         (Object::do_get_incremental_reloc_count): New function.
4066         (Object::Object): Initialize new data members.
4067         (Relobj::output_section): Renamed do_output_section and moved to
4068         protected.
4069         (Relobj::output_section_offset): Moved to Object.
4070         (Relobj::do_get_incremental_reloc_base): New function.
4071         (Relobj::do_get_incremental_reloc_count): New function.
4072         (Relobj::allocate_incremental_reloc_counts): New function.
4073         (Relobj::count_incremental_reloc): New function.
4074         (Relobj::finalize_incremental_relocs): New function.
4075         (Relobj::next_incremental_reloc_index): New function.
4076         (Relobj::reloc_counts_): New data member.
4077         (Relobj::reloc_bases_): New data member.
4078         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4079         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4080         (Sized_relobj::incremental_relocs_scan): New function.
4081         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4082         (Sized_relobj::incremental_relocs_write): New function.
4083         (Sized_relobj::incremental_relocs_write_reltype): New function.
4084         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4085         incremental link.
4086         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4087         archives and object files elsewhere.
4088         (Add_symbols::run): Report object files here.
4089         (Finish_group::run): Report end of archive at end of group.
4090         * reloc.cc: Include layout.h, incremental.h.
4091         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4092         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4093         (Sized_relobj::incremental_relocs_scan): New function.
4094         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4095         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4096         (Sized_relobj::incremental_relocs_write): New function.
4097         (Sized_relobj::incremental_relocs_write_reltype): New function.
4098         * script.cc (read_input_script): Rewrite test for incremental link.
4099         Change call to Incremental_inputs::report_script.
4100         * symtab.h (Symbol_table::first_global_index): New function.
4101         (Symbol_table::output_count): New function.
4102
4103 2010-08-12  Doug Kwan  <dougkwan@google.com>
4104
4105         * arm.cc (Target_arm::merge_object_attributes): Check command line
4106         options --no-wchar-size-warning and --no-enum-size-warning.
4107         * options.h (General_options): Add ld-compatible options
4108         --no-enum-size-warning and --no-wchar-size-warning.
4109
4110 2010-08-04  Ian Lance Taylor  <iant@google.com>
4111
4112         * x86_64.cc (Target_x86_64::Scan::local): Use
4113         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4114         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4115         (Target_x86_64::Scan::global): Likewise.
4116         (Target_x86_64::Relocate::relocate): Likewise.
4117         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4118         Likewise.
4119
4120 2010-08-03  Cary Coutant  <ccoutant@google.com>
4121
4122         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4123         to reserve space in merged_strings vector. Keep total input size
4124         for stats.
4125         (Output_merge_string::do_print_merge_stats): Print total input size.
4126         * merge.h (Output_merge_string): Add input_size_ field.
4127         * stringpool.cc (Stringpool_template::string_length): Move
4128         implementations out of Stringpool_template class and place in
4129         stringpool.h.
4130         * stringpool.h (string_length): Move out of Stringpool_template.
4131
4132 2010-08-03  Ian Lance Taylor  <iant@google.com>
4133
4134         PR 11712
4135         * layout.cc (relaxation_loop_body): If address of load segment is
4136         set, adjust address to include headers if possible.
4137
4138 2010-08-03  Ian Lance Taylor  <iant@google.com>
4139
4140         * version.cc (version_string): Bump to 1.10.
4141
4142 2010-08-03  Ian Lance Taylor  <iant@google.com>
4143
4144         PR 11805
4145         * layout.h (enum Output_section_order): Define.
4146         (class Layout): Update declarations.
4147         * layout.cc (Layout::get_output_section): Add order parameter.
4148         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4149         is_first_non_relro parameters.  Change all callers.
4150         (Layout::choose_output_section): Likewise.
4151         (Layout::add_output_section_data): Likewise.
4152         (Layout::make_output_section): Likewise.  Set order.
4153         (Layout::default_section_order): New function.
4154         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4155         * output.cc (Output_section::Output_section): Initialize order_.
4156         Don't initialize deleted fields.
4157         (Output_segment::Output_segment): Don't initialize deleted
4158         fields.
4159         (Output_segment::add_output_section_to_load): New function
4160         replacing add_output_section.  Change all callers to call this or
4161         add_output_section_to_nonload.
4162         (Output_segment::add_output_section_to_nonload): New function.
4163         (Output_segment::remove_output_section): Rewrite.
4164         (Output_segment::add_initial_output_data): Likewise.
4165         (Output_segment::has_any_data_sections): Likewise.
4166         (Output_segment::is_first_section_relro): Likewise.
4167         (Output_segment::maximum_alignment): Likewise.
4168         (Output_segment::has_dynamic_reloc): New function replacing
4169         dynamic_reloc_count.  Change all callers.
4170         (Output_segment::has_dynamic_reloc_list): New function replacing
4171         dynamic_reloc_count_list.  Change all callers.
4172         (Output_segment::set_section_addresses): Rewrite.
4173         (Output_segment::set_offset): Rewrite.
4174         (Output_segment::find_first_and_last_list): Remove.
4175         (Output_segment::set_tls_offsets): Rewrite.
4176         (Output_segment::first_section_load_address): Likewise.
4177         (Output_segment::output_section_count): Likewise.
4178         (Output_segment::section_with_lowest_load_address): Likewise.
4179         (Output_segment::write_section_headers): Likewise.
4180         (Output_segment::print_sections_to_map): Likewise.
4181         * output.h (class Output_data): Remove dynamic_reloc_count_
4182         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4183         (Output_data::add_dynamic_reloc): Rewrite.
4184         (Output_data::has_dynamic_reloc): New function.
4185         (Output_data::dynamic_reloc_count): Remove.
4186         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4187         is_last_relro_, is_first_non_relro_, is_interp_,
4188         is_dynamic_linker_section_ fields.  Add order and set_order
4189         functions.  Remove is_relro_local, set_is_relro_local,
4190         is_last_relro, set_is_last_relro, is_first_non_relro,
4191         set_is_first_non_relro functions, is_interp, set_is_interp,
4192         is_dynamic_linker_section, and set_is_dynamic_linker_section
4193         functions.
4194         (class Output_segment): Change Output_data_list from std::list to
4195         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4196         output_bss_ fields.  Update declarations.
4197
4198 2010-08-02  Ian Lance Taylor  <iant@google.com>
4199
4200         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4201         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4202         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4203
4204 2010-08-02  Ian Lance Taylor  <iant@google.com>
4205
4206         PR 11855
4207         * script.cc (Script_options::Script_options): Initialize
4208         symbol_definitions_ and symbol_references_.
4209         (Script_options::add_symbol_assignment): Update
4210         symbol_definitions_ and symbol_references_.
4211         (Script_options::add_symbol_reference): New function.
4212         (script_symbol): New function.
4213         * script.h (class Script_options): Add symbol_definitions_ and
4214         symbol_references_ fields.
4215         (Script_options::referenced_const_iterator): New type.
4216         (Script_options::referenced_begin): New function.
4217         (Script_options::referenced_end): New function.
4218         (Script_options::is_referenced): New function.
4219         (Script_options::any_unreferenced): New function.
4220         * script-c.h (script_symbol): Declare.
4221         * yyscript.y (exp): Call script_symbol.
4222         * symtab.cc: Include "script.h".
4223         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4224         Change all callers.  Check symbols referenced by scripts.
4225         (Symbol_table::add_undefined_symbols_from_command_line): Add
4226         layout parameter.  Change all callers.
4227         (Symbol_table::do_add_undefined_symbols_from_command_line):
4228         Likewise.  Break out loop body.  Check symbols referenced by
4229         scripts.
4230         (Symbol_table::add_undefined_symbol_from_command_line): New
4231         function broken out of
4232         do_add_undefined_symbols_from_command_line.
4233         * symtab.h (class Symbol_table): Update declarations.
4234         * archive.cc: Include "layout.h".
4235         (Archive::should_include_member): Add layout parameter.  Change
4236         all callers.  Check for symbol mentioned in expression.
4237         * archive.h (class Archive): Update declaration.
4238         * object.cc (Sized_relobj::do_should_include_member): Add layout
4239         parameter.
4240         * object.h (Object::should_include_member): Add layout parameter.
4241         Change all callers.
4242         (Object::do_should_include_member): Add layout parameter.
4243         (class Sized_relobj): Update declaration.
4244         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4245         parameter.
4246         * dynobj.h (class Sized_dynobj): Update declaration.
4247         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4248         layout parameter.
4249         * plugin.h (class Sized_pluginobj): Update declaration.
4250
4251 2010-08-02  Ian Lance Taylor  <iant@google.com>
4252
4253         PR 11866
4254         * output.cc (Output_segment::set_offset): Search for the first and
4255         last sections rather than assuming that the list is in order.
4256         (Output_segment::find_first_and_last_list): New function.
4257         * output.h (class Output_segment): Update declarations.
4258         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4259         (relro_strip_test_SOURCES): New variable.
4260         (relro_strip_test_DEPENDENCIES): New variable.
4261         (relro_strip_test_LDFLAGS): New variable.
4262         (relro_strip_test_LDADD): New variable.
4263         (relro_strip_test.so): New target.
4264
4265 2010-08-02  Ian Lance Taylor  <iant@google.com>
4266
4267         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4268         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4269         (Target_i386::got_tlsdesc_section): New function.
4270         (Target_i386::got_section): Create space for GOT entries for
4271         TLSDESC relocations.
4272         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4273         R_386_TLS_GOTDESC.
4274         (Target_i386::Scan::global): Likewise.
4275         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4276         using TLSDESC GOT.
4277         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4278         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4279         (Target_x86_64::got_tlsdesc_section): New function.
4280         (Target_x86_64::got_section): Create space for GOT entries for
4281         TLSDESC relocations.
4282         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4283         R_386_TLS_GOTDESC.
4284         (Target_x86_64::Scan::global): Likewise.
4285         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4286         using TLSDESC GOT.
4287
4288 2010-08-02  Ian Lance Taylor  <iant@google.com>
4289
4290         * testsuite/final_layout.sh: Use dc to convert from hex to
4291         decimal.
4292
4293 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4294
4295         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4296         paramter to the call to gold::gc_process_relocs.
4297         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4298         paramter to the call to gold::gc_process_relocs.
4299         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4300         parameter to the call to gold::gc_process_relocs.
4301         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4302         template parameter to the call to gold::gc_process_relocs.
4303         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4304         paramter to the call to gold::gc_process_relocs.
4305         * gc.h (get_embedded_addend_size): New function.
4306         (gc_process_relocs): Save the size of the reloc for use by ICF.
4307         * icf.cc (get_section_contents): Get the addend from the text section
4308         for SHT_REL relocation sections.
4309         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4310         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4311         * int_encoding.h (read_from_pointer): New overloaded function.
4312         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4313         * testsuite/icf_sht_rel_addend_test.sh: New file.
4314         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4315         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4316
4317 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4318
4319         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4320         * Makefile.in: Regenerate.
4321         * testsuite/Makefile.in: Regenerate.
4322
4323 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4324
4325         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4326         * gold/testsuite/debug_msg.cc: Likewise.
4327         * gold/testsuite/odr_violation1.cc
4328         * gold/testsuite/odr_violation2.cc
4329
4330 2010-07-21  Cary Coutant  <ccoutant@google.com>
4331
4332         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4333         string, and length fields.
4334         (Output_merge_string::Merged_strings_list): New type.
4335         (Output_merge_string::Merged_strings_lists): New typedef.
4336         (Output_merge_string): Replace merged_strings_ with
4337         merged_strings_lists_.
4338         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4339         Merged_strings_list per input object and section.  Don't store pointer
4340         to the string.  Don't store length with each merged string entry.
4341         (Output_merge_string::finalize_merged_data): Loop over list of merged
4342         strings lists.  Recompute length of each merged string.
4343
4344 2010-07-15  Cary Coutant  <ccoutant@google.com>
4345
4346         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4347         here.
4348
4349 2010-07-14  Ian Lance Taylor  <iant@google.com>
4350
4351         * descriptors.cc (Descriptors::open): Report correct name in error
4352         message.
4353
4354 2010-07-13  Doug Kwan  <dougkwan@google.com>
4355
4356         * arm.cc (Arm_input_section::Arm_input_section): For a
4357         SHT_ARM_EXIDX section, always keeps the input sections.
4358         (Arm_input_section::set_exidx_section_link): New method.
4359         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4360         has_errors_ to false.
4361         (Arm_exidx_input_section::has_errors,
4362         Arm_exidx_input_section::set_has_errors): New methods.
4363         (Arm_exidx_input_section::has_errors_): New data member.
4364         (Arm_relobj::get_exidx_shndx_list): New method.
4365         (Arm_output_section::append_text_sections_to_list): Do not skip
4366         section without SHF_EXECINSTR.
4367         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4368         errors.
4369         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4370         section header.  Make error messages more verbose.  Check for
4371         a non-executable section linked to an EXIDX section.
4372         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4373         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4374         check that there is no deferred EXIDX section if we exit early.
4375         Instead of not making an EXIDX section in case of an error, make one
4376         and set the has_errors flag of it.
4377         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4378         in a relocatable link.
4379         (Target_arm::do_relax): Look for the EXIDX output section instead of
4380         assuming that it is called .ARM.exidx.
4381         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4382         section list.  Do not check for SHF_EXECINSTR section flags but
4383         skip any input section with errors.
4384         * output.cc (Output_section::Output_section): Initialize
4385         always_keeps_input_sections_ to false.
4386         (Output_section::add_input_section): Check for
4387         always_keeps_input_sections_.
4388         *  output.h (Output_section::always_keeps_input_sections,
4389         Output_section::set_always_keeps_input_sections): New methods.
4390         (Output_section::always_keeps_input_sections): New data member.
4391
4392 2010-07-13  Rafael Espindola  <espindola@google.com>
4393
4394         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4395         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4396
4397 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4398             Ian Lance Taylor  <iant@google.com>
4399
4400         * output.h (Output_section_lookup_maps::add_merge_section):
4401         Correct check of whether value was inserted.
4402         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4403         (Output_section_lookup_maps::add_relaxed_input_section):
4404         Likewise.
4405         * arm.cc (Target_arm::got_section): Remove used local os.
4406         * i386.cc (Target_i386::got_section): Likewise.
4407         * x86_64.cc (Target_x86_64::got_section): Likewise.
4408         * sparc.cc (Target_sparc::got_section): Likewise.
4409         (Target_sparc::relocate): Remove unused local have_got_offset.
4410         * powerpc.cc (Target_powerpc::relocate): Likewise.
4411
4412 2010-07-13  Ian Lance Taylor  <iant@google.com>
4413
4414         * compressed_output.cc (zlib_decompress): Fix signature in
4415         !HAVE_ZLIB_H case.
4416
4417         * archive.cc (Archive::include_member): Unlock an external member
4418         of a thin archive.  Don't bother to delete an object we know is
4419         NULL.
4420
4421 2010-07-12  Cary Coutant  <ccoutant@google.com>
4422
4423         * compressed_output.cc (zlib_decompress): New function.
4424         (get_uncompressed_size): New function.
4425         (decompress_input_section): New function.
4426         * compressed_output.h (get_uncompressed_size): New function.
4427         (decompress_input_section): New function.
4428         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4429         Handle compressed debug sections.
4430         * layout.cc (is_compressed_debug_section): New function.
4431         (Layout::output_section_name): Map compressed section names to
4432         canonical names.
4433         * layout.h (is_compressed_debug_section): New function.
4434         (is_debug_info_section): Recognize compressed debug sections.
4435         * merge.cc: Include compressed_output.h.
4436         (Output_merge_data::do_add_input_section): Handle compressed
4437         debug sections.
4438         (Output_merge_string::do_add_input_section): Handle compressed
4439         debug sections.
4440         * object.cc: Include compressed_output.h.
4441         (Sized_relobj::Sized_relobj): Initialize new data members.
4442         (build_compressed_section_map): New function.
4443         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4444         * object.h (Object::section_is_compressed): New method.
4445         (Object::do_section_is_compressed): New method.
4446         (Sized_relobj::Compressed_section_map): New type.
4447         (Sized_relobj::do_section_is_compressed): New method.
4448         (Sized_relobj::compressed_sections_): New data member.
4449         * output.cc (Output_section::add_input_section): Handle compressed
4450         debug sections.
4451         * reloc.cc: Include compressed_output.h.
4452         (Sized_relobj::write_sections): Handle compressed debug sections.
4453
4454 2010-07-08  Cary Coutant  <ccoutant@google.com>
4455
4456         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4457         weak when resolving to a dynamic def.
4458         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4459         for weak undef/dynamic def cases. Adjust callers.
4460         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4461         undef_binding_weak_.
4462         (Symbol_table::sized_write_globals): Adjust symbol binding.
4463         (Symbol_table::sized_write_symbol): Add binding parameter.
4464         * symtab.h (Symbol::set_undef_binding): New method.
4465         (Symbol::is_undef_binding_weak): New method.
4466         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4467         (Symbol_table::should_override): Add new parameter.
4468         (Symbol_table::sized_write_symbol): Add new parameter.
4469
4470         * testsuite/weak_undef_file1.cc: Add new test case.
4471         * testsuite/weak_undef_file2.cc: Fix header comment.
4472         * testsuite/weak_undef_test.cc: Add new test case.
4473
4474 2010-06-29  Doug Kwan  <dougkwan@google.com>
4475
4476         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4477         Initialize USE_SYMBOL_.
4478         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4479         definition.
4480         (Arm_reloc_property::uses_symbol_): New data member declaration.
4481         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4482         uses symbol value and symbol is undefined but not weakly undefined.
4483
4484 2010-06-28  Rafael Espindola  <espindola@google.com>
4485
4486         * plugin.cc (Plugin::load): Use dlerror.
4487
4488 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4489
4490         * symtab.cc (detect_odr_violations): When reporting an ODR
4491         violation, report an object where the symbol is defined.
4492
4493 2010-06-25  Doug Kwan  <dougkwan@google.com>
4494
4495         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4496         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4497         definition.
4498         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4499         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4500         target hook to detect function points.
4501         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4502         * icf.h (Icf::check_section_for_function_pointers): Change type of
4503         parameter SECTION_NAME to const reference to std::string.  Use
4504         target hook to determine if section may have unsafe pointers.
4505         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4506         method definition.
4507
4508 2010-06-21  Rafael Espindola  <espindola@google.com>
4509
4510         * fileread.cc (Input_file::find_fie): New
4511         (Input_file::open): Use Input_file::find_fie.
4512         * fileread.h (Input_file::find_fie): New
4513         * plugin.cc (set_extra_library_path): New.
4514         (Plugin::load): Add set_extra_library_path to the transfer vector.
4515         (Plugin_manager::set_extra_library_path): New.
4516         (Plugin_manager::add_input_file): Use the extra search path if set.
4517         (set_extra_library_path(): New.
4518         * plugin.h (Plugin_manager): Add set_extra_library_path and
4519         extra_search_path_.
4520
4521 2010-06-19  Cary Coutant  <ccoutant@google.com>
4522
4523         * layout.cc (gdb_sections): Add .debug_types.
4524         (lines_only_debug_sections): Likewise.
4525
4526 2010-06-18  Rafael Espindola  <espindola@google.com>
4527
4528         * plugin.cc (add_input_file,add_input_library)
4529         (Plugin_manager::add_input_file): Make filename arguments const.
4530         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4531         const.
4532
4533 2010-06-16  Doug Kwan  <dougkwan@google.com>
4534
4535         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4536         .ARM.attributes section if we have not merged any input
4537         attributes sections.
4538
4539 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4540
4541         * arm.cc: Allow combining objects with no EABI version
4542         information.
4543
4544 2010-06-15  Rafael Espindola  <espindola@google.com>
4545
4546         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4547
4548 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4549
4550         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4551         (struct iovec): Correct !HAVE_READV definition.
4552
4553 2010-06-10  Cary Coutant  <ccoutant@google.com>
4554
4555         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4556         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4557         reloc sections.
4558         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4559
4560         PR 11683
4561         * symtab.h (Symbol::is_placeholder): New member function.
4562         * target-reloc.h (relocate_section): Check for placeholder symbols.
4563
4564         * testsuite/Makefile.am (plugin_test_8): New test.
4565         (plugin_test_9): New test.
4566         * testsuite/Makefile.in: Regenerate.
4567
4568 2010-06-09  Nick Clifton  <nickc@redhat.com>
4569
4570         * yyscript.y (input_list_element): Allow strings prefixed with
4571         the '-' character.  Treat these as libraries.
4572         * script.cc (script_add_library): New function.  Adds a library
4573         specified by "-l<name>" found in an input script.
4574         * script-c.h: Add prototype for script_add_library.
4575
4576 2010-06-07  Doug Kwan  <dougkwan@google.com>
4577
4578         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4579         Restrict stub-group size to be within long conditional branch
4580         range when working around cortex-A8 erratum.
4581
4582 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4583
4584         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4585         #ifdef typo.
4586
4587 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4588
4589         PR gold/11658
4590         * output.cc
4591         (Output_section::Input_section_sort_entry::compare_section_ordering):
4592         Change to return non-zero correctly.
4593         (Output_section::Input_section_sort_section_order_index_compare
4594         ::operator()): Change to fix ambiguity in comparisons.
4595
4596 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4597
4598         * gold.h (is_wildcard_string): New function.
4599         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4600         (Layout::layout_eh_frame): Ditto.
4601         (Layout::find_section_order_index): New method.
4602         (Layout::read_layout_from_file): New method.
4603         * layout.h (Layout::find_section_order_index): New method.
4604         (Layout::read_layout_from_file): New method.
4605         (Layout::input_section_position_): New private member.
4606         (Layout::input_section_glob_): New private member.
4607         * main.cc (main): Call read_layout_from_file here.
4608         * options.h (--section-ordering-file): New option.
4609         * output.cc (Output_section::input_section_order_specified_): New
4610         member.
4611         (Output_section::Output_section): Initialize new member.
4612         (Output_section::add_input_section): Add new parameter.
4613         Keep input sections when --section-ordering-file is used.
4614         (Output_section::set_final_data_size): Sort input sections when
4615         section ordering file is specified.
4616         (Output_section::Input_section_sort_entry): Add new parameter.
4617         Check sorting type.
4618         (Output_section::Input_section_sort_entry::compare_section_ordering):
4619         New method.
4620         (Output_section::Input_section_sort_compare::operator()): Change to
4621         consider section_order_index.
4622         (Output_section::Input_section_sort_init_fini_compare::operator()):
4623         Change to consider section_order_index.
4624         (Output_section::Input_section_sort_section_order_index_compare
4625         ::operator()): New method.
4626         (Output_section::sort_attached_input_sections): Change to sort
4627         according to section order when specified.
4628         (Output_section::add_input_section<32, true>): Add new parameter.
4629         (Output_section::add_input_section<64, true>): Add new parameter.
4630         (Output_section::add_input_section<32, false>): Add new parameter.
4631         (Output_section::add_input_section<64, false>): Add new parameter.
4632         * output.h (Output_section::add_input_section): Add new parameter.
4633         (Output_section::input_section_order_specified): New
4634         method.
4635         (Output_section::set_input_section_order_specified): New method.
4636         (Input_section::Input_section): Initialize section_order_index_.
4637         (Input_section::section_order_index): New method.
4638         (Input_section::set_section_order_index): New method.
4639         (Input_section::section_order_index_): New member.
4640         (Input_section::Input_section_sort_section_order_index_compare): New
4641         struct.
4642         (Output_section::input_section_order_specified_): New member.
4643         * script-sections.cc (is_wildcard_string): Delete and move modified
4644         method to gold.h.
4645         (Output_section_element_input::Output_section_element_input): Modify
4646         call to is_wildcard_string.
4647         (Output_section_element_input::Input_section_pattern
4648         ::Input_section_pattern): Ditto.
4649         (Output_section_element_input::Output_section_element_input): Ditto.
4650         * testsuite/Makefile.am (final_layout): New test case.
4651         * testsuite/Makefile.in: Regenerate.
4652         * testsuite/final_layout.cc: New file.
4653         * testsuite/final_layout.sh: New file.
4654
4655 2010-06-01  Rafael Espindola  <espindola@google.com>
4656
4657         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4658
4659 2010-06-01  Rafael Espindola  <espindola@google.com>
4660
4661         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4662         visibility of symbols.
4663
4664 2010-05-27  Doug Kwan  <dougkwan@google.com>
4665
4666         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4667         from start of output section instead of address for a local symbol
4668         in a merged or relaxed section when doing a relocatable link.
4669
4670 2010-05-26  Rafael Espindola  <espindola@google.com>
4671
4672        PR 11604
4673         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4674         adding sections the garbage collector removed.
4675         * gold/testsuite/Makefile.am: Add test.
4676         * gold/testsuite/Makefile.in: Regenerate.
4677         * gold/testsuite/plugin_test_7.sh: New.
4678         * gold/testsuite/plugin_test_7_1.c: New.
4679         * gold/testsuite/plugin_test_7_2.c: New.
4680
4681 2010-05-26  Rafael Espindola  <espindola@google.com>
4682
4683         * script-sections.cc (Output_section_definition::set_section_addresses):
4684         Check for --section-start.
4685
4686 2010-05-26  Doug Kwan  <dougkwan@google.com>
4687
4688         * arm.cc (Arm_scan_relocatable_relocs): New class.
4689         (Target_arm::relocate_special_relocatable): New method.
4690         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4691         (Arm_relocate_functions::thumb_branch_common): Same.
4692         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4693         instead of Default_scan_relocatable_relocs.
4694         * target-reloc.h (relocate_for_relocatable): Let target handle
4695         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4696         * target.h (Sized_target::relocate_special_relocatable): New method.
4697
4698 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4699
4700         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4701
4702 2010-05-23  Doug Kwan  <dougkwan@google.com>
4703
4704         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4705         instead of a cast.
4706         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4707         with a direct branch, not a conditional branch, to a stub.
4708         * merge.cc (Output_merge_base::record_input_section): New method
4709         defintion.
4710         (Output_merge_data::do_add_input_section): Record input section if
4711         keeps-input-sections flag is set.
4712         (Output_merge_string::do_add_input_section): Ditto.
4713         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4714         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4715         INPUT_SECTIONS_.
4716         (Output_merge_base::keeps_input_sections,
4717         Output_merge_base::set_keeps_input_sections,
4718         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4719         method definitions.
4720         (Output_merge_base::Input_sections): New type declaration.
4721         (Output_merge_base::input_sections_begin,
4722         Output_merge_base::input_sections_end,
4723         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4724         (Output_merge_base::bool keeps_input_sections_,
4725         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4726         Output_merge_base::input_sections_): New data members.
4727         (Output_merge_data::do_set_keeps_input_sections): New method
4728         defintion.
4729         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4730         * output.cc (Output_section::Input_section::relobj): Move method
4731         defintion from class declaration to here and handle merge sections.
4732         (Output_section::Input_section::shndx): Ditto.
4733         (Output_section::Output_section): Remove initializations of removed
4734         data members and initialize new data member LOOKUP_MAPS_.
4735         (Output_section::add_input_section): Set keeps-input-sections flag
4736         for a newly created merge output section as appropriate.  Adjust code
4737         to use Output_section_lookup_maps class.
4738         (Output_section::add_relaxed_input_section): Adjst code for lookup
4739         maps code refactoring.
4740         (Output_section::add_merge_input_section): Add a new parameter
4741         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4742         class.  If adding input section to a newly created merge output
4743         section fails, remove the new merge section.
4744         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4745         Adjust code for use of the Output_section_lookup_maps class.
4746         (Output_section::find_merge_section): Ditto.
4747         (Output_section::build_lookup_maps): New method defintion.
4748         (Output_section::find_relaxed_input_section): Adjust code to use
4749         Output_section_lookup_maps class.
4750         (Output_section::get_input_sections): Export merge sections.  Adjust
4751         code to use Output_section_lookup_maps class.
4752         (Output_section:::add_script_input_section): Adjust code to use
4753         Output_section_lookup_maps class.  Update lookup maps for merge
4754         sections also.
4755         (Output_section::discard_states): Use Output_section_lookup_maps.
4756         (Output_section::restore_states): Same.
4757         * output.h (Merge_section_properties): Move class defintion out of
4758         Output_section.
4759         (Output_section_lookup_maps): New class.
4760         (Output_section::Input_section::is_merge_section): New method
4761         defintion.
4762         (Output_section::Input_section::relobj): Move defintion out of class
4763         defintion.  Declare method only.
4764         (Output_section::Input_section::shndx): Ditto.
4765         (Output_section::Input_section::output_merge_base): New method defintion.
4766         (Output_section::Input_section::u2_.pomb): New union field.
4767         (Output_section::Merge_section_by_properties_map,
4768         Output_section::Output_section_data_by_input_section_map,
4769         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4770         Remove types.
4771         (Output_section::add_merge_input_section): Add new parameter
4772         KEEPS_INPUT_SECTIONS.
4773         (Output_section::build_lookup_maps): New method declaration.
4774         (Output_section::merge_section_map_,
4775         Output_section::merge_section_by_properties_map_,
4776         Output_section::relaxed_input_section_map_,
4777         Output_section::is_relaxed_input_section_map_valid_): Remove data
4778         members.
4779         (Output_section::lookup_maps_): New data member.
4780
4781 2010-05-21  Doug Kwan  <dougkwan@google.com>
4782
4783         PR gold/11619
4784         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4785         avoid a compilation error.
4786
4787 2010-05-19  Rafael Espindola  <espindola@google.com>
4788
4789         * script-sections.cc (Output_section_definition::allocate_to_segment):
4790         Update the phdrs_list even when the output section is NULL.
4791         * testsuite/Makefile.am: Add test.
4792         * testsuite/Makefile.in: Regenerate.
4793         * testsuite/script_test_9.cc: New.
4794         * testsuite/script_test_9.sh: New.
4795         * testsuite/script_test_9.t: New.
4796
4797 2010-05-19  Doug Kwan  <dougkwan@google.com>
4798
4799         * arm.cc (Arm_input_section::original_size): New method.
4800         (Arm_input_section::do_addralign): Add a cast.
4801         (Arm_input_section::do_output_offset): Remove static cast.
4802         (Arm_input_section::original_addralign,
4803          Arm_input_section::original_size_): Change type to uint32_t.
4804         (Arm_input_section::init): Add safe casts for section alignment
4805         and size.
4806         (Arm_input_section::set_final_data_size): Do not set address and
4807         offset of stub table.
4808         (Arm_output_section::fix_exidx_coverage): Change use of of
4809         Output_section::Simple_input_section to that of
4810         Output_section::Input_section.
4811         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4812         except for the first pass.
4813         * output.cc (Output_section::get_input_sections): Change type of
4814         input_sections to std::list<Input_section>.
4815         (Output_section::add_script_input_section): Rename from
4816         Output_section::add_simple_input_section.  Change type of SIS
4817         parameter from Simple_input_section to Input_section.
4818         * output.h (Output_section::Simple_input_section): Remove class.
4819         (Output_section::Input_section): Change class visibility to public.
4820         (Output_section::Input_section::addralign): Use stored alignments
4821         for special input sections if set.
4822         (Output_section::Input_section::set_addralign): New method.
4823         (Output_section::get_input_sections): Change parameter type from
4824         list of Simple_input_section to list of Input_section.
4825         (Output_section::add_script_input_section): Rename from
4826         Output_section::add_simple_input_section. Change first parameter's
4827         type from Simple_input_section to Input_section and remove the
4828         second and third parameters.
4829         * script-sections.cc (Input_section::Input_section_list): Change
4830         type to list of Output_section::Input_section/
4831         (Input_section_info::Input_section_info): Change parameter type of
4832         INPUT_SECTION to Output_section::Input_section.
4833         (Input_section_info::input_section): Change return type.
4834         (Input_section_info::input_section_): Change type to
4835         Output_section::Input_section.
4836         (Output_section_element_input::set_section_addresses): Adjust code
4837         to use Output_section::Input_section instead of
4838         Output_section::Simple_input_section.  Adjust code for renaming
4839         of Output_section::add_simple_input_section.
4840         (Orphan_output_section::set_section_addresses): Ditto.
4841
4842 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4843
4844         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4845         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4846
4847 2010-05-18  Rafael Espindola  <espindola@google.com>
4848
4849         * options.cc (General_options::finalize): Handle -nostdlib.
4850         * options.h (nostdlib): New option.
4851         * script.cc (script_add_search_dir): Handle -nostdlib.
4852
4853 2010-05-12  Doug Kwan  <dougkwan@google.com>
4854
4855         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4856         attributes section only if there no attributes section after merging.
4857         (Target_arm::merge_object_attributes): Move value of
4858         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4859         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4860         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4861         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4862         and arm_attr_merge_7.stdout.
4863         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4864         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4865         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4866         arm_attr_merge_7b.o): New rules.
4867         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4868         arm_attr_merge_7
4869         * testsuite/Makefile.in: Regenerate.
4870         * testsuite/arm_attr_merge.sh: New file.
4871         * testsuite/arm_attr_merge_[67][ab].s: Same.
4872
4873 2010-05-05  Nick Clifton  <nickc@redhat.com>
4874
4875         * po/es.po: Updated Spanish translation.
4876
4877 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4878
4879         * Makefile.am (install-exec-local): Properly install gold as
4880         default cross linker.
4881         * Makefile.in: Regenerated.
4882
4883 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4884             Nick Clifton  <nickc@redhat.com>
4885
4886         * configure.ac (install_as_default): Define and set to false
4887         unless --enable-gold or --enable-gold=both/gold has been
4888         specified.
4889         * configure: Regenerate.
4890
4891         * Makefile.am (install-exec-local): Install the executable as
4892         'ld.gold'.  If install_as_default is true then also install it as
4893         'ld'.
4894         * Makefile.in: Regenerated.
4895
4896 2010-04-24  Ian Lance Taylor  <iant@google.com>
4897
4898         * layout.cc (Layout::layout_reloc): In relocatable link don't
4899         combine reloc sections for grouped sections.
4900
4901 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4902
4903         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4904         sections that are not ordinary to icf.
4905         * icf.cc (get_section_contents): Handle relocation pointing to section
4906         with no object or shndx information.
4907         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4908         * testsuite/Makefile.in: Regenerate.
4909         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4910         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4911
4912 2010-04-22  Ian Lance Taylor  <iant@google.com>
4913
4914         * expression.cc (Expression::Expression_eval_info): Add
4915         result_alignment_pointer field.
4916         (Expression::eval_with_dot): Add result_alignment_pointer
4917         parameter.  Change all callers.
4918         (Expression::eval_maybe_dot): Likewise.
4919         (class Binary_expression): Add alignment_pointer parameter to
4920         left_value and right_value.  Change all callers.
4921         (BINARY_EXPRESSION): Set result alignment.
4922         (class Trinary_expression): Add alignment_pointer parameter to
4923         arg2_value and arg3_value.  Change all callers.
4924         (Trinary_cond::value): Set result alignment.
4925         (Max_expression::value, Min_expression::value): Likewise.
4926         (Align_expression::value): Likewise.
4927         * script-sections.cc (class Sections_element): Add dot_alignment
4928         parameter to set_section_addresses virtual function.  Update
4929         instantiations.
4930         (class Output_section_element): Likewise.
4931         (Script_sections::create_segments): Add dot_alignment parameter.
4932         Change all callers.
4933         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4934         (Script_sections::set_phdrs_clause_addresses): Likewise.
4935         * script-sections.h: Update declarations.
4936         * script.h: Update declarations.
4937         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4938         min_p_align.
4939         * testsuite/script_test_3.t: Set large alignment.
4940         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4941         segment has expected alignment.
4942
4943 2010-04-22  Nick Clifton  <nickc@redhat.com>
4944
4945         * po/gold.pot: Updated by the Translation project.
4946         * po/vi.po: Updated Vietnamese translation.
4947
4948 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4949
4950         * testsuite/Makefile.am (check_PROGRAMS): Add
4951         icf_virtual_function_folding_test.
4952         * testsuite/Makefile.in: Regenerated.
4953
4954 2010-04-15  Andrew Haley  <aph@redhat.com>
4955
4956         * options.h (merge_exidx_entries): New option.
4957         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4958         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4959         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4960         (Target_arm::merge_exidx_entries): New function.
4961         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4962         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4963         to Arm_exidx_fixup constructor.
4964         Add new arg, merge_exidx_entries.
4965         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4966         Arm_output_section::fix_exidx_coverage.
4967
4968 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4969
4970         * icf.cc (get_section_contents): Check for preemptible functions.
4971         Ignore addend when appropriate.
4972         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4973         section folded.
4974         (add_from_relobj): Check for section folded.
4975         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4976         * symtab.h (should_add_dynsym_entry): Add new parameter.
4977         * target-reloc.h (scan_relocs): Check for section folded.
4978         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4979         Check reloc types for function pointers in shared objects.
4980         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4981         case.
4982         (icf_preemptible_functions_test): New test case.
4983         (icf_string_merge_test): New test case.
4984         * testsuite.Makefile.in: Regenerate.
4985         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4986         bar_glob.  Refactor code.
4987         * testsuite/icf_preemptible_functions_test.cc: New file.
4988         * testsuite/icf_preemptible_functions_test.sh: New file.
4989         * testsuite/icf_string_merge_test.cc: New file.
4990         * testsuite/icf_string_merge_test.sh: New file.
4991         * testsuite/icf_virtual_function_folding_test.cc: New file.
4992         * testsuite/icf_virtual_function_folding_test.sh: New file.
4993
4994 2010-04-14  Doug Kwan  <dougkwan@google.com>
4995
4996         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4997         for local symbol recounting if we remove a section due to ICF.
4998         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4999         there are no regular objects in input.
5000
5001 2010-04-13  Doug Kwan  <dougkwan@google.com>
5002
5003         * arm.cc (Arm_input_section::set_final_data_size): Compute
5004         accurate final data size instead of using current data size.
5005
5006 2010-04-09  Doug Kwan  <dougkwan@google.com>
5007
5008         * layout.cc (Layout::choose_output_section): Handle script section
5009         types.
5010         (Layout::make_output_section_for_script): Add section type parameter.
5011         Handle script section types.
5012         * layout.h (Layout::make_output_section_for_script): Add section
5013         type parameter.
5014         * output.cc (Output_section::Output_section): Initialize data member
5015         is_noload_.
5016         (Output_section::do_reset_address_and_file_offset): Do not set address
5017         to 0 if section is a NOLOAD section.
5018         * output.h (Output_section::is_noload): New method.
5019         (Output_section::set_is_noload): Ditto.
5020         (Output_section::is_noload_): New data member.
5021         * script-c.h (Script_section_type): New enum type.
5022         (struct Parser_output_section_header): Add new file section_type.
5023         * script-sections.cc (Sections_element::output_section_name): Add
5024         parameter for returning script section type.
5025         (Output_section_definition::output_section_name): Ditto.
5026         (Output_section_definition::section_type)P; New method.
5027         (Output_section_definiton::script_section_type_name): Ditto.
5028         (Output_section_definition::script_section_type_): New data member.
5029         (Output_section_definition::Output_section_definition): Initialize
5030         data member Output_section_definition::script_section_type_.
5031         (Output_section_definition::create_sections): Pass script section type
5032         to Layout::make_output_section_for_script.
5033         (Output_section_definition::output_section_name): Return script
5034         section type to caller.
5035         (Output_section_definition::set_section_address): Do not advance
5036         dot value and load address if section type is NOLOAD.  Set address
5037         of NOLOAD sections regardless of section flags.
5038         (Output_section_definition::print): Print section type if it is
5039         not SCRIPT_SECTION_TYPE_NONE.
5040         (Output_section_definition::section_type): New method.
5041         (Output_section_definition::script_section_type_name): Ditto.
5042         (Script_sections::output_section_name): Add new parameter
5043         PSECTION_TYPE for returning script section type.  Pass it to
5044         section elements.  Handle discard sections.
5045         (Sort_output_sections::operator()): Handle NOLOAD sections.
5046         * script-sections.h (Script_sections::Section_type): New enum type.
5047         (Script_sections::output_section_name): Add a new parameter for
5048         returning script section type.
5049         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5050         INFO and NOLOAD.
5051         * yyscript.y (union): Add new field SECTION_TYPE.
5052         (COPY, DSECT, INFO, NOLOAD): New tokens.
5053         (opt_address_and_section_type): Change type to output_section_header.
5054         (section_type): New non-terminal
5055         (section_header): Handle section type.
5056         (opt_address_and_section_type): Return section type value.
5057
5058 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5059
5060         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5061         * testsuite/plugin_common_test_2.c (foo): Likewise.
5062
5063 2010-04-08  Doug Kwan  <dougkwan@google.com>
5064
5065         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5066         Output_merge_data.
5067         * output.cc (Output_section::add_merge_input_section): Simplify
5068         code and return status of Output_merge_base::add_input_section.
5069         Update merge section map only if Output_merge_base::add_input_section
5070         returns true.
5071
5072 2010-04-07  Doug Kwan  <dougkwan@google.com>
5073
5074         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5075         if section is marked as containing instructions but has no mapping
5076         symbols.
5077         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5078         correct section index.
5079         (Arm_relobj::find_linked_text_section): Ditto.
5080
5081 2010-04-07  Cary Coutant  <ccoutant@google.com>
5082
5083         * archive.cc (include_member): Destroy Read_symbols_data object before
5084         releasing file.
5085         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5086         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5087         (Read_symbols_data::~Read_symbols_data) New destructor.
5088         (Section_relocs::Section_relocs) New constructor.
5089         (Section_relocs::~Section_relocs) New destructor.
5090         (Read_relocs_data::Read_relocs_data) New constructor.
5091         (Read_relocs_data::~Read_relocs_data) New destructor.
5092         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5093         pointers to NULL after deleting.
5094
5095 2010-04-07  Doug Kwan  <dougkwan@google.com>
5096
5097         * arm.cc: Replace "endianity" with "endianness" in comments.
5098         (Arm_exidx_cantunwind): Ditto.
5099         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5100         (Arm_relobj::merge_flags_and_attributes): New method.
5101         (Arm_relobj::merge_flags_and_attributes_): New data member.
5102         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5103         (Arm_relobj::scan_sections_for_stubs): Ditto.
5104         (Arm_relobj::do_read_symbols): Check to see if we really want to
5105         merge processor-specific flags and attributes.  Exit early if
5106         an object is empty except for section names and the undefined symbol.
5107         (Target_arm::do_finalize_sections): Move check for ELF format to
5108         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5109         attributes from a regular object only when we have determined that
5110         it is aapropriate.  Do not create an .ARM.attributes section in
5111         output if there is no regular input object.
5112         (Target_arm::merge_processor_specific_flags): Check
5113         --warn-mismatch before printing any error.
5114         (Target_arm::merge_object_attributes): Ditto.
5115         * gold.cc (queue_middle_tasks): Handle the case in which there is
5116         no regular object in input.
5117         * options.cc (General_options::parse_EB): New method.
5118         (General_options::parse_EL): Same.
5119         (General_options::General_options): Initialize endianness_.
5120         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5121         New options.
5122         (General_options::Endianness): New enum.
5123         (General_options::endianness): New method.
5124         (General_options::endianness_): New data member.
5125         * parameters.cc (Parameters::set_options): Check target endianness.
5126         (Parameters::set_target_once): Ditto.
5127         (Parameters::check_target_endianness): New method.
5128         (parameters_force_valid_target): If either -EL or -EB is specified,
5129         use it to define endianness of default target.
5130         * parameters.h (Parameters::check_target_endianness): New method
5131         declaration.
5132         * target.h (class Target): Change "endianity" to "endianness"
5133         in comments.
5134
5135 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5136
5137         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5138         * configure: Regenerate.
5139         * Makefile.in: Regenerate.
5140         * testsuite/Makefile.in: Regenerate.
5141
5142 2010-04-06  Cary Coutant  <ccoutant@google.com>
5143
5144         gcc PR lto/42757
5145         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5146         prevailing definitions of common symbols.
5147         * testsuite/plugin_test_6.sh: New test case.
5148         * testsuite/plugin_common_test_1.c: New test case.
5149         * testsuite/plugin_common_test_2.c: New test case.
5150         * testsuite/Makefile.am (plugin_test_6): New test case.
5151         * testsuite/Makefile.in: Regenerate.
5152
5153 2010-04-06  Nick Clifton  <nickc@redhat.com>
5154
5155         * po/vi.po: New Vietnamese translation.
5156
5157 2010-03-30  Doug Kwan  <dougkwan@google.com>
5158
5159         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5160
5161 2010-03-25  Doug Kwan  <dougkwan@google.com>
5162
5163         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5164         to avoid a conversion warning on a 32-bit host.
5165
5166 2010-03-24  Ian Lance Taylor  <iant@google.com>
5167
5168         * testsuite/script_test_3.t: Add a TLS segment.
5169         * testsuite/Makefile.am (check_PROGRAMS): Add
5170         tls_phdrs_script_test.
5171         (tls_phdrs_script_test_SOURCES): Define.
5172         (tls_phdrs_script_test_DEPENDENCIES): Define.
5173         (tls_phdrs_script_test_LDFLAGS): Define.
5174         (tls_phdrs_script_test_LDADD): Define.
5175         * testsuite/Makefile.in: Rebuild.
5176
5177 2010-03-23  Cary Coutant  <ccoutant@google.com>
5178
5179         * fileread.cc (find_or_make_view): Fix comment.
5180
5181 2010-03-23  Ian Lance Taylor  <iant@google.com>
5182
5183         * script-sections.cc (class Orphan_section_placement): Define
5184         PLACE_TLS and PLACE_TLS_BSS.
5185         (Orphan_section_placement::Orphan_section_placement): Initialize
5186         new places.
5187         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5188         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5189         (tls_script_test_SOURCES): Define.
5190         (tls_script_test_DEPENDENCIES): Define.
5191         (tls_script_test_LDFLAGS): Define.
5192         (tls_script_test_LDADD): Define.
5193         * testsuite/Makefile.in: Rebuild.
5194
5195 2010-03-22  Doug Kwan  <dougkwan@google.com>
5196
5197         * arm.cc (Arm_relocate_functions::abs8,
5198         Arm_relocate_functions::abs16): Use correct check for overflow
5199         specified in the ARM ELF specs.
5200         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5201         target of a BLX instruction specially.
5202         (Reloc_stub::stub_type_for_reloc): Ditto.
5203         (Relocate::relocate): Use symbolic names instead of numeric relocation
5204         codes to report error.
5205         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5206         workaround.
5207         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5208         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5209         thumb2_blx_out_of_range.stdout
5210         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5211         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5212         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5213         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5214         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5215         thumb2_blx_in_range, thumb2_blx_in_range.o,
5216         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5217         thumb2_blx_out_of_range.o): New rules.
5218         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5219         thumb2_blx_in_range and thumb2_blx_out_of_range.
5220         * testsuite/Makefile.in: Regenerate.
5221         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5222         * testsuite/thumb_blx_in_range.s: New file.
5223         * testsuite/thumb_blx_out_of_range.s: New file.
5224
5225 2010-03-22  Rafael Espindola  <espindola@google.com>
5226
5227         * archive.cc (Should_include): Move to archive.h.
5228         (should_include_member): Make it a member of Archive.
5229         (Lib_group): New.
5230         (Add_lib_group_symbols): New.
5231         * archive.h: Include options.h.
5232         (Archive_member): Moved from Archive.
5233         (Should_include): Moved from archive.cc.
5234         (Lib_group): New.
5235         (Add_lib_group_symbols): New.
5236         * dynobj.cc (do_should_include_member): New.
5237         * dynobj.h (do_should_include_member): New.
5238         * gold.cc (queue_initial_tasks): Update call to queue.
5239         * main.cc (main): Print lib group stats.
5240         * object.cc (do_should_include_member): New.
5241         * object.h: Include archive.h.
5242         (Object::should_include_member): New.
5243         (Object::do_should_include_member): New.
5244         (Sized_relobj::do_should_include_member): New.
5245         * options.cc (General_options::parse_start_lib): New.
5246         (General_options::parse_end_lib): New.
5247         (Input_arguments::add_file): Handle lib groups.
5248         (Input_arguments::start_group): Check we are not in a lib.
5249         (Input_arguments::start_lib): New.
5250         (Input_arguments::end_lib): New.
5251         * options.h (General_options): Add start_lib and end_lib.
5252         (Input_argument::lib_): New.
5253         (Input_argument::lib): New.
5254         (Input_argument::is_lib): New.
5255         (Input_file_lib): New.
5256         (Input_arguments::in_lib_): New.
5257         (Input_arguments::in_lib): New.
5258         (Input_arguments::start_lib): New.
5259         (Input_arguments::end_lib_): New.
5260         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5261         in unused members as preempted.
5262         (Sized_pluginobj::do_should_include_member): New.
5263         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5264         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5265         return the blocker.
5266         (Read_symbols::do_whole_lib_group): New.
5267         (Read_symbols::do_lib_group): New.
5268         (Read_symbols::do_read_symbols): Handle lib groups.
5269         (Read_symbols::get_name): Handle lib groups.
5270         * readsyms.h (Read_symbols): Add an archive member pointer.
5271         (Read_symbols::do_whole_lib_group): New.
5272         (Read_symbols::do_lib_group): New.
5273         (Read_symbols::member_): New.
5274         * script.cc (read_input_script): Update call to queue_soon.
5275
5276 2010-03-19  Doug Kwan  <dougkwan@google.com>
5277
5278         * arm.cc (Stub_table::Stub_table): Initialize new data members
5279         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5280         (Stub_table::add_reloc_stub): Assign stub offset and update
5281         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5282         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5283         New data members.
5284         (Stub_table::update_data_size_and_addralign): Use
5285         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5286         instead of going over all reloc stubs.
5287         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5288         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5289         Stringpool_template::offset_ to size of Stringpool_char.
5290         (Stringpool_template::new_key_offset): Remove code to initialize
5291         Stringpool_template::offset_.
5292         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5293         Stringpool_template::offset_ to zero.
5294
5295 2010-03-15  Doug Kwan  <dougkwan@google.com>
5296
5297         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5298         offset_.
5299         (Stringpool_template::new_key_offset): New method.
5300         (Stringpool_template::add_string): Assign offsets when adding new
5301         strings.
5302         (Stringpool_template::set_string_offsets): Do not set string offsets
5303         when not optimizing.
5304         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5305         member size_.
5306         (Chunked_vector::clear): Clear size_.
5307         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5308         (Chunked_vector::size): Return size_.
5309         (Chunked_vector::push_back): Use size_ to find insert position.
5310         (Chunked_vector::size_): New data member.
5311         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5312         (Stringpool_template::new_key_offset): New method declaration.
5313         (Stringpool_template::offset_): New data member.
5314
5315 2010-03-15   Rafael Espindola  <espindola@google.com>
5316
5317         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5318         Add_symbols' constructor.
5319         * readsyms.h (Add_symbols): Remove the input_group member.
5320
5321 2010-03-10  Ian Lance Taylor  <iant@google.com>
5322
5323         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5324         target to ask whether a reference to a symbol requires a stack
5325         split.
5326         * target.h (Target::is_call_to_non_split): New function.
5327         (Target::do_is_call_to_non_split): Declare virtual function.
5328         * target.cc: Include "symtab.h".
5329         (Target::do_is_call_to_non_split): New function.
5330         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5331
5332 2010-03-10  Cary Coutant  <ccoutant@google.com>
5333
5334         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5335         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5336         (File_read::open[2]): Add whole_file_view_ to list of views.
5337         (File_read::make_view): Remove test of whole_file_view_.
5338         (File_read::find_or_make_view): Create whole_file_view_ if
5339         necessary.
5340         (File_read::clear_views): Replace bool parameter with enum;
5341         adjust all callers.  Don't delete views with permanent data;
5342         do delete cached views and views from archives if
5343         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5344         if clearing the corresponding view.
5345         * fileread.h (File_read::Clear_views_mode): New enum.
5346         (File_read::View::is_permanent_view): New method.
5347         (File_read::clear_views): Replace bool parameter
5348         with enum; adjust all callers.
5349         * options.h (General_options): Change keep_files_mapped option;
5350         add map_whole_files.
5351         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5352         releasing the file.
5353         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5354         the file.
5355
5356 2010-03-10  David S. Miller  <davem@davemloft.net>
5357
5358         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5359
5360 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5361
5362         * icf.cc (get_section_contents): Add '@' marker after processing the
5363         merge reloc.
5364
5365 2010-03-08  Doug Kwan  <dougkwan@google.com>
5366
5367         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5368         due to a conversion warning.
5369         (Arm_relobj::update_output_local_symbol_count): Check for local
5370         symbol with unset output index.
5371
5372 2010-03-05  Ian Lance Taylor  <iant@google.com>
5373
5374         * options.h (class General_options): Add --spare-dynamic-tags.
5375         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5376         --spare-dynamic-tags.
5377
5378 2010-03-05  Ian Lance Taylor  <iant@google.com>
5379
5380         * incremental.cc: Include "libiberty.h".
5381
5382 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5383
5384         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5385         function, is_info_ member.
5386         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5387         (Versions::Versions): Update caller.
5388         (Versions::define_base_version): Likewise.
5389         (Versions::add_def): Likewise.
5390
5391 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5392
5393         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5394         (Scan::possible_function_pointer_reloc): New function.
5395         (Scan::local_reloc_may_be_function_pointer): Change to call
5396         possible_function_pointer_reloc.
5397         (Scan::global_reloc_may_be_function_pointer): Ditto.
5398         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5399         relocations in ".data.rel.ro._ZTV" section.
5400         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5401         * testsuite/icf_safe_so_test.cc: Ditto.
5402         * testsuite/icf_safe_test.cc: Ditto.
5403         * testsuite/icf_safe_test.sh: Ditto.
5404
5405 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5406             Ian Lance Taylor  <iant@google.com>
5407
5408         * target-reloc.h (relocate_section): Check the symbol table index
5409         for -1U before setting the local symbol index.
5410         (scan_relocatable_relocs): If copying the relocation, record that
5411         the local symbol is required.
5412         * object.h (Symbol_value::is_output_symtab_index_set): New
5413         function.
5414         (Symbol_value::may_be_discarded_from_output_symtab): New
5415         function.
5416         (Symbol_value::has_output_symtab_entry): New function.
5417         (Symbol_value::needs_output_symtab_entry): Remove.
5418         (Symbol_value::output_symtab_index): Make sure the symbol index is
5419         set.
5420         (Symbol_value::set_output_symtab_index): Make sure the symbol
5421         index is not set.  Make sure the new index is valid.
5422         (Symbol_value::set_must_have_output_symtab_entry): New function.
5423         (Symbol_value::has_output_dynsym_entry): New function.
5424         (Symbol_value::set_output_dynsym_index): Make sure the new index
5425         is valid.
5426         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5427         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5428         local symbol if permitted.
5429         (Sized_relobj::do_finalize_local_symbols): Call
5430         is_output_symtab_index_set rather than needs_output_symtab_entry.
5431         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5432         rather than needs_output_symtab_entry.  Call
5433         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5434         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5435         is_output_symtab_index_set rather than needs_output_symtab_entry.
5436         * testsuite/discard_locals_relocatable_test.c: New file.
5437         * testsuite/discard_locals_test.sh: Test -r.
5438         * testsuite/Makefile.am (check_DATA): Add
5439         discard_locals_relocatable_test1.syms,
5440         discard_local_relocatable_test2.syms.
5441         (MOSTLYCLEANFILES): Likewise.  Also add
5442         discard_locals_relocatable_test1.lout and
5443         discard_locals_relocatable_test2.out.
5444         (discard_locals_relocatable_test1.syms): New target.
5445         (discard_locals_relocatable_test.o): New target.
5446         (discard_locals_relocatable_test1.out): New target.
5447         (discard_locals_relocatable_test2.syms): New target.
5448         (discard_locals_relocatable_test2.out): New target.
5449         (various): Add missing ../ld-new dependencies.
5450         * testsuite/Makefile.in: Rebuild.
5451
5452 2010-03-03  Nick Clifton  <nickc@redhat.com>
5453
5454         * po/fi.po: New Finnish translation.
5455
5456 2010-03-01  Doug Kwan  <dougkwan@google.com>
5457
5458         * layout.cc (Layout::Layout): Force section types of .init_array*,
5459         .preinit_array* and .fini_array* sections.
5460         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5461         Fix check of return value of std::string::find.().
5462         (Output_section::Input_section_sort_compare::operator()): Remove
5463         comment about .init_array.
5464         (Output_section::Input_section_sort_init_fini_compare::operator()):
5465         New method.
5466         (Output_section::sort_attached_input_sections): Handle .init_array
5467         and .fini_array specially.
5468         * output.h (Output_section::Inut_section_sort_compare): Update
5469         comment.
5470         (Output_section::Input_section_sort_init_fini_compare): New struct.
5471
5472 2010-02-26  Doug Kwan  <dougkwan@google.com>
5473
5474         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5475         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5476         * testsuite/debug_msg.sh: Avoid matching source line number for
5477         use of global variable undef_int.
5478
5479 2010-02-26  Doug Kwan  <dougkwan@google.com>
5480
5481         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5482         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5483         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5484         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5485         * options.cc (General_options::General_options): Initialize member
5486         fix_v4bx_.
5487         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5488         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5489         and rm_no_fix_v4bx.stdout
5490         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5491         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5492         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5493         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5494         and arm_no_fix_v4bx.
5495         * Makefile.in: Regenerate.
5496         * testsuite/arm_fix_v4bx.s: New file.
5497         * testsuite/arm_fix_v4bx.sh: Ditto.
5498
5499 2010-02-24  Doug Kwan  <dougkwan@google.com>
5500
5501         * arm.cc (Target_arm::got_section): Make the .got section the first
5502         non RELRO section in the data segment.
5503         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5504         suffixes of section names.
5505
5506 2010-02-24  Doug Kwan  <dougkwan@google.com>
5507
5508         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5509         flags and attributes merging if an input file is a binary file.
5510         * fileread.cc (Input_file::open): Record format of original file.
5511         * fileread.h (Input_file::Format): New enum type.
5512         (Input_file::Input_file): Initialize data member format_.
5513         (Input_file::format): New method definition.
5514         (Input_file::format_):: New data member.
5515
5516 2010-02-24  Doug Kwan  <dougkwan@google.com>
5517
5518         * arm.cc (Arm_output_data_got): New class.
5519         (ARM_TCB_SIZE): New constant
5520         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5521         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5522         If user uses a script with a SECTIONS clause, issue only a warning
5523         for a misplaced EXIDX input section.  Otherwise, issue an error.
5524         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5525         garbage collection.
5526         (Target_arm::got_mode_index_entry): Handle static linking.
5527         (Target_arm::Scan::local): Ditto.
5528         (Target_arm::Scan::global): Ditto.
5529         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5530         all incorrectly implemented relocations.
5531         (Target_arm::fix_exidx_coverage): Pass layout to
5532         Arm_output_section::fix_exidx_coverage.
5533         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5534         from ".ARM.exidx." and ".ARM.extab.".
5535
5536 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5537
5538         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5539         section if it does not already exist.
5540         * attributes.cc (Attributes_section_data::Attributes_section_data):
5541         Don't crash if size is zero.
5542
5543 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5544             Ian Lance Taylor  <iant@google.com>
5545
5546         * gold.cc (queue_middle_tasks): If no input files were opened,
5547         exit.
5548         * workqueue.h (Task_function::Task_function): Assert that there is
5549         a blocker.
5550
5551 2010-02-22  Doug Kwan  <dougkwan@google.com>
5552
5553         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5554         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5555         types to avoid warnings due to different uint64_t implementations
5556         on different hosts.
5557
5558 2010-02-21  Doug Kwan  <dougkwan@google.com>
5559
5560         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5561         handling of the maximum backward branch offset.
5562         (Arm_relocate_functions::thumb_branch_common): Ditto.
5563         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5564         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5565         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5566         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5567         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5568         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5569         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5570         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5571         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5572         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5573         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5574         thumb2_bl_out_of_range.o): New rules.
5575         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5576         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5577         thumb2_bl_out_of_range
5578         * testsuite/Makefile.in: Regenerate.
5579         * testsuite/arm_bl_in_range.s: New file.
5580         * testsuite/arm_bl_out_of_range.s: Ditto.
5581         * testsuite/arm_branch_in_range.sh: Ditto.
5582         * testsuite/arm_branch_range.t: Ditto.
5583         * testsuite/thumb2_branch_range.t: Ditto.
5584         * testsuite/thumb_bl_in_range.s: Ditto.
5585         * testsuite/thumb_bl_out_of_range.s: Ditto.
5586         * testsuite/thumb_branch_range.t: Ditto.
5587
5588 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5589
5590         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5591         Add reloc offset information.
5592         * icf.cc (get_section_contents): Change iterators to point to the new
5593         vectors. Add reloc offset information to the contents.
5594         * icf.h (Icf::Sections_reachable_info): New typedef.
5595         (Icf::Sections_reachable_list): New typedef.
5596         (Icf::Offset_info): New typedef.
5597         (Icf::Reloc_info): New struct typedef.
5598         (Icf::Reloc_info_list): New typedef.
5599         (Icf::symbol_reloc_list): Delete method.
5600         (Icf::addend_reloc_list): Delete method.
5601         (Icf::section_reloc_list): Delete method.
5602         (Icf::reloc_info_list): New method.
5603         (Icf::reloc_info_list_): New member.
5604
5605 2010-02-19  Doug Kwan  <dougkwan@google.com>
5606
5607         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5608         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5609         * arm.cc (Arm_relocation_functions): New forward declaration.
5610         (Target_arm::Target_arm): Initialize new data members
5611         got_mod_index_offset_ and tls_base_symbol_defined_.
5612         (Target_arm::Relocate::relocate_tls): New method.
5613         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5614          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5615         New methods.
5616         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5617         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5618         (Target_arm::got_mod_index_offset_,
5619         Target_arm::tls_base_symbol_defined_): New data members.
5620         (Target_arm::Scan::local, Target::Scan::global,
5621         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5622         relocations.
5623
5624 2010-02-18  Doug Kwan  <dougkwan@google.com>
5625
5626         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5627         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5628         text section as a parameter becuase some broken tools may not set
5629         the link in section header.
5630         (Target_arm::has_got_section): New method.
5631         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5632         without any mapping symbol as data only.  Remove warning.
5633         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5634         link in its section header, try to discover the link by inspecting the
5635         REL31 relocation at the beginning of the section.
5636         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5637         in error message.
5638         (Target_arm::Scan::global): Treat any reference to the symbol
5639         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5640
5641 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5642
5643         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5644         (Scan::global_reloc_may_be_function_pointer): New function.
5645         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5646         (Scan::global_reloc_may_be_function_pointer): New function.
5647         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5648         (Scan::global_reloc_may_be_function_pointer): New function.
5649         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5650         (Scan::global_reloc_may_be_function_pointer): New function.
5651         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5652         (Scan::global_reloc_may_be_function_pointer): New function.
5653         (Scan::possible_function_pointer_reloc): New function.
5654         (Target_x86_64::can_check_for_function_pointers): New function.
5655         * gc.h (gc_process_relocs): Scan relocation types to determine if
5656         function pointers were taken for targets that support it.
5657         * icf.cc (Icf::find_identical_sections): Include functions for
5658         folding in safe ICF whose pointer is not taken.
5659         * icf.h (Secn_fptr_taken_set): New typedef.
5660         (fptr_section_id_): New member.
5661         (section_has_function_pointers): New function.
5662         (set_section_has_function_pointers): New function.
5663         (check_section_for_function_pointers): New function.
5664         * options.h: Fix comment for safe ICF option.
5665         * target.h (can_check_for_function_pointers): New function.
5666         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5667         Modify icf_safe_test for X86-64.
5668         * testsuite/Makefile.in: Regenerate.
5669         * testsuite/icf_safe_so_test.cc: New file.
5670         * testsuite/icf_safe_so_test.sh: New file.
5671         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5672         (main): Change to take pointer to function kept_func_3.
5673         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5674         folding is done correctly for X86-64.
5675
5676 2010-02-12  David S. Miller  <davem@davemloft.net>
5677
5678         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5679         is_symbolless parameter.
5680         (Output_reloc<SHT_REL>::is_symbolless): New.
5681         (Output_reloc<SHT_REL>::is_symbolless_): New.
5682         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5683         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5684         (Output_reloc<SHT_RELA>::is_symbolless): New.
5685         (Output_data_reloc::add_global): Handle is_symbolless.
5686         (Output_data_reloc::add_global_relative): Likewise.
5687         (Output_data_reloc::add_local): Likewise.
5688         (Output_data_reloc::add_local_relative): Likewise.
5689         (Output_data_reloc::add_symbolless_global_addend): New.
5690         (Output_data_reloc::add_symbolless_local_addend): New.
5691         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5692         is_symbolless.
5693         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5694         instead of ->is_relative_
5695         (Output_reloc::write): Likewise.
5696         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5697         (Output_reloc::write_rel): Simplify.
5698
5699         * sparc.cc (Target_sparc::Scan::local): Use
5700         ->add_symbolless_local_addend as needed.
5701         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5702         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5703         based upon relocation offset.
5704
5705 2010-02-11  Doug Kwan  <dougkwan@google.com>
5706
5707         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5708         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5709         beginning of function.
5710         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5711         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5712         parameter is_32bit in calls to should_apply_static_reloc.
5713         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5714         (check_DATA): Add arm_abs_global.stdout.
5715         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5716         arm_abs_global.stdout): New rules.
5717         (MOSTLLYCLEANFILES): Add arm_abs_global
5718         * Makefile.in: Regenerate.
5719         * testsuite/arm_abs_global.s: New file.
5720         * testsuite/arm_abs_global.sh: Ditto.
5721         * testsuite/arm_abs_lib.s: Ditto.
5722
5723 2010-02-11  Ian Lance Taylor  <iant@google.com>
5724
5725         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5726         Read_relocs task.
5727         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5728         Allocate_commons_task first.
5729         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5730         task, rather than symtab_lock_.
5731         (Gc_process_relocs::~Gc_process_relocs): New function.
5732         (Gc_process_relocs::is_runnable): Check this_blocker_.
5733         (Gc_process_relocs::locks): Use next_blocker_ rather than
5734         blocker_.
5735         (Scan_relocs::~Scan_relocs): New function.
5736         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5737         symtab_lock_.
5738         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5739         next_blocker_.
5740         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5741         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5742         constructor accordingly.
5743         (class Gc_process_relocs): Likewise.
5744         (class Scan_relocs): Likewise.
5745         * common.h (class Allocate_commons_task): Remove symtab_lock_
5746         field, and corresponding constructor parameter.
5747         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5748         symtab_lock_.
5749         (Allocate_commons_task::locks): Likewise.
5750
5751 2010-02-11  Ian Lance Taylor  <iant@google.com>
5752
5753         * gold-threads.h (class Once): Define.
5754         (class Initialize_lock): Rewrite as child of Once.
5755         * gold-threads.cc (class Once_initialize): Define.
5756         (once_pointer_control): New static variable.
5757         (once_pointer, once_arg): New static variables.
5758         (c_run_once): New static function.
5759         (Once::Once, Once::run_once, Once::internal_run): New functions.
5760         (class Initialize_lock_once): Remove.
5761         (initialize_lock_control): Remove.
5762         (initialize_lock_pointer): Remove.
5763         (initialize_lock_once): Remove.
5764         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5765         (Initialize_lock::initialize): Rewrite.
5766         (Initialize_lock::do_run_once): New function.
5767         * archive.cc (Archive::interpret_header): Only clear name if it is
5768         not already empty.
5769         * fileread.cc: Include "gold-threads.h"
5770         (file_counts_lock): New static variable.
5771         (file_counts_initialize_lock): Likewise.
5772         (File_read::release): Only increment counts when using --stats.
5773         Use a lock around the increment.
5774         * parameters.cc (class Set_parameters_target_once): Define.
5775         (set_parameters_target_once): New static variable.
5776         (Parameters::Parameters): Move here from parameters.h.
5777         (Parameters::set_target): Rewrite.
5778         (Parameters::set_target_once): New function.
5779         (Parameters::clear_target): Move here and rewrite.
5780         * parameters.h (class Parameters): Update declarations.  Add
5781         set_parameters_target_once_ field.
5782         (Parameters::Parameters): Move to parameters.cc.
5783         (Parameters::clear_target): Likewise.
5784         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5785         task.
5786         (Start_group::~Start_group): New function.
5787         (Start_group::is_runnable): New function.
5788         (Start_group::locks, Start_group::run): New functions.
5789         (Finish_group::run): Change saw_undefined to size_t.
5790         * readsyms.h (class Start_group): Define.
5791         (class Finish_group): Change saw_undefined_ field to size_t.
5792         (Finish_group::Finish_group): Remove saw_undefined and
5793         this_blocker parameters.  Change all callers.
5794         (Finish_group::set_saw_undefined): New function.
5795         (Finish_group::set_blocker): New function.
5796         * symtab.h (class Symbol_table): Change saw_undefined to return
5797         size_t.  Change saw_undefined_ field to size_t.
5798         * target-select.cc (Set_target_once::do_run_once): New function.
5799         (Target_selector::Target_selector): Initialize set_target_once_
5800         field.  Don't initialize lock_ and initialize_lock_ fields.
5801         (Target_selector::instantiate_target): Rewrite.
5802         (Target_selector::set_target): New function.
5803         * target-select.h (class Set_target_once): Define.
5804         (class Target_selector): Update declarations.  Make
5805         Set_target_once a friend.  Remove lock_ and initialize_lock_
5806         fields.  Add set_target_once_ field.
5807
5808 2010-02-10  Ian Lance Taylor  <iant@google.com>
5809
5810         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5811         queueing any tasks.
5812         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5813         (queue_middle_tasks): Add all blockers before queueing any tasks.
5814         (queue_final_tasks): Likewise.
5815         * token.h (Task_token::add_blockers): New function.
5816         * object.h (Input_objects::number_of_relobjs): New function.
5817
5818 2010-02-10  Ian Lance Taylor  <iant@google.com>
5819
5820         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5821         shared, not if not position independent.
5822         * x86_64.cc (Relocate::relocate_tls): Likewise.
5823         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5824         (tls_pie_pic_test): New target.
5825         * testsuite/Makefile.in: Rebuild.
5826
5827         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5828         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5829         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5830         * testsuite/Makefile.in: Rebuild.
5831
5832 2010-02-09  David S. Miller  <davem@davemloft.net>
5833
5834         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5835         R_SPARC_RELATIVE using ->add_local_relative().
5836         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5837
5838         * output.h (Output_data_dynamic::add_section_size): New method
5839         that takes two Output_data objects.
5840         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5841         entry param.  Handle it in initializers.
5842         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5843         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5844         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5845         arg.
5846         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5847         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5848         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5849         for dynrel_includes_plt.
5850         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5851         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5852         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5853         before .rela.plt
5854         (Target_sparc::do_finalize_sections): Update to pass true for
5855         dynrel_includes_plt.
5856         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5857         output before .rela.plt
5858         (Target_powerpc::do_finalize_sections): Update to pass true for
5859         dynrel_includes_plt when 32-bit.
5860
5861 2010-02-08  Doug Kwan  <dougkwan@google.com>
5862
5863         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5864         method.
5865         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5866         Arm_relobj::scan_section_for_cortex_a8_stubs,
5867         Arm_relobj::do_relocation_section): Instead of calling
5868         Output_section::output_address, use faster
5869         Arm_relobj::simple_input_section_output_address.
5870
5871 2010-02-08  David S. Miller  <davem@davemloft.net>
5872
5873         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5874         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5875         relocation helper function.
5876
5877         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5878         just like R_SPARC_GOT{10,13,22}.
5879         (Target_sparc::Scan::local): Likewise.
5880         (Target_sparc::Relocate:relocate): Likewise.
5881
5882 2010-02-06  Ian Lance Taylor  <iant@google.com>
5883
5884         * configure.ac: Rewrite targetobjs duplicate removal code to use
5885         only shell constructs.
5886         * configure: Rebuild.
5887
5888 2010-02-05  Doug Kwan  <dougkwan@google.com>
5889
5890         PR 11247
5891         * arm.cc (Arm_relobj::section_is_scannable): New method.
5892         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5893         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5894
5895 2010-02-04  Doug Kwan  <dougkwan@google.com>
5896
5897         PR 11247
5898         * arm-reloc-property.cc (cstdio): Include.
5899         * configure.ac (targetobjs): Remove duplicates.
5900         * configure: Regenerate.
5901         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5902         big and little endian version for a given address size.
5903
5904 2010-02-03  Doug Kwan  <dougkwan@google.com>
5905
5906         * arm-reloc-property.cc
5907         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5908         definition.
5909         * arm-reloc-property.h
5910         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5911         New method definition.
5912         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5913         declaration.
5914         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5915         overflow to N.
5916         (GOT_PREL): Change implemented to Y.
5917         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5918         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5919         (Arm_relocate_functions::movw_abs_nc): Remove method.
5920         (Arm_relocate_functions::movt_abs): Ditto.
5921         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5922         (Arm_relocate_functions::thm_movt_abs): Ditto.
5923         (Arm_relocate_functions::movw_rel_nc): Ditto.
5924         (Arm_relocate_functions::movw_rel): Ditto.
5925         (Arm_relocate_functions::movt_rel): Ditto.
5926         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5927         (Arm_relocate_functions:thm_movw_rel): Ditto.
5928         (Arm_relocate_functions:thm_movt_rel): Ditto.
5929         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5930         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5931         New method definitions.
5932         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5933         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5934         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5935         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5936         (Target_arm::Relocate::relocate): Check for non-static or
5937         unimplemented relocation code and exit early.  Change calls to
5938         Target_arm::reloc_uses_thumb_bit and
5939         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5940         instead.  Refactor code to handle similar relocations to increase
5941         code sharing.  Remove check for unsupported relocation code in switch
5942         statement.
5943         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5944         relocation property table to find out size.  Change error message to
5945         print out the name of a relocation code instead of the numeric value.
5946         (Target_arm::scan_reloc_for_stub): Use relocation property table
5947         instead of calling Target_arm::reloc_uses_thumb_bit().
5948
5949 2010-02-02  Doug Kwan  <dougkwan@google.com>
5950
5951         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5952         types of relaxed input section.
5953
5954 2010-02-02  Doug Kwan  <dougkwan@google.com>
5955
5956         * Makefile.am (HFILES): Add arm-reloc-property.h.
5957         (DEFFILES): New.
5958         (TARGETSOURCES): Add arm-reloc-property.cc
5959         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5960         (libgold_a_SOURCES): $(DEFFILES)
5961         * Makefile.in: Regenerate.
5962         * arm-reloc-property.cc: New file.
5963         * arm-reloc-property.h: New file.
5964         * arm-reloc.def: New file.
5965         * arm.cc: Update comments.
5966         (arm-reloc-property.h): New included header.
5967         (arm_reloc_property_table): New global variable.
5968         (Target_arm::do_select_as_default_target): New method definition.
5969         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5970         arm-reloc-property to targ_extra_obj.
5971         * parameters.cc (set_parameters_target): Call
5972         Target::select_as_default_target().
5973         * target.h (Target::select_as_default_target): New method definition.
5974         (Target::do_select_as_default_target): Same.
5975
5976 2010-02-01  Doug Kwan  <dougkwan@google.com>
5977
5978         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5979         first_output_text_section_.
5980         (Arm_exidx_fixup::first_output_text_section): New method definition.
5981         (Arm_exidx_fixup::first_output_text_section_): New data member.
5982         (Arm_exidx_fixup::process_exidx_section): Record the first text
5983         output section seen.
5984         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5985         and entsize in output section header.
5986
5987 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5988
5989         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5990         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5991         (Arm_relocate_functions::thm_alu11): New Method.
5992         (Arm_relocate_functions::thm_pc8): New Method.
5993         (Arm_relocate_functions::thm_pc12): New Method.
5994         (Target_arm::Scan::local): Handle the relocations.
5995         (Target_arm::Scan::global): Likewise.
5996         (Target_arm::Relocate::relocate): Likewise.
5997         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5998
5999 2010-01-29  Doug Kwan  <dougkwan@google.com>
6000
6001         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6002         of relocation types as ld.
6003
6004 2010-01-29  Doug Kwan  <dougkwan@google.com>
6005
6006         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6007         to public.
6008         (Arm_relocate_functions::thumb_branch_common): Ditto.
6009         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6010         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6011         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6012         Arm_relocate_functions::jump24): Remove.
6013         (Target_arm::Relocate::relocate): Adjust code to call
6014         Arm_relocation_functions::arm_branch_common and
6015         Arm_relocation_functions::thumb_branch_common instead of their removed
6016         wrappers.  Merge switch-cases together to reduce source code size.
6017
6018 2010-01-29  Doug Kwan  <dougkwan@google.com>
6019
6020         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6021         output_local_symbol_count_needs_update_.
6022         (Arm_relobj::output_local_symbol_count_needs_update,
6023          Arm_relobj::set_output_local_symbol_count_needs_update,
6024          Arm_relobj::update_output_local_symbol_count): New methods.
6025         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6026         member.
6027         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6028         of pointed function as in a R_ARM_PREL31 relocation.
6029         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6030         for output local symbol count updating.
6031         (Target_arm::do_relax): Update output local symbol counts in objects
6032         if necessary.
6033         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6034
6035 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6036
6037         * arm.cc: Added support for the ARM relocations:
6038         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6039         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6040         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6041         movw_prel_nc).
6042         (Arm_relocate_functions::movw_rel): New method.
6043         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6044         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6045         thm_movw_prel_nc).
6046         (Arm_relocate_functions::thm_movw_rel): New method.
6047         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6048         thm_movt_prel).
6049         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6050         relocations.
6051         (Target_arm::Scan::global): Likewise.
6052         (Target_arm::Relocate::relocate): Likewise.
6053         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6054         Likewise.
6055
6056 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6057
6058         * arm.cc: Added support for ARM group relocations.
6059         (Target_arm::reloc_needs_sym_origin): New method.
6060         (Arm_relocate_functions::calc_grp_kn): New method.
6061         (Arm_relocate_functions::calc_grp_residual): New method.
6062         (Arm_relocate_functions::calc_grp_gn): New method.
6063         (Arm_relocate_functions::arm_grp_alu): New Method.
6064         (Arm_relocate_functions::arm_grp_ldr): New Method.
6065         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6066         (Arm_relocate_functions::arm_grp_ldc): New Method.
6067         (Target_arm::Scan::local): Handle the ARM group relocations.
6068         (Target_arm::Scan::global): Likewise.
6069         (Target_arm::Relocate::relocate): Likewise.
6070         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6071         Likewise.
6072
6073 2010-01-26  Doug Kwan  <dougkwan@google.com>
6074
6075         * arm.cc (set): Include.
6076         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6077         pointer type.
6078         (Arm_output_section::Text_section_list): New type.
6079         (Arm_output_section::append_text_sections_to_list): New method.
6080         (Arm_output_section::fix_exidx_coverage): Ditto.
6081         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6082         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6083         Relobj::set_section_offset() instead of
6084         Sized_relobj::invalidate_section_offset().
6085         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6086         parameter for section headers. Ignore relocation sections for
6087         unallocated sections and EXIDX sections.
6088         (Target_arm::fix_exidx_coverage): New method.
6089         (Target_arm::output_section_address_less_than): New type.
6090         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6091         linked text section instead of the EXIDX section.
6092         (Arm_output_section::create_stub_group): Add an assertion to check
6093         that this is not an EXIDX output section.
6094         (Arm_output_section::append_text_sections_to_list): New method.
6095         (Arm_output_section::fix_exidx_coverage): Ditto.
6096         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6097         Arm_relobj::section_needs_reloc_stub_scanning.
6098         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6099         first pass.
6100         (Target_arm::fix_exidx_coverage): New method.
6101         * object.h (Relobj::set_output_section): New method.
6102         (Sized_relobj::invalidate_section_offset): Remove method.
6103         (Sized_relobj::do_invalidate_section_offset): Remove method.
6104         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6105
6106 2010-01-25  Doug Kwan  <dougkwan@google.com>
6107
6108         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6109         Fix warning due to signed and unsigned comparison on a 32-bit host.
6110
6111 2010-01-22  Doug Kwan  <dougkwan@google.com>
6112
6113         * arm.cc (Target_arm::do_relax): Record an output section for section
6114         offset adjustment it contains any stub table that has changed.
6115         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6116         offsets in an output section if necessary.
6117         * output.cc (Output_section::Output_section): Initialize
6118         section_offsets_need_adjustments_.
6119         (Output_section::add_input_section_for_script): Renamed to
6120         Output_section::add_simple_input_section.
6121         (Output_section::save_states): Add a comment.
6122         (Output_section::discard_states): New method defintion.
6123         (Output_section::adjust_section_offsets): Same.
6124         * output.h (Output_section::add_input_section_for_script): Renamed to
6125         Output_section::add_simple_input_section.
6126         (Output_section::discard_states): New method declaration.
6127         (Output_section::adjust_section_offsets): Same.
6128         (Output_section::section_offsets_need_adjustment,
6129         Output_section::set_section_offsets_need_adjustment): New method
6130         definitions.
6131         (Output_section::section_offsets_need_adjustment_): New data member.
6132         * script-sections.cc
6133         (Output_section_element_input::set_section_address): Adjust code for
6134         renaming of Output_section::add_input_section_for_script.
6135         (Orphan_output_section::set_section_address): Same.
6136
6137 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6138
6139         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6140         Fix_v4bx enum values .
6141         * gold/options.h (General_options): New option definitions.
6142         (General_options::fix_v4bx): New method.
6143         (General_options::Fix_v4bx): New enum.
6144         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6145         (General_options::parse_fix_v4bx_interworking): New method.
6146
6147 2010-01-22  Doug Kwan  <dougkwan@google.com>
6148
6149         * arm.cc (Arm_exidx_fixup): New class.
6150
6151 2010-01-21  Doug Kwan  <dougkwan@google.com>
6152
6153         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6154         classes.
6155         (Arm_exidx_section_offset_map): New type.
6156
6157 2010-01-21  Doug Kwan  <dougkwan@google.com>
6158
6159         * arm.cc (Arm_exidx_input_section): New class.
6160         (Arm_relobj::exidx_input_section_by_link,
6161         Arm_relobj::exidx_input_section_by_shndx,
6162         Arm_relobj::make_exidx_input_section): New methods.
6163         (read_arm_attributes_section): Remove.
6164         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6165         information about them.
6166         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6167         to here.
6168
6169 2010-01-20  Doug Kwan  <dougkwan@google.com>
6170
6171         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6172         Input_section_specifier to Section_id.
6173         (Target_arm::new_arm_input_section: Adjust code for change of key
6174         type.
6175         (Target_arm::find_arm_input_section): Ditto.
6176         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6177         (Section_id): Remove.
6178         (Garbage_collection::Section_id_hash): Remove.
6179         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6180         (Section_id): Remove.
6181         (Icf::Section_id_hash): Remove.
6182         * object.h (Section_id, Const_section_id, Section_id_hash,
6183         Const_section_id_hash): New type definitions.
6184         * output.cc (Output_section::add_relaxed_input_section): Change to
6185         use Const_section_id instead of Input_section_specifier as key type.
6186         (Output_section::add_merge_input_section): Ditto.
6187         (Output_section::build_relaxation_map): Change to use Section_id
6188         instead of Input_section_specifier as key type.
6189         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6190         Ditto.
6191         (Output_section::convert_input_sections_to_relaxed_sections): Change
6192         to use Const_section_id instead of Input_section_specifier as key type.
6193         (Output_section::find_merge_section): Ditto.
6194         (Output_section::find_relaxed_input_section): Ditto.
6195         * output.h (Input_section_specifier): Remove class.
6196         (Output_section::Output_section_data_by_input_section_map): Change
6197         key type to Const_section_id.
6198         (Output_section::Output_relaxed_input_section_by_input_section_map):
6199         Ditto.
6200         (Output_section::Relaxation_map): Change key type to Section_id.
6201
6202 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6203
6204         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6205         (class Arm_v4bx_stub): New class.
6206         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6207         (Stub_factory::make_arm_v4bx_stub): New method.
6208         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6209         (Stub_table::empty): Handle v4bx stubs.
6210         (Stub_table::add_arm_v4bx_stub): New method.
6211         (Stub_table::find_arm_v4bx_stub): New method.
6212         (Arm_relocate_functions::v4bx): New method.
6213         (Target_arm::fix_v4bx): New method.
6214         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6215         (Stub_table::relocate_stubs): Likewise.
6216         (Stub_table::do_write): Likewise.
6217         (Stub_table::update_data_size_and_addralign): Likewise.
6218         (Stub_table::finalize_stubs):  Likewise.
6219         (Target_arm::Scan::local): Likewise.
6220         (Target_arm::Scan::global): Likewise.
6221         (Target_arm::do_finalize_sections): Likewise.
6222         (Target_arm::Relocate::relocate): Likewise.
6223         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6224         Likewise.
6225         (Target_arm::scan_reloc_for_stub): Likewise.
6226         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6227
6228 2010-01-19  Ian Lance Taylor  <iant@google.com>
6229
6230         * output.cc (Output_section_headers::do_sized_write): Write large
6231         segment count to sh_info field.
6232         (Output_file_header::do_sized_write): For large segment count,
6233         write PN_XNUM to e_phnum field.
6234
6235 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6236
6237         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6238         (Arm_relocate_functions::thm_jump8): New function.
6239         (Arm_relocate_functions::thm_jump11): New function.
6240         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6241         R_ARM_THM_JUMP11.
6242         (Target_arm::Scan::global): Likewise.
6243         (Target_arm::Relocate::relocate): Likewise.
6244         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6245         Likewise.
6246
6247 2010-01-14  Doug Kwan  <dougkwan@google.com>
6248
6249         * arm.cc (map, utility): Include headers.
6250         (Target_arm::apply_cortex_a8_workaround): New method.
6251         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6252         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6253         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6254         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6255         the --[no-]fix-cortex-a8 command line options.
6256         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6257         (Target_arm::relocate_stub): Use addend in instruction template.
6258         * options.h (DEFINE_bool): Set the user-set flag.
6259         (General_options): Add --[no-]-fix-cortex options.
6260         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6261         : Update fast look-up map after conversion.
6262
6263 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6264
6265         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6266         in the first pass of do_layout.
6267
6268 2010-01-13  Doug Kwan  <dougkwan@google.com>
6269
6270         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6271         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6272         apparent compiler problem of not folding static constant integral
6273         data members of elfcpp::Elf_sizes<32>.
6274
6275 2010-01-13  Doug Kwan  <dougkwan@google.com>
6276
6277         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6278         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6279         Arm_relobj::scan_section_for_cortex_a8_erratum,
6280         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6281         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6282         sections to scan for relocation stubs into a new method
6283         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6284         relocation and Cortex-A8 stub scanning.
6285         (Target_arm::do_relax): Force stubs to be after stubbed sections
6286         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6287         the beginning of a new relaxation pass.  Update a comment.
6288         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6289
6290 2010-01-12  Ian Lance Taylor  <iant@google.com>
6291
6292         * target-reloc.h (visibility_error): New inline function.
6293         (relocate_section): Call visibility_error.
6294         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6295         (MOSTLYCLEANFILES): Likewise.
6296         (protected_4_pic.o, protected_3.err): New targets.
6297         * testsuite/protected_4.cc: New file.
6298
6299 2010-01-12  Doug Kwan  <dougkwan@google.com>
6300
6301         * arm.cc (Cortex_a8_reloc): New class.
6302         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6303         and cortex_a8_relocs_info_.
6304         (Target_arm::fix_cortex_a8): New method definition.
6305         (Target_arm::Cortex_a8_relocs_info): New type.
6306         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6307         New data member declarations.
6308         (Target_arm::scan_reloc_for_stub): Record information about
6309         relocations for THUMB branches that might be exempted from the
6310         Cortex-A8 workaround.
6311         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6312         at the beginning of a relaxation pass.
6313
6314 2010-01-12  Doug Kwan  <dougkwan@google.com>
6315
6316         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6317         (Arm_relobj::Mapping_symbol_position,
6318          Arm_reloj::Mapping_symbol_position_less,
6319          Arm_relobj::Mapping_symbols_info): New types.
6320         (Target_arm::is_mapping_symbol_name): New method definition.
6321         (Arm_relobj::do_count_local_symbols): Save information about mapping
6322         symbols.
6323
6324 2010-01-11  Doug Kwan  <dougkwan@google.com>
6325
6326         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6327         Arm_relocate_functions::thumb32_branch_upper,
6328         Arm_relocate_functions::thumb32_branch_lower,
6329         Arm_relocate_functions::thumb32_cond_branch_offset,
6330         Arm_relocate_functions::thumb32_cond_branch_upper,
6331         Arm_relocate_functions::thumb32_cond_branch_lower,
6332         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6333         branch offset encoding.
6334         (Arm_relocate_functions::thumb_branch_common): Use new branch
6335         offset encoding methods to avoid code duplication.
6336         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6337         (Stub_addend_reader::operator()): Use new branch encoding method
6338         to avoid code duplication.
6339
6340 2010-01-11  Doug Kwan  <dougkwan@google.com>
6341
6342         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6343         (Target_arm::do_finalize_sections): Define special EXIDX section
6344         symbols only if referenced.
6345         * gc.h (Garbage_collection::add_reference): New method.
6346         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6347         code duplication.
6348
6349 2010-01-11  Ian Lance Taylor  <iant@google.com>
6350
6351         * script.cc (Version_script_info::build_expression_list_lookup):
6352         Change complaing about duplicate wildcard match from error to
6353         warning.
6354
6355         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6356         of 2009-12-30.
6357         (Version_script_info::Version_script_info): Initialize globs_,
6358         default_version_, default_is_global_, and exact_.  Don't
6359         initialize globals_ or locals_.
6360         (Version_script_info::build_lookup_tables): Build local symbols
6361         first.
6362         (Version_script_info::unquote): New function.
6363         (Version_script_info::add_exact_match): New function.
6364         (Version_script_info::build_expression_list_lookup): Remove lookup
6365         parameter.  Add is_global parameter.  Change all callers.  Handle
6366         wildcard pattern specially.  Unquote pattern.  Call
6367         add_exact_match.
6368         (Version_script_info::get_name_to_match): New function.
6369         (Version_script_info::get_symbol_version): New function.
6370         (Version_script_info::get_symbol_version_helper): Remove.
6371         (Version_script_info::check_unmatched_names): Call unquote.
6372         * script.h (class Version_script_info): Change get_symbol_version
6373         to be non-inline and add is_global parameter; change all callers.
6374         Rewrite symbol_is_local.  Update declarations.  Define struct
6375         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6376         Remove globals_ and locals_ members.  Add exact_, globs_,
6377         default_version_, is_global_.
6378         (Version_script_info::Glob): Remove pattern, add expression and
6379         is_global.  Update constructor.  Change all callers.
6380         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6381         default version.
6382         (Versions::symbol_section_contents): If a symbol is undefined, or
6383         defined in a dynamic object, set the version index to
6384         VER_NDX_LOCAL.
6385         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6386         symbol_is_local.
6387         (Symbol_table::add_from_pluginobj): Likewise.
6388         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6389
6390 2010-01-11  Doug Kwan  <dougkwan@google.com>
6391
6392         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6393         (incremental_dump_LDADD): Add linking option for libintl.
6394         * Makefile.in: Regenerate.
6395
6396 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6397
6398         PR gold/11144
6399         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6400         instead of -Ds.
6401         * testsuite/Makefile.in: Regenerated.
6402
6403 2010-01-10  Doug Kwan  <dougkwan@google.com>
6404
6405         * options.h (DEFINE_var): Use parentheses around argument varname__
6406         in macro body to avoid any unintended subsequent substitutions.
6407
6408 2010-01-10  Ian Lance Taylor  <iant@google.com>
6409
6410         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6411         candidates before doing symbol resolution.
6412
6413         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6414         ODR candidates if only one is weak.
6415
6416 2010-01-08  Ian Lance Taylor  <iant@google.com>
6417
6418         * script.cc (Version_script_info::build_expression_list_lookup):
6419         Don't warn about ambiguous version, just record the ambiguity.
6420         (Version_script_info::get_symbol_version_helper): Give error if
6421         version is ambiguous.
6422
6423 2010-01-08  Doug Kwan  <dougkwan@google.com>
6424
6425         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6426           prev_data_size_ and prev_addralign_.  Remove initializer for
6427           deleted data member has_been_changed_.
6428           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6429           to determine if the table is empty.
6430           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6431           Remove.
6432           (Stub_table::add_reloc_stub): Define method in class definition
6433           instead of just declaring it there.
6434           (Stub_table::add_cortex_a8_stub): New method definition.
6435           (Stub_table::update_data_size_and_addralign): Ditto.
6436           (Stub_table::finalize_stubs): Ditto.
6437           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6438           (Stub_table::do_addralign_): Return address alignment in the
6439           (Stub_table::do_reset_address_and_file_offset): Define method in
6440           class definition instead of declaring it there.  Set current data
6441           size to be the data size of the previous pass.
6442           (Stub_table::set_final_data_size): Use current data size as the
6443           final data size.
6444           (Stub_table::relocate_stub): Change parameter type of stub from
6445           Reloc_stub pointer to Stub pointer.
6446           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6447           (Stub_table::Cortex_a8_stub_list): New typedef.
6448           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6449            Stub_table::prev_addralign_): New data member.
6450           (Arm_relobj::Arm_relobj): Initialize data member
6451           section_has_cortex_a8_workaround_.
6452           (Arm_relobj::section_has_cortex_a8_workaround,
6453            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6454            definitions.
6455           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6456           declarations.
6457           (Target_arm::relocate_stub): Change parameter type of stub from
6458           Reloc_stub pointer to Stub pointer.
6459           (Insn_template::size, Insn_template::alignment): Handle
6460           THUMB16_SPECIAL_TYPE.
6461           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6462            Stub_table::update_data_size_and_addralign,
6463            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6464           definitions.
6465           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6466           (Stub_table::do_write): Ditto.
6467           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6468
6469 2010-01-08  Ian Lance Taylor  <iant@google.com>
6470
6471         PR 11108
6472         * symtab.h (class Symbol): Remove fields is_target_special_ and
6473         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6474         (Symbol::is_defined_in_discarded_section): New function.
6475         (Symbol::set_is_defined_in_discarded_section): New function.
6476         (Symbol::has_plt_offset): Rewrite.
6477         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6478         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6479         Don't initialize is_target_special_ or has_plt_offset_.
6480         Initialize is_defined_in_discarded_section_.
6481         (Symbol_table::add_from_relobj): If appropriate, set
6482         is_defined_in_discarded_section.
6483         * resolve.cc (Symbol::override_base_with_special): Don't test
6484         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6485         * target-reloc.h (relocate_section): Do special handling for
6486         symbols defined in discarded sections for global symbols as well
6487         as local symbols.
6488
6489 2010-01-08  Ian Lance Taylor  <iant@google.com>
6490
6491         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6492         the SHT_SYMTAB case.
6493
6494 2010-01-08  Ian Lance Taylor  <iant@google.com>
6495
6496         * object.cc (Sized_relobj::do_layout): Don't get confused if
6497         layout_eh_frame returns NULL.
6498
6499 2010-01-08  Ian Lance Taylor  <iant@google.com>
6500
6501         PR 11084
6502         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6503         dynamic symbol table, use the normal symbol table.
6504         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6505         symbol table.
6506
6507 2010-01-08  Ian Lance Taylor  <iant@google.com>
6508
6509         PR 11072
6510         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6511         sections.
6512
6513 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6514
6515         * version.cc (print_version): Change to "Copyright 2010".
6516
6517 2010-01-08  Ian Lance Taylor  <iant@google.com>
6518
6519         PR 10287
6520         PR 11063
6521         * i386.cc (class Target_i386): Change return type of plt_section
6522         to be non-const.
6523         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6524         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6525         tls_desc_rel_ field.
6526         (Output_data_plt_i386::rel_tls_desc): New function.
6527         (Target_i386::rel_tls_desc_section): New function.
6528         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6529         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6530         R_386_TLS_DESC reloc in rel_tls_desc_section.
6531         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6532         Define struct Tlsdesc_info.
6533         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6534         (Target_x86_64::do_reloc_symbol_index): New function.
6535         (Target_x86_64::add_tlsdesc_info): New function.
6536         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6537         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6538         tlsdesc_rel_ field.
6539         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6540         all callers.
6541         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6542         (Target_x86_64::rela_tlsdesc_section): New function.
6543         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6544         handling.
6545         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6546         (Target_x86_64::do_reloc_addend): New function.
6547         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6548         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6549         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6550         (Output_reloc::type): New function.
6551         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6552         (Output_reloc::is_target_specific): New function.
6553         (Output_reloc::target_arg): New function.
6554         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6555         absolute relocs and target specific relocs.
6556         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6557         add_target_specific.
6558         (class Output_data_reloc) [SHT_RELA]: Likewise.
6559         * output.cc (Output_reloc::Output_reloc): Add four new versions
6560         for absolute relocs and target specific relocs.
6561         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6562         (Output_reloc::get_symbol_index): Likewise.
6563         (Output_reloc::local_section_offset): Check that local_sym_index_
6564         is not TARGET_CODE or 0.
6565         (Output_reloc::symbol_value): Likewise.
6566         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6567         reloc.
6568         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6569         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6570         functions.
6571         * layout.cc (add_target_dynamic_tags): Use output section for
6572         DT_PLTRELSZ and DT_JMPREL.
6573
6574 2010-01-07  Ian Lance Taylor  <iant@google.com>
6575
6576         PR 11061
6577         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6578         function.
6579         (class Output_data_reloc_generic): Define.
6580         (class Output_data_reloc_base): Change base class to
6581         Output_data_reloc_generic.  Change add() method to call
6582         bump_relative_reloc_count for a relative reloc.  Remove
6583         sort_relocs_ field.
6584         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6585         to sort_relocs().
6586         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6587         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6588         appropriate.
6589         * layout.h (class Layout): Update declaration.
6590
6591 2010-01-07  Ian Lance Taylor  <iant@google.com>
6592
6593         * output.h (class Output_data): Add const version of
6594         output_section and do_output_section.
6595         (class Output_section_data): Add const version of
6596         do_output_section.
6597         (class Output_section): Likewise.
6598         * layout.cc (Layout::add_target_dynamic_tags): New function.
6599         * layout.h (class Layout): Update declarations.
6600         * arm.cc (Target_arm::do_finalize_sections): Use
6601         add_target_dynamic_tags.
6602         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6603         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6604         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6605         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6606
6607 2010-01-07  Ian Lance Taylor  <iant@google.com>
6608
6609         PR 11042
6610         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6611         object as needed.
6612
6613 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6614             Ian Lance Taylor  <iant@google.com>
6615
6616         PR 11019
6617         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6618         Xindex::read_symtab_xindex.
6619
6620 2010-01-07  Doug Kwan  <dougkwan@google.com>
6621
6622         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6623         (Insn_template::thumb16_bcond_insn): New method declaration.
6624         (Insn_template): Fix spelling.
6625         (Stub::thumb16_special): New method declaration.
6626         (Stub::do_write): Define virtual method which was previously pure
6627         virtual.
6628         (Stub::do_thumb16_special): New method declaration.
6629         (Stub::do_fixed_endian_write): New template member.
6630         (Reloc_stub::do_write): Remove.
6631         (Reloc_stub::do_fixed_endian_write): Remove.
6632         (Cortex_a8_stub): New class definition.
6633         (Stub_factory::make_cortex_a8_stub): New method definition.
6634         (Stub_factory::Stub_factory): Add missing static storage class
6635         qualifier for elf32_arm_stub_a8_veneer_blx.
6636
6637 2010-01-07  Ian Lance Taylor  <iant@google.com>
6638
6639         PR 10980
6640         * options.h (class General_options): Add --warn-unresolved-symbols
6641         and --error-unresolved-symbols.
6642         * errors.cc (Errors::undefined_symbol): Implement
6643         --warn-unresolved-symbols.
6644
6645         * options.h (class General_options): Add -z text and -z textoff.
6646         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6647
6648 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6649
6650         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6651         (Garbage_collection::cident_sections): New function.
6652         (Garbage_collection::add_cident_section): New function.
6653         (Garbage_collection::cident_sections_): New member.
6654         (gc_process_relocs): Add references to sections whose names are C
6655         identifiers.
6656         * gold.h (cident_section_start_prefix): New constant.
6657         (cident_section_stop_prefix): New constant.
6658         (is_cident): New function.
6659         * layout.cc (Layout::define_section_symbols): Replace string constants
6660         with the newly defined constants.
6661         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6662         C identifiers.
6663         * testsuite/Makefile.am: Add gc_orphan_section_test.
6664         * testsuite/Makefile.in: Regenerate.
6665         * testsuite/gc_orphan_section_test.cc: New file.
6666         * testsuite/gc_orphan_section_test.sh: New file.
6667
6668 2010-01-06  Ian Lance Taylor  <iant@google.com>
6669
6670         PR 10980
6671         * options.h (class General_options): Add --warn-shared-textrel.
6672         * layout.cc (Layout::finish_dynamic_section): Implement
6673         --warn-shared-textrel.
6674
6675         PR 10980
6676         * options.h (class General_options): Add --warn-multiple-gp.
6677
6678 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6679
6680         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6681         $(THREADSLIB) and $(LIBDL).
6682         * Makefile.in: Rebuild.
6683
6684 2010-01-06  Ian Lance Taylor  <iant@google.com>
6685
6686         PR 10980
6687         * options.cc (General_options::parse_section_start): New function.
6688         (General_options::section_start): New function.
6689         (General_options::General_options): Initialize all members.
6690         * options.h: Include <map>
6691         (class General_options): Add --section-start.  Add section_starts_
6692         member.
6693         * layout.cc (Layout::attach_allocated_section_to_segment): If
6694         --section-start was used, set the address of the segment.  Remove
6695         local sort_sections.
6696         (Layout::relaxation_loop_body): If the address of the load segment
6697         has been set by --section-start, don't use it.
6698         * output.h (Output_segment::update_flags_for_output_section): New
6699         function.
6700         * output.cc (Output_segment::add_output_section): Call
6701         update_flags_for_output_section.
6702
6703 2010-01-05  Ian Lance Taylor  <iant@google.com>
6704
6705         PR 10980
6706         * options.h (class General_options): Add --undefined-version.
6707         * script.cc (struct Version_expression): Add was_matched_by_symbol
6708         field.
6709         (Version_script_info::matched_symbol): New function.
6710         (Version_script_info::get_symbol_version_helper): Call
6711         matched_symbol.
6712         (Version_script_info::check_unmatched_names): New function.
6713         * script.h (class Version_script_info): Update declarations.
6714         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6715
6716         * options.h (class General_options): Use DEFINE_bool_alias for
6717         allow_multiple_definition.
6718         * resolve.cc (Symbol_table::should_override): Don't test
6719         allow_multiple_definition.
6720
6721         PR 10980
6722         * options.h (class General_options): Add --cref.
6723         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6724         until after printing cref table.
6725         * cref.cc: Include "symtab.h".
6726         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6727         (Cref_table_compare::operator()): New function.
6728         (Cref_inputs::gather_cref): New function.
6729         (filecol): New static const.
6730         (Cref_inputs::print_cref): New function.
6731         (Cref::print_cref): New function.
6732         * cref.h: Include <cstdio>.
6733         (class Cref): Update declarations.
6734         * mapfile.h (Mapfile::file): New function.
6735         * object.h (class Object): Define Symbols.  Declare virtual
6736         do_get_global_symbols.
6737         (Object::get_global_symbols): New function.
6738         * object.cc (Input_objects::add_object): Pass object to cref_ if
6739         --cref.
6740         (Input_objects::archive_start): Likewise.
6741         (Input_objects::archive_stop): Likewise.
6742         (Input_objects::print_cref): New function.
6743         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6744         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6745         --cref.
6746         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6747         function.
6748         * plugin.h (class Sized_pluginobj): Update declarations.
6749
6750 2010-01-05  Ian Lance Taylor  <iant@google.com>
6751
6752         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6753         to is_default_version.  Rename insdef to insdefault.
6754         (Symbol_table::add_from_relobj): Rename def to is_default_version
6755         and local to is_forced_local.
6756         (Symbol_table::add_from_pluginobj): Likewise.
6757         (Symbol_table::add_from_dynobj): Likewise.
6758         (Symbol_table::define_special_symbol): Rename insdef to
6759         insdefault.
6760
6761 2010-01-04  Ian Lance Taylor  <iant@google.com>
6762
6763         PR 10980
6764         * options.h (class General_options): Add
6765         --allow-multiple-definition and -z muldefs.
6766         * resolve.cc (Symbol_table::should_override): Don't warn about a
6767         multiple symbol definition if --allow-multiple-definition or -z
6768         muldefs.
6769
6770         PR 10980
6771         * options.h (class General_options): Add --add-needed and
6772         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6773         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6774         error if --copy-dt-needed-entries aka --add-needed is used and
6775         would cause a change in behaviour.
6776
6777         PR 10980
6778         * options.h (class General_options): Add -G as a short version of
6779         --shared.  Add no-op options -assert, -g, and -i.
6780
6781 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6782
6783         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6784         check for .text or .gnu.linkonce.t sections.
6785         * icf.cc (Icf::find_identical_sections): Ditto.
6786         Change the detection for mangled function name within the section
6787         name.
6788         * icf.h (is_section_foldable_candidate): New function.
6789
6790 2009-12-30  Ian Lance Taylor  <iant@google.com>
6791
6792         PR 10980
6793         * options.h (class General_options): Permit two dashes with
6794         --retain-symbols-file.
6795
6796 2009-12-30  Ian Lance Taylor  <iant@google.com>
6797
6798         PR 10979
6799         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6800         don't put the file header and segment headers in the text
6801         segment.
6802
6803         PR 10979
6804         * common.cc (Sort_commons::operator()): Stabilize sort when both
6805         entries are NULL.
6806         (Symbol_table::do_allocate_commons_list): When allocating common
6807         symbols, skip a symbol which is no longer common.
6808         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6809         an object before checking its type.
6810         * testsuite/common_test_2.c: New file.
6811         * testsuite/common_test_3.c: New file.
6812         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6813         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6814         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6815         (common_test_2_pic.o, common_test_2.so): New targets.
6816         (common_test_3_pic.o, common_test_3.so): New targets.
6817         * testsuite/Makefile.in: Rebuild.
6818
6819         PR 10979
6820         * script.cc (read_input_script): If we see a new SECTIONS clause,
6821         and we have added an input section, give an error.
6822         * layout.h (class Layout): Add have_added_input_section function.
6823         Add have_added_input_section_ field.
6824         * layout.cc (Layout::Layout): Initialize
6825         have_added_input_section_.
6826         (Layout::layout): Set have_added_input_section_.
6827         (Layout::layout_eh_frame): Likewise.
6828
6829 2009-12-30  Ian Lance Taylor  <iant@google.com>
6830
6831         PR 10931
6832         * options.h (class General_options): Add --sort-common option.
6833         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6834         * common.cc (Sort_common): Add sort_order parameter to
6835         constructor.  Add sort_order_ field.
6836         (Sort_commons::operator): Check sort_order_.
6837         (Symbol_table::allocate_commons): Determine the sort order.
6838         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6839         Change all callers.
6840         (Symbol_table::do_allocate_commons_list): Likewise.
6841
6842 2009-12-30  Ian Lance Taylor  <iant@google.com>
6843
6844         PR 10916
6845         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6846         symbols from this object, don't change the visibility of an
6847         undefined symbol.
6848         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6849
6850 2009-12-30  Ian Lance Taylor  <iant@google.com>
6851
6852         PR 10861
6853         * script.h (class Version_script_info): Define Language enum.
6854         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6855         new fields globals_, locals_, and is_finalized_.
6856         * script.cc: Various formatting fixes.
6857         (class Parser_closure): Change language_stack_ from a vector of
6858         std::string to one of Version_script_info::Language.  Adjust all
6859         uses accordingly.
6860         (class Lazy_demangler): Remove.
6861         (struct Version_expression): Change language from std::string to
6862         Version_script_info::Language.
6863         (Version_script_info::Version_script_info): New function.
6864         (Version_script_info::~Version_script_info): Don't call clear.
6865         (Version_script_info::finalize): New function.
6866         (Version_script_info::build_lookup_tables): New function.
6867         (Version_script_info::build_expression_list_lookup): New
6868         function.
6869         (Version_script_info::get_symbol_version_helper): Rewrite to use
6870         lookup tables.
6871         (Version_script_info::print_expression_list): Adjust to use
6872         Version_script_info::Language.
6873         (script_push_lex_into_version_mode): Check that the version script
6874         has not been finalized.
6875         (version_script_push_lang): Change language string to
6876         Version_script_info::Language.
6877         * options.cc (Command_line::version_script): New function.
6878         * options.h (class General_options): Add finalize_dynamic_list
6879         function.  Change version_script from declaration to definition.
6880         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6881         * testsuite/version_script.map: Remove duplicate def of foo.
6882         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6883         version_script.map.
6884         * testsuite/Makefile.in: Rebuild.
6885
6886 2009-12-30  Ian Lance Taylor  <iant@google.com>
6887
6888         PR 10843
6889         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6890         if the input symbol index is 0, make the output symbol index 0.
6891
6892 2009-12-30  Ian Lance Taylor  <iant@google.com>
6893
6894         PR 10670
6895         * options.h (class General_options): Add -x/--discard-all.
6896         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6897         --discard-all.  If the local symbol needs a dynamic entry, check
6898         that before handling --discard-locals.
6899
6900 2009-12-30  Ian Lance Taylor  <iant@google.com>
6901
6902         PR 10450
6903         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6904         flags to PF_R.
6905         (Output_segment::add_output_section): Don't change the flags if
6906         the type is PT_TLS.
6907
6908         PR 10450
6909         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6910         GNU hash table if they need a dynamic value.  Otherwise, don't add
6911         them if they are defined in a dynamic object or are forced local.
6912
6913 2009-12-29  Ian Lance Taylor  <iant@google.com>
6914
6915         PR 10450
6916         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6917         .gnu.hash table for a 32-bit target.
6918
6919         PR 10450
6920         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6921         regular and a dynamic object only needs a dynamic symbol table
6922         entry if it is externally visible.
6923
6924         PR 10450
6925         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6926         constructor.  Add global_offset_table_ field.
6927         (Target_i386::got_section): Set global_offset_table_.
6928         (Target_i386::do_finalize_sections): Set global_offset_table_
6929         size.
6930         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6931         in constructor.  Add global_offset_table_ field.
6932         (Target_x86_64::got_section): Set global_offset_table_.
6933         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6934         size.
6935
6936         * layout.cc (Layout::Layout): Initialize increase_relro_.
6937         (Layout::get_output_section): Add is_relro, is_last_relro, and
6938         is_first_non_relro parameters.  Change all callers.
6939         (Layout::choose_output_section): Likewise.
6940         (Layout::add_output_section_data): Likewise.
6941         (Layout::make_output_section): Likewise.
6942         (Layout::set_segment_offsets): Clear increase_relro when using a
6943         linker script.
6944         * layout.h (class Layout): Add increase_relro method.  Add
6945         increase_relro_ field.  Update declarations.
6946         * output.cc (Output_section::Output_section): Initialize
6947         is_last_relro_ and is_first_non_relro_.
6948         (Output_segment::add_output_section): Group relro sections is
6949         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6950         (Output_segment::maximum_alignment): Remove relro handling.
6951         (Output_segment::set_section_addresses): Add increase_relro
6952         parameter.  Change all callers.  Add initial alignment to align
6953         relro sections on separate page.  Remove old relro handling.
6954         (Output_segment::set_section_list_addresses): Remove in_relro
6955         parameter.  Change all callers.
6956         (Output_segment::set_offset): Add increase parameter.  Change all
6957         callers.  Remove old relro handling.
6958         * output.h (class Output_section): Add new methods: is_last_relro,
6959         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6960         Add is_last_relro_ and is_first_non_relro_ fields.
6961         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6962         Create separate .got.plt section.  Call increase_relro.
6963         * x86_64.cc (Target_x86_64::got_section): Likewise.
6964         * testsuite/relro_script_test.t: Add .got.plt.
6965
6966         PR 10450
6967         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6968         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6969         (Layout::finalize): Call set_dynamic_symbol_size.
6970         (Layout::set_dynamic_symbol_size): New function.
6971         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6972         set_dynamic_symbol_size.
6973
6974         PR 10450
6975         * output.h (class Output_section): Add is_entsize_zero_ field.
6976         * output.cc (Output_section::Output_section): Initialize
6977         is_entsize_zero_.
6978         (Output_section::set_entsize): If two different entsizes are
6979         requested, force it to zero.
6980         (Output_section::add_input_section): Set flags for .debug_str
6981         before updating section flags.  Set entsize.
6982         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6983         and SHF_STRING if all input sections have those flags.
6984
6985 2009-12-29   Rafael Espindola  <espindola@google.com>
6986
6987         * main.cc (main): Fix the sys time reporting.
6988         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6989         reporting.
6990
6991 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6992
6993         * options.cc (General_options::parse_version): Allow -v to exit
6994         without an error if there is nothing to link.
6995
6996 2009-12-29  Ian Lance Taylor  <iant@google.com>
6997
6998         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6999         using a version of gcc before 4.1.
7000         * configure: Rebuild.
7001
7002 2009-12-28  Chris Demetriou  <cgd@google.com>
7003
7004         * attributes.cc (Output_attributes_section_data::do_write): Use
7005         std::vector::front rather than std::vector::data.
7006
7007 2009-12-28  Ian Lance Taylor  <iant@google.com>
7008
7009         * symtab.h (class Symbol_table): Add enum Defined.
7010         * resolve.cc (Symbol_table::should_override): Add defined
7011         parameter.  Change all callers.  Test whether object is NULL
7012         before calling a method on it.
7013         (Symbol_table::report_resolve_problem): Add defined parameter.
7014         Change all callers.
7015         (Symbol_table::should_override_with_special): Likewise.
7016         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7017         parameter.  Change all callers.
7018         (Symbol_table::do_define_in_output_data): Likewise.
7019         (Symbol_table::define_in_output_segment): Likewise.
7020         (Symbol_table::do_define_in_output_segment): Likewise.
7021         (Symbol_table::define_as_constant): Likewise.
7022         (Symbol_table::do_define_as_constant): Likewise.
7023         * script.h (class Symbol_assignment): Add is_defsym parameter to
7024         constructor; change all callers.
7025         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7026         parameter.  Change all callers.  Add is_defsym_ field.
7027         (class Parser_closure): Add parsing_defsym parameter to
7028         constructor; change all callers.  Add parsing_defsym accessor
7029         function.  Add parsing_defsym_ field.
7030
7031 2009-12-28  Ian Lance Taylor  <iant@google.com>
7032
7033         * gold.cc (queue_middle_tasks): Fix formatting.
7034         * object.cc (Relobj::is_section_name_included): Likewise.
7035
7036 2009-12-23  Ian Lance Taylor  <iant@google.com>
7037
7038         * i386.cc (Target_i386::do_calls_non_split): Recognize
7039         -fsplit-stack prologue for a function with a static chain.
7040         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7041         -fsplit-stack prologue when using %r11.
7042
7043 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7044
7045         * options.cc (General_options::parse_version): Make -v continue and do
7046         the link like GNU ld does.
7047
7048 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7049
7050         * Makefile.am (CCFILES): Add timer.cc.
7051         (HFILES): Add timer.h.
7052         * configure.ac: Check for sysconf and times.
7053         * main.cc: include timer.h.
7054         (main): Use Timer instead of get_run_time.
7055         * timer.cc: New.
7056         * timer.h: New.
7057         * workqueue.cc: include timer.h.
7058         (Workqueue::find_and_run_task):
7059         Report user, sys and wall time.
7060         * Makefile.in: Regenerate.
7061         * config.in: Regenerate.
7062         * configure: Regenerate.
7063
7064 2009-12-16  Doug Kwan  <dougkwan@google.com>
7065
7066         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7067         sections.
7068         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7069         relaxed input sections.
7070         * output.cc (Output_section::find_relaxed_input_section): Change
7071         return type to Output_relaxed_input_section pointer.  Adjust code
7072         for new type of relaxed_input_section_map_.
7073         * output.h (Output_section::find_relaxed_input_section): Change
7074         return type to Output_relaxed_input_section pointer.
7075         (Output_section::Output_relaxed_input_section_by_input_section_map):
7076         New type.
7077         (Output_section::relaxed_input_section_map_): Change type to
7078         Output_section::Output_relaxed_input_section_by_input_section_map.
7079         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7080         input section.
7081
7082 2009-12-15  Ian Lance Taylor  <iant@google.com>
7083
7084         * layout.cc (Layout::create_shstrtab): Only write out after input
7085         sections if we are compressing debug sections.
7086
7087 2009-12-15  Ian Lance Taylor  <iant@google.com>
7088
7089         * archive.cc (Archive::add_symbols): Only look up a symbol without
7090         a version if there is, in fact, a version.
7091
7092 2009-12-14  Ian Lance Taylor  <iant@google.com>
7093
7094         Revert -Wshadow changes, all changes from:
7095         2009-12-11  Doug Kwan  <dougkwan@google.com>
7096         2009-12-11  Nick Clifton  <nickc@redhat.com>
7097         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7098
7099 2009-12-11  Doug Kwan  <dougkwan@google.com>
7100
7101         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7102         due to -Wshadow.
7103         * attributes.cc (Object_attribute::size): Ditto.
7104         (Attributes_section_data::size): Ditto.
7105         (Attributes_section_data::Attributes_section_data): Ditto.
7106         (Output_attributes_section_data::do_write): Ditto.
7107         * attributes.h (Object_attribute::set_type): Ditto.
7108         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7109
7110 2009-12-11  Nick Clifton  <nickc@redhat.com>
7111
7112         * archive.cc: Fix shadowed variable warnings.
7113         * arm.cc: Likewise.
7114         * compressed_output.cc: Likewise.
7115         * compressed_output.h: Likewise.
7116         * configure: Likewise.
7117         * dwarf_reader.cc: Likewise.
7118         * dynobj.cc: Likewise.
7119         * dynobj.h: Likewise.
7120         * ehframe.cc: Likewise.
7121         * ehframe.h: Likewise.
7122         * errors.cc: Likewise.
7123         * expression.cc: Likewise.
7124         * fileread.cc: Likewise.
7125         * fileread.h: Likewise.
7126         * freebsd.h: Likewise.
7127         * i386.cc: Likewise.
7128         * icf.cc: Likewise.
7129         * incremental.h: Likewise.
7130         * layout.cc: Likewise.
7131         * layout.h: Likewise.
7132         * mapfile.cc: Likewise.
7133         * merge.cc: Likewise.
7134         * merge.h: Likewise.
7135         * object.cc: Likewise.
7136         * object.h: Likewise.
7137         * options.h: Likewise.
7138         * output.cc: Likewise.
7139         * output.h: Likewise.
7140         * parameters.cc: Likewise.
7141         * plugin.cc: Likewise.
7142         * powerpc.cc: Likewise.
7143         * reduced_debug_output.cc: Likewise.
7144         * reduced_debug_output.h: Likewise.
7145         * reloc.cc: Likewise.
7146         * reloc.h: Likewise.
7147         * resolve.cc: Likewise.
7148         * script-sections.cc: Likewise.
7149         * script.cc: Likewise.
7150         * script.h: Likewise.
7151         * sparc.cc: Likewise.
7152         * symtab.cc: Likewise.
7153         * symtab.h: Likewise.
7154         * target-select.cc: Likewise.
7155         * target-select.h: Likewise.
7156         * token.h: Likewise.
7157         * workqueue.cc: Likewise.
7158         * workqueue.h: Likewise.
7159         * x86_64.cc: Likewise.
7160
7161 2009-12-10  Doug Kwan  <dougkwan@google.com>
7162
7163         * arm.cc (attributes.h): New include.
7164         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7165         (Arm_relobj::~Arm_relobj): Delete object pointed by
7166         attributes_section_data_.
7167         (Arm_relobj::attributes_section_data): New method definition.
7168         (Arm_relobj::attributes_section_data_): New data member declaration.
7169         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7170         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7171         attributes_section_data_.
7172         (Arm_dynobj::attributes_section_data): New method definition.
7173         (Arm_dynobj::attributes_section_data_): New data member declaration.
7174         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7175         initialization value of may_use_blx_ to false.
7176         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7177         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7178         object attributes to compute results instead of hard-coding.
7179         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7180         Target_arm::get_secondary_compatible_arch,
7181         Target_arm::set_secondary_compatible_arch
7182         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7183         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7184         New method declarations.
7185         (Target_arm::get_aeabi_object_attribute): New method definition.
7186         (Target_arm::attributes_section_data_): New data member declaration.
7187         (read_arm_attributes_section): New template definition.
7188         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7189         (Arm_dynobj::do_read_symbols): Ditto.
7190         (Target_arm::do_finalize_sections): Merge attributes sections from
7191         input.  Check for BLX use after attributes section merging.
7192         Fix __exidx_start and __exidx_end visibility.  Create an
7193         .ARM.attributes section if necessary.
7194         (Target_arm::get_secondary_compatible_arch,
7195         Target_arm::set_secondary_compatible_arch,
7196         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7197         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7198         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7199         New method definitions.
7200
7201 2009-12-09  Ian Lance Taylor  <iant@google.com>
7202
7203         * plugin.cc (Plugin::load): Don't cast from void* to a function
7204         pointer.
7205
7206 2009-12-09  Ian Lance Taylor  <iant@google.com>
7207
7208         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7209         information fields.
7210
7211 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7212
7213         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7214         Replace two_file_shared_1.so with two_file_shared_2.so.
7215         * testsuite/Makefile.in: Regenerated.
7216
7217 2009-12-08  Doug Kwan  <dougkwan@google.com>
7218
7219         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7220         (HFILES): Add attributes.h and int_encoding.h.
7221         * Makefile.in: Regenerate.
7222         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7223         function definitions to int_encoding.cc
7224         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7225         prototypes to int_encoding.h
7226         * reduced_debug_output.cc (int_encoding.h): New include.
7227         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7228         function definitions to int_encoding.cc
7229         (insert_into_vector, read_from_pointer): Move template definitions to
7230         int_encoding.h
7231         * attributes.cc: New file.
7232         * attributes.h: New file.
7233         * int_encoding.cc: New file.
7234         * int_encoding.h: New file.
7235
7236 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7237
7238         PR gold/11055
7239         * incremental-dump.cc (dump_incremental_inputs): New.
7240         (main): Use dump_incremental_inputs.
7241
7242 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7243
7244         PR gold/10893
7245         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7246         checking elfcpp::STT_FUNC.
7247         (Target_i386::Relocate::relocate): Likewise.
7248         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7249
7250         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7251         symbols from shared libraries into normal FUNC symbols.
7252
7253         * symtab.h (Symbol): Add is_func and use it.
7254
7255 2009-12-05  Doug Kwan  <dougkwan@google.com>
7256
7257         * arm.cc (Target_arm::arm_info): Initialize new fields
7258         attributes_section and attributes_vendor.
7259         * i386.cc (Target_i386::i386_info): Same.
7260         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7261         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7262         fields attributes_section and attributes_vendor.
7263         * sparc.cc (Target_sparc::sparc_info): Same.
7264         * target.h (Target::attributes_section, Target::attributes_vendor,
7265         Target::is_attributes_section, Target::attribute_arg_type,
7266         Target::attributes_order): New method definitions.
7267         (Target::Target_info::attributes_section,
7268         Target::Target_info::attributes_vendor): New fields.
7269         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7270         virtual method definitions.
7271         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7272         attributes_section and attributes_vendor.
7273         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7274
7275 2009-12-05  Doug Kwan  <dougkwan@google.com>
7276
7277         * arm.cc: Update comments about interworking and stub generation.
7278         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7279         considered as non-PIC.
7280         (Arm_relocate_functions::base_abs): Fix formatting.
7281         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7282         of function to use GOT entry address instead of offset.
7283         (Target_arm::Scan::global): Issue an error if a symbol would need a
7284         PLT does not get one because it is untyped.  Remove code to create
7285         dynamic symbols for relative branches.
7286         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7287         takes unsigned integer instead of boolean.
7288
7289 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7290
7291         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7292         (two_file_test_LDADD): Likewise.
7293         (common_test_1_LDADD): Likewise.
7294         (exception_test_LDADD) Likewise.
7295         (weak_test_LDADD): Likewise.
7296         (many_sections_test_LDADD): Likewise.
7297         (initpri1_LDADD): Likewise.
7298         (script_test_1_LDADD): Likewise.
7299         (script_test_2_LDADD): Likewise.
7300         (justsyms_LDADD): Likewise.
7301         (binary_test_LDADD): Likewise.
7302         (large_LDADD): Likewise.
7303         * testsuite/Makefile.in: Regenerated.
7304
7305 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7306
7307         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7308         (Symbol_table::override_with_special): Likewise.
7309         (Symbol_table::add_from_object): Likewise.
7310
7311 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7312
7313         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7314         Don't set the data_offset twice.
7315
7316 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7317
7318         * testsuite/Makefile.in: Regenerate.
7319
7320 2009-12-03  Doug Kwan  <dougkwan@google.com>
7321
7322         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7323         (Target_arm::do_finalize_sections): Add parameter for symbol table
7324         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7325         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7326         parameter for symbol table pointer.
7327         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7328         an additional parameter for a pointer to symbol table.
7329         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7330         parameter for a symbol table pointer.
7331         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7332         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7333         Ditto.
7334         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7335         parameter for a symbol table pointer.
7336
7337 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7338
7339         * incremental.cc (Incremental_inputs_header)
7340         (Incremental_inputs_header_write, Incremental_inputs_entry)
7341         (Incremental_inputs_entry_write): Move ...
7342         * incremental.h (Incremental_inputs_header)
7343         (Incremental_inputs_header_write, Incremental_inputs_entry)
7344         (Incremental_inputs_entry_write): here.
7345
7346 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7347
7348         * incremental.cc (make_sized_incremental_binary): Set the target.
7349         Error if it is incompatible.
7350         * output.h (Output_file): Add filename method.
7351
7352 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7353
7354         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7355         from the get_* methods.
7356
7357 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7358
7359         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7360         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7361         Write 0 for the data_offset of scripts.
7362
7363 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7364
7365         * testsuite/Makefile.am: Add the incremental_test.sh test.
7366         * testsuite/incremental_test.sh: New.
7367         * testsuite/incremental_test_1.c: New.
7368         * testsuite/incremental_test_2.c: New.
7369
7370 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7371
7372        * incremental-dump.cc (main): Fix typos.
7373
7374 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7375
7376         PR gold/11025
7377         * incremental-dump.cc (main): Use llu to print 64 bit values.
7378
7379 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7380             H.J. Lu  <hongjiu.lu@intel.com>
7381
7382         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7383         $(LIBDL).
7384         (incremental_dump_LDADD): Likewise.
7385         * Makefile.in: Regenerated.
7386
7387 2009-11-25  Doug Kwan  <dougkwan@google.com>
7388
7389         Revert:
7390
7391         2009-11-25  Doug Kwan  <dougkwan@google.com>
7392
7393                 * arm.cc (Target_arm::Target_arm): Move method definition
7394                 outside of class definition.  Add code to handle
7395                 --target1-rel, --target1-abs and --target2= options.
7396                 (Target_arm::get_reloc_reloc_type): Change method to be
7397                 non-static and const.
7398                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7399                 New data member declaration.
7400                 (Target_arm::Scan::local, Target_arm::Scan::global,
7401                 Target_arm::Relocate::relocate,
7402                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7403                 Adjust call to Target_arm::get_real_reloc_type.
7404                 (Target_arm::get_real_reloc_type): Use command line options
7405                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7406                 * options.h (--target1-rel, --target1-abs, --target2): New
7407                 ARM-only options.
7408
7409 2009-11-25  Doug Kwan  <dougkwan@google.com>
7410
7411         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7412         class definition.  Add code to handle --target1-rel, --target1-abs
7413         and --target2= options.
7414         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7415         and const.
7416         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7417         member declaration.
7418         (Target_arm::Scan::local, Target_arm::Scan::global,
7419         Target_arm::Relocate::relocate,
7420         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7421         call to Target_arm::get_real_reloc_type.
7422         (Target_arm::get_real_reloc_type): Use command line options to
7423         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7424         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7425         options.
7426
7427 2009-11-25  Doug Kwan  <dougkwan@google.com>
7428
7429         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7430         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7431         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7432         formatting.
7433         (Arm_relocate_functions::thm_call): Replace body with a call to
7434         Arm_relocate_functions::thumb_branch_common.
7435         (Arm_relocate_functions::thm_jump24,
7436         Arm_relocate_functions::thm_xpc22): New method definitions.
7437         (Arm_relocate_functions::thumb_branch_common): New method definition.
7438         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7439         operator.
7440         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7441         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7442
7443 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7444
7445         * Makefile.am: Build incremental-dump
7446         * Makefile.in: Regenerate.
7447         * incremental-dump.cc: New.
7448         * incremental.cc (Incremental_inputs_header_data,
7449         Incremental_inputs_entry_data): Move to incremental.h
7450         * incremental.h: (Incremental_inputs_header_data,
7451         Incremental_inputs_entry_data): Move from incremental.cc
7452
7453 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7454
7455         * incremental.cc (Incremental_inputs_header,
7456         Incremental_inputs_header_write, Incremental_inputs_entry,
7457         Incremental_inputs_entry_write): Add a typedef with the data type.
7458
7459 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7460
7461         * incremental.cc (Incremental_inputs_header,
7462         Incremental_inputs_header_write, Incremental_inputs_entry,
7463         Incremental_inputs_entry_write): Update comment about which
7464         type has the filed descriptions.
7465
7466 2009-11-15  Doug Kwan  <dougkwan@google.com>
7467
7468         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7469         (Arm_relocate_functions::arm_branch_common): Change method defintion
7470         in class definition to a method declaration and update list of formal
7471         parameters.
7472         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7473         Arm_relocation_functions::jump24): Adjust call to
7474         Arm_relocate_functions::arm_branch_common.  Update list of formal
7475         parameters.
7476         (Arm_relocate_functions::xpc25): New method definition.
7477         (Arm_relocate_functions::arm_branch_common): Move method defintion
7478         out from class definition.  Use stubs for mode-switching and extending
7479         branch ranges.
7480         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7481         specially.  Change code to enable use of stubs in ARM branches.
7482
7483 2009-11-10  Doug Kwan  <dougkwan@google.com>
7484
7485         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7486         in method declaration.
7487         (Target_arm::relocate_stub): New method declaration.
7488         (Target_arm::default_target): Change to return a pointer instead of
7489         a const reference.
7490         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7491         Target_arm::default_target.
7492         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7493         method definition.
7494         (Target_arm::relocate_section): Adjust view.
7495         (Target_arm::relocate_stub): New method definition.
7496
7497 2009-11-10  Doug Kwan  <dougkwan@google.com>
7498
7499         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7500         a format warning.
7501         * incremental.cc (open_incremental_binary): Initialized local
7502         variables to avoid warnings.
7503         * object.cc (make_elf_object): Ditto.
7504         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7505         a format warning.
7506
7507 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7508
7509         PR gold/10930
7510         * testsuite/plugin_test.c: Include "config.h".
7511
7512 2009-11-09  Doug Kwan  <dougkwan@google.com>
7513
7514         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7515         (arm_symbol_value): Remove.
7516         (Arm_relocate_functions::arm_branch_common,
7517         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7518         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7519         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7520         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7521         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7522         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7523         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7524         Arm_relocate_functions::thm_mobw_abs_nc,
7525         Arm_relocate_functions::thm_mov_abs,
7526         Arm_relocate_functions::movw_prel_nc,
7527         Arm_relocate_functions::thm_movt_abs,
7528         Arm_relocate_functions::movt_prel,
7529         Arm_relocate_functions::thm_movw_prel_nc,
7530         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7531         (Target_arm::Relocate::relocate): Only decompose address into two
7532         parts if relocation type uses the thumb-bit and pass the actual
7533         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7534         calls to methods in Arm_relocate_functions for this change.
7535
7536 2009-11-08  Ian Lance Taylor  <iant@google.com>
7537
7538         PR 10925
7539         * reloc.cc: Instantiate
7540         Sized_relobj::initialize_input_to_output_maps and
7541         Sized_relobj:free_input_to_output_maps.
7542
7543 2009-11-06  Ian Lance Taylor  <iant@google.com>
7544
7545         PR 10876
7546         * defstd.cc (in_segment): Set only_if_ref true for "end".
7547
7548 2009-11-06  Doug Kwan  <dougkwan@google.com>
7549
7550         * arm.cc (class Reloc_stub): Correct a comment.
7551         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7552         (Target_arm::scan_section_for_stubs): New method declaration.
7553         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7554         Change methods from private to protected.
7555         (Target_arm::do_may_relax): New method definition.
7556         (Target_arm::do_relax, Target_arm::group_sections,
7557         Target_arm::scan_reloc_for_stub,
7558         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7559         (Target_arm::arm_input_section_map_): New data member declaration.
7560         (Target_arm::scan_reloc_for_stub,
7561         Target_arm::scan_reloc_section_for_stubs,
7562         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7563         Target_arm::do_relax): New method definitions.
7564
7565 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7566
7567         * configure.ac: Check for (struct stat)::st_mtim
7568         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7569         * config.in: Regenerate.
7570         * configure: Regenerate.
7571
7572 2009-11-05  Ian Lance Taylor  <iant@google.com>
7573
7574         PR 10910
7575         * output.cc (Output_segment::add_output_section): Add missing
7576         return statement.
7577
7578 2009-11-04  Ian Lance Taylor  <iant@google.com>
7579
7580         PR 10880
7581         * object.h (class Object): Add is_needed and set_is_needed
7582         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7583         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7584         defined in a dynamic object and referenced by a regular object,
7585         set is_needed for the dynamic object.
7586         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7587         if the file is marked with as_needed and it is not needed.
7588
7589 2009-11-04  Ian Lance Taylor  <iant@google.com>
7590
7591         PR 10887
7592         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7593         tags if data is discarded by linker script.
7594         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7595         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7596         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7597         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7598
7599 2009-11-04  Ian Lance Taylor  <iant@google.com>
7600
7601         * layout.cc (Layout::get_output_section): Add is_interp and
7602         is_dynamic_linker_section parameters.  Change all callers.
7603         (Layout::choose_output_section): Likewise.
7604         (Layout::make_output_section): Likewise.
7605         (Layout::add_output_section_data): Add is_dynamic_linker_section
7606         parameter.  Change all callers.
7607         * layout.h (class Layout): Update declarations.
7608         * output.h (class Output_section): Add is_interp, set_is_interp,
7609         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7610         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7611         generate_code_fills_at_write_ to a bitfield.
7612         * output.cc (Output_section::Output_sections): Initialize new
7613         fields.
7614         (Output_segment::add_output_section): Add do_sort parameter.
7615         Change all callers.
7616
7617 2009-11-03  Ian Lance Taylor  <iant@google.com>
7618
7619         PR 10860
7620         * options.h (class General_options): Add --warn-common.
7621         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7622         merging two common symbols.
7623         (Symbol_table::should_override): Handle --warn-common when merging
7624         a common symbol with a defined symbol.  Use report_resolve_problem
7625         for multiple definitions.
7626         (Symbol_table::report_resolve_problem): New function.
7627         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7628
7629 2009-11-03  Doug Kwan  <dougkwan@google.com>
7630
7631         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7632         stub_factory_.
7633         (Target_arm::stub_factory): New method definition.
7634         (Target_arm::new_arm_input_section,
7635         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7636         Target_arm::reloc_uses_thumb_bit): New method declarations.
7637         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7638         New type definitions.
7639         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7640         member declarations.
7641         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7642         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7643         New method definitions.
7644
7645 2009-11-03  Ian Lance Taylor  <iant@google.com>
7646
7647         * options.h (class General_options): Add --warn_constructors.
7648
7649 2009-11-03  Ian Lance Taylor  <iant@google.com>
7650
7651         PR 10893
7652         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7653         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7654
7655 2009-11-03  Ian Lance Taylor  <iant@google.com>
7656
7657         PR 10895
7658         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7659         --msgid-bugs-address.
7660         (install-pdf): New target.
7661         (install-data_yes): Look up one directory to find mkinstalldirs.
7662
7663 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7664
7665         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7666         tree.
7667
7668 2009-10-30  Doug Kwan  <dougkwan@google.com>
7669
7670         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7671
7672 2009-10-30  Doug Kwan  <dougkwan@google.com>
7673
7674         * arm.cc (Stub_addend_reader): New struct template definition
7675         and partial specializations.
7676         (Stub_addend_reader::operator()): New method definition for a
7677         partially specialized template.
7678
7679 2009-10-30  Doug Kwan  <dougkwan@google.com>
7680
7681         * arm.cc (Arm_relobj::processor_specific_flags): New method
7682         definition.
7683         (Arm_relobj::do_read_symbols): New method declaration.
7684         (Arm_relobj::processor_specific_flags_): New data member declaration.
7685         (Arm_dynobj): New class definition.
7686         (Target_arm::do_finalize_sections): Add input_objects parameter.
7687         (Target_arm::do_adjust_elf_header): New method declaration.
7688         (Target_arm::are_eabi_versions_compatible,
7689         (Target_arm::merge_processor_specific_flags): New method declaration.
7690         (Target_arm::do_make_elf_object): New overloaded method definitions
7691         and declaration.
7692         (Arm_relobj::do_read_symbols): New method definition.
7693         (Arm_dynobj::do_read_symbols): Ditto.
7694         (Target_arm::do_finalize_sections): Add input_objects parameters.
7695         Merge processor-specific flags from all input objects.
7696         (Target_arm::are_eabi_versions_compatible,
7697         Target_arm::merge_processor_specific_flags,
7698         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7699         New method definitions.
7700         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7701         Input_objects pointer type parameter.
7702         * layout.cc (Layout::finalize): Pass input objects to target's.
7703         finalize_sections function.
7704         * output.cc (Output_file_header::do_sized_write): Set ELF file
7705         header's processor-specific flags.
7706         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7707         Input_objects pointer type parameter.
7708         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7709         * target.h (Input_objects): New forward class declaration.
7710         (Target::processor_specific_flags,
7711         Target::are_processor_specific_flags_sect): New method definitions.
7712         (Target::finalize_sections): Add input_objects parameter.
7713         (Target::Target): Initialize processor_specific_flags_ and
7714         are_processor_specific_flags_set_.
7715         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7716         parameter.
7717         (Target::set_processor_specific_flags): New method definition.
7718         (Target::processor_specific_flags_,
7719         Target::are_processor_specific_flags_set_): New data member
7720         declarations.
7721         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7722         Input_objects pointer type parameter.
7723
7724 2009-10-30  Doug Kwan  <dougkwan@google.com>
7725
7726         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7727
7728 2009-10-28  Ian Lance Taylor  <iant@google.com>
7729
7730         * object.h (class Relobj): Drop options parameter from
7731         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7732         do_scan_relocs, do_relocate.  Change all callers.
7733         (class Sized_relobj): Drop options parameters from
7734         do_gc_process_relocs, do_scan_relocs, do_relocate,
7735         do_relocate_sections, relocate_sections, emit_relocs_scan,
7736         emit_relocs_scan_reltype.  Change all callers.
7737         (struct Relocate_info): Remove options field and all references to
7738         it.
7739         * reloc.h (class Read_relocs): Remove options constructor
7740         parameter and options_ field.  Change all callers.
7741         (class Gc_process_relocs, class Scan_relocs): Likewise.
7742         (class Relocate_task): Likewise.
7743         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7744         all callers.
7745         (scan_relocatable_relocs): Likewise.
7746         * target.h (class Sized_target): Remove options parameter from
7747         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7748         all callers.
7749         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7750         callers.
7751         * arm.cc: Update functions to remove options parameters.
7752         * i386.cc: Likewise.
7753         * powerpc.cc: Likewise.
7754         * sparc.cc: Likewise.
7755         * x86_64.cc: Likewise.
7756         * testsuite/testfile.cc: Likewise.
7757
7758 2009-10-28  Doug Kwan  <dougkwan@google.com>
7759
7760         * arm.cc (Arm_relobj): New class definition.
7761         (Arm_relobj::scan_sections_for_stubs,
7762         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7763         New method definitions.
7764
7765 2009-10-28  Cary Coutant  <ccoutant@google.com>
7766
7767         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7768         (Plugin::cleanup_done_): New member.
7769         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7770         (Plugin_manager::cleanup_done_): Remove.
7771         (Plugin_manager::add_input_file): Edit error message.
7772         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7773         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7774
7775 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7776
7777         * fileread.cc: (File_read::View::~View): Use the new
7778         data_ownership_ filed.
7779         (File_read::~File_read): Dispose the new whole_file_view_.
7780         (File_read::open): Mmap the whole file if needed.
7781         (File_read::open): Use whole_file_view_ instead of contents_.
7782         (File_read::find_view): Use whole_file_view_ if applicable.
7783         (File_read::do_read): Use whole_file_view_ instead of contents_.
7784         (File_read::make_view): Use whole_file_view_ instead of contents_,
7785         update File_read::View::View call.
7786         (File_read::find_or_make_view): Update File_read::View::View
7787         call.
7788         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7789         remove contents_
7790         (File_read::View::Data_ownership): New enum.
7791         (File_read::View::View): Replace bool mapped_ with Data_ownership
7792         argument.
7793         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7794         (File_read::View::data_ownership_): New field.
7795         (File_read::contents_): Remove (replaced by whole_file_view_).
7796         (File_read::whole_file_view_): New field.
7797         * options.h (class General_options): Add --keep-files-mapped.
7798
7799 2009-10-27  Cary Coutant  <ccoutant@google.com>
7800
7801         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7802         * testsuite/Makefile.am (plugin_test_5): New test case.
7803         * testsuite/Makefile.in: Regenerate.
7804
7805 2009-10-25  Doug Kwan  <dougkwan@google.com>
7806
7807         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7808         from private to protected to allow access by child class.
7809         (Sized_relobj::do_relocate_sections): New method declaration.
7810         (Sized_relobj::relocate_sections): Virtualize.
7811         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7812         Sized_relobj::relocate_sections.  Instantiate template explicitly
7813         for different target sizes and endianity.
7814
7815 2009-10-24  Doug Kwan  <dougkwan@google.com>
7816
7817         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7818         (Arm_input_section::as_arm_input_section): New method.
7819         (Arm_output_section): New class definition.
7820         (Arm_output_section::create_stub_group,
7821         Arm_output_section::group_sections): New method definitions.
7822
7823 2009-10-22  Doug Kwan  <dougkwan@google.com>
7824
7825         * arm.cc (Arm_input_section): New class definition.
7826         (Arm_input_section::init, Arm_input_section:do_write,
7827         Arm_input_section::set_final_data_size,
7828         Arm_input_section::do_reset_address_and_file_offset): New method
7829         definitions.
7830
7831 2009-10-21  Doug Kwan  <dougkwan@google.com>
7832
7833         * arm.cc (Stub_table, Arm_input_section): New forward class
7834         declarations.
7835         (Stub_table): New class defintion.
7836         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7837         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7838         New method definition.
7839
7840 2009-10-21  Doug Kwan  <dougkwan@google.com>
7841
7842         * arm.cc: Update copyright comments.
7843         (Target_arm): New forward class template declaration.
7844         (Arm_address): New type.
7845         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7846         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7847         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7848         constants.
7849         (Insn_template): Same.
7850         (DEF_STUBS): New macro.
7851         (Stub_type): New enum type.
7852         (Stub_template): New class definition.
7853         (Stub): Same.
7854         (Reloc_stub): Same.
7855         (Stub_factory): Same.
7856         (Target_arm::Target_arm): Initialize may_use_blx_ and
7857         should_force_pic_veneer_.
7858         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7859         Target_arm::should_force_pic_veneer,
7860         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7861         Target_arm::using_thumb_only, Target_arm:;default_target): New
7862         method defintions.
7863         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7864         New data member declarations.
7865         (Insn_template::size, Insn_template::alignment): New method defintions.
7866         (Stub_template::Stub_template): New method definition.
7867         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7868         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7869         (Stub_factory::Stub_factory): New method definition.
7870         * gold.h (string_hash): New template.
7871         * output.h (Input_section_specifier::hash_value): Use
7872         gold::string_hash.
7873         (Input_section_specifier::string_hash): Remove.
7874         * stringpool.cc (Stringpool_template::string_hash): Use
7875         gold::string_hash.
7876
7877 2009-10-20  Doug Kwan  <dougkwan@google.com>
7878
7879         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7880         symbols of relaxed input sections.
7881         * output.h (Output_section::find_relaxed_input_section): Make
7882         method public.
7883
7884 2009-10-16  Doug Kwan  <dougkwan@google.com>
7885
7886         * dynobj.cc (Versions::Versions): Initialize version_script_.
7887         Only insert base version symbol definition for a shared object
7888         if version script defines any version versions.
7889         (Versions::define_base_version): New method definition.
7890         (Versions::add_def): Check that base version is not needed.
7891         (Versions::add_need): Define base version lazily.
7892         * dynobj.h (Versions::define_base_version): New method declaration.
7893         (Versions::needs_base_version_): New data member declaration.
7894         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7895         (check_DATA): Add no_version_test.stdout.
7896         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7897         New make rules.
7898         * testsuite/Makefile.in: Regenerate.
7899         * testsuite/no_version_test.c: New file.
7900         * testsuite/no_version_test.sh: Ditto.
7901
7902 2009-10-16  Doug Kwan  <dougkwan@google.com>
7903
7904         * expression.cc (class Segment_start_expression): New class definition.
7905         (Segment_start_expression::value): New method definition.
7906         (script_exp_function_segment_start): Return a new
7907         Segment_start_expression.
7908         * gold/script-c.h (script_saw_segment_start_expression): New function
7909         prototype.
7910         * script-sections.cc (Script_sections::Script_sections): Initialize
7911         SAW_SEGMENT_START_EXPRESSION_ to false.
7912         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7913         and -Tbbs options to specify section addresses if given in
7914         command line and no SEGMENT_START expression is seen in a script.
7915         * script-sections.h (Script_sections::saw_segment_start_expression,
7916         Script_sections::set_saw_segment_start_expression): New method
7917         definition.
7918         (Script_sections::saw_segment_start_expression_): New data member
7919         declaration.
7920         * script.cc (script_saw_segment_start_expression): New function.
7921         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7922         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7923         script_test_7.sh and script_test_8.sh.
7924         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7925         script_test_8.stdout.
7926         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7927         (script_test_6, script_test_6.stdout, script_test_7,
7928         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7929         * Makefile.in: Regenerate.
7930         * testsuite/script_test_6.sh: New file.
7931         * testsuite/script_test_6.t: Same.
7932         * testsuite/script_test_7.sh: Same.
7933         * testsuite/script_test_7.t: Same.
7934         * testsuite/script_test_8.sh: Same.
7935
7936 2009-10-16  Doug Kwan  <dougkwan@google.com>
7937
7938         * output.cc (Output_segment::set_section_list_address): Cast
7939         expressions to unsigned long long type to avoid format warnings.
7940
7941 2009-10-15  Ian Lance Taylor  <iant@google.com>
7942
7943         * script.cc (Script_options::add_symbol_assignment): Always add a
7944         dot assignment to script_sections_.
7945         * script-sections.cc (Script_sections::add_dot_assignment):
7946         Initialize if necessary.
7947
7948         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7949         program headers with no load segment if there is a linker script.
7950
7951         * layout.cc (Layout::set_segment_offsets): Align the file offset
7952         to the segment aligment for -N or -n with no load segment.
7953         * output.cc (Output_segment::add_output_section): Don't crash if
7954         the first section is a TLS section.
7955         (Output_segment::set_section_list_addresses): Print an error
7956         message if the address moves backward in a linker script.
7957         * script-sections.cc
7958         (Output_section_element_input::set_section_addresses): Don't
7959         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7960         (Orphan_output_section::set_section_addresses): Likewise.
7961
7962 2009-10-15  Doug Kwan  <dougkwan@google.com>
7963
7964         * layout.cc (Layout::finish_dynamic_section): Generate tags
7965         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7966         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7967         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7968
7969 2009-10-14  Ian Lance Taylor  <iant@google.com>
7970
7971         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7972         fields.
7973         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7974         data_shdr fields of relinfo.
7975         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7976         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7977         R_386_TLS_LDO_32, adjust based on section flags.
7978         (Target_i386::Relocate::fix_up_ldo): Remove.
7979
7980 2009-10-13  Ian Lance Taylor  <iant@google.com>
7981
7982         Add support for -pie.
7983         * options.h (class General_options): Add -pie and
7984         --pic-executable.
7985         (General_options::output_is_position_independent): Test -pie.
7986         (General_options::output_is_executable): Return true if not shared
7987         and not relocatable.
7988         (General_options::output_is_pie): Remove.
7989         * options.cc (General_options::finalize): Reject incompatible uses
7990         of -pie.
7991         * gold.cc (queue_middle_tasks): A -pie link is not static.
7992         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7993         * symtab.cc (Symbol::final_value_is_known): Return false if
7994         output_is_position_independent.
7995         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7996         output_is_position_independent.
7997         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7998         output_is_position_independent.
7999         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8000         output_is_position_independent.
8001         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8002         two_file_pie_test.
8003         (basic_pie_test.o, basic_pie_test): New targets.
8004         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8005         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8006         (two_file_pie_test): New target.
8007         * testsuite/Makefile.in: Rebuild.
8008         * README: Remove note saying that -pie is not supported.
8009
8010 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8011
8012         * options.h (class General_options): Add -init and -fini.
8013         * layout.cc (Layout::finish_dynamic_section): Emit
8014         given init and fini functions.
8015
8016 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8017
8018         * gc.h (gc_process_relocs): Check if icf is enabled using new
8019         function.
8020         * gold.cc (queue_initial_tasks): Likewise.
8021         (queue_middle_tasks): Likewise.
8022         * object.cc (do_layout): Likewise.
8023         * symtab.cc (is_section_folded): Likewise.
8024         * main.cc (main): Likewise.
8025         * reloc.cc (Read_relocs::run): Likewise.
8026         (Sized_relobj::do_scan_relocs): Likewise.
8027         * icf.cc (is_function_ctor_or_dtor): New function.
8028         (Icf::find_identical_sections): Check if function is ctor or dtor when
8029         safe icf is chosen.
8030         * options.h (General_options::icf): Change option to be an enum.
8031         (Icf_status): New enum.
8032         (icf_enabled): New method.
8033         (icf_safe_folding): New method.
8034         (set_icf_status): New method.
8035         (icf_status_): New variable.
8036         * (options.cc) (General_options::finalize): Set icf_status_.
8037         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8038         icf_test and icf_keep_unique_test to use the --icf enum flag.
8039         * testsuite/icf_safe_test.sh: New file.
8040         * testsuite/icf_safe_test.cc: New file.
8041
8042 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8043
8044         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8045         includes to gc.h and icf.h.
8046         * arm.cc: Include gc.h.
8047         * gold.cc: Likewise.
8048         * i386.cc: Likewise.
8049         * powerpc.cc: Likewise.
8050         * sparc.cc: Likewise.
8051         * x86_64.cc: Likewise.
8052         * gc.h: Include icf.h.
8053
8054 2009-10-11  Ian Lance Taylor  <iant@google.com>
8055
8056         * plugin.cc: Include "gold.h" before other header files.
8057
8058 2009-10-10  Chris Demetriou  <cgd@google.com>
8059
8060         * options.h (Input_file_argument::Input_file_type): New enum.
8061         (Input_file_argument::is_lib_): Replace with...
8062         (Input_file_argument::type_): New member.
8063         (Input_file_argument::Input_file_argument): Take Input_file_type
8064         'type' rather than boolean 'is_lib' as second argument.
8065         (Input_file_argument::is_lib): Use type_.
8066         (Input_file_argument::is_searched_file): New function.
8067         (Input_file_argument::may_need_search): Handle is_searched_file.
8068         * options.cc (General_options::parse_library): Support -l:filename.
8069         (General_options::parse_just_symbols): Update for Input_file_argument
8070         changes.
8071         (Command_line::process): Likewise.
8072         * archive.cc (Archive::get_file_and_offset): Likewise.
8073         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8074         * script.cc (read_script_file, script_add_file): Likewise.
8075         * fileread.cc (Input_file::Input_file): Likewise.
8076         (Input_file::will_search_for): Handle is_searched_file.
8077         (Input_file::open): Likewise.
8078         * readsyms.cc (Read_symbols::get_name): Likewise.
8079         * testsuite/Makefile.am (searched_file_test): New test.
8080         * testsuite/Makefile.in: Regenerate.
8081         * testsuite/searched_file_test.cc: New file.
8082         * testsuite/searched_file_test_lib.cc: New file.
8083
8084 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8085             Ian Lance Taylor  <iant@google.com>
8086
8087         * descriptor.cc: Include <cstdio> and "binary-io.h".
8088         (Descriptors::open): Open the files in binary mode always.
8089         * script.cc (Lex::get_token): Treat \r as whitespace.
8090
8091 2009-10-09  Ian Lance Taylor  <iant@google.com>
8092
8093         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8094
8095 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8096             Ian Lance Taylor  <iant@google.com>
8097
8098         * configure.ac: Check for readv function also.
8099         * fileread.cc (readv): Define if not HAVE_READV.
8100         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8101         does not exist.
8102         * config.in: Regenerate.
8103         * configure: Regenerate.
8104
8105 2009-10-09  Doug Kwan  <dougkwan@google.com>
8106
8107         * layout.cc (Layout::make_output_section): Call target hook to make
8108         ordinary output section.
8109         (Layout::finalize): Adjust parameter list of call the
8110         Target::may_relax().
8111         * layout.h (class Layout::section_list): New method.
8112         * merge.h (Output_merge_base::entsize): Change visibility to public.
8113         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8114         New methods.
8115         (Output_merge_string::do_is_string): New method.
8116         * object.cc (Sized_relobj::do_setup): renamed from
8117         Sized_relobj::set_up.
8118         * object.h (Sized_relobj::adjust_shndx,
8119         Sized_relobj::initializ_input_to_output_maps,
8120         Sized_relobj::free_input_to_output_maps): Change visibilities to
8121         protected.
8122         (Sized_relobj::setup): Virtualize.
8123         (Sized_relobj::do_setup): New method declaration.
8124         (Sized_relobj::invalidate_section_offset,
8125         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8126         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8127         * options.cc (parse_int): New function.
8128         * options.h (parse_int): New declaration.
8129         (DEFINE_int): New macro.
8130         (stub_group_size): New option.
8131         * output.cc (Output_section::Output_section): Initialize memebers
8132         merge_section_map_, merge_section_by_properties_map_,
8133         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8134         (Output_section::add_input_section): Handled deferred code-fill
8135         generation and remove an old comment.
8136         (Output_section::add_relaxed_input_section): New method definition.
8137         (Output_section::add_merge_input_section): Use merge section by
8138         properties map to speed to search.  Update merge section maps
8139         as appropriate.
8140         (Output_section::build_relaxation_map): New method definition.
8141         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8142         Same.
8143         (Output_section::relax_input_section): Renamed to
8144         Output_section::convert_input_sections_to_relaxed_sections and change
8145         interface to take a vector of pointers to relaxed sections.
8146         (Output_section::find_merge_section,
8147         Output_section::find_relaxed_input_section): New method definitions.
8148         (Output_section::is_input_address_mapped,
8149         Output_section::output_offset, Output_section::output_address):
8150         Use output section data maps to speed up searching.
8151         (Output_section::find_starting_output_address): Add comments.
8152         (Output_section::do_write,
8153         Output_section::write_to_postprocessing_buffer): Do code-fill
8154         generation as appropriate.
8155         (Output_section::get_input_sections): Invalidate relaxed input section
8156         map.
8157         (Output_section::restore_states): Adjust type of checkpoint .
8158         Invalidate relaxed input section map.
8159         * output.h (Output_merge_base): New class declaration.
8160         (Input_section_specifier): New class defintion.
8161         (class Output_relaxed_input_section) Change base class to
8162         Output_section_data_build.
8163         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8164         base class initializer.
8165         (Output_section::add_relaxed_input_section): New method declaration.
8166         (Output_section::Input_section): Change visibility to protected.
8167         (Output_section::Input_section::relobj,
8168         Output_section::Input_section::shndx): Handle relaxed input sections.
8169         Output_section::input_sections) Change visibility to protected.  Also
8170         define overload to return a non-const pointer.
8171         (Output_section::Merge_section_properties): New class defintion.
8172         (Output_section::Merge_section_by_properties_map,
8173         Output_section::Output_section_data_by_input_section_map,
8174         Output_section::Relaxation_map): New types.
8175         (Output_section::relax_input_section): Rename method to
8176         Output_section::convert_input_sections_to_relaxed_sections and change
8177         interface to take a vector of relaxed section pointers.
8178         (Output_section::find_merge_section,
8179         Output_section::find_relaxed_input_section,
8180         Output_section::build_relaxation_map,
8181         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8182         New method declarations.
8183         (Output_section::merge_section_map_
8184         Output_section::merge_section_by_properties_map_,
8185         Output_section::relaxed_input_section_map_,
8186         Output_section::is_relaxed_input_section_map_valid_,
8187         Output_section::generate_code_fills_at_write_): New data members.
8188         * script-sections.cc
8189         (Output_section_element_input::set_section_addresses): Call
8190         current_data_size and addralign methods of relaxed input sections.
8191         (Orphan_output_section::set_section_addresses): Call current_data_size
8192         and addralign methods of relaxed input sections.
8193         * symtab.cc (Symbol_table::compute_final_value): Extract template
8194         from the body of Symbol_table::sized_finalize_symbol.
8195         (Symbol_table::sized_finalized_symbol): Call
8196         Symbol_table::compute_final_value.
8197         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8198         (Symbol_table::compute_final_value): New templated method declaration.
8199         * target.cc (Target::do_make_output_section): New method defintion.
8200         * target.h (Target::make_output_section): New method declaration.
8201         (Target::relax): Add more parameters for input objects, symbol table
8202         and layout.  Adjust call to do_relax.
8203         (Target::do_make_output_section): New method declaration.
8204         (Target::do_relax): Add parameters for input objects, symbol table
8205         and layout.
8206
8207 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8208
8209         * pread.c: Include stdio.h.
8210
8211 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8212
8213         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8214         defined.
8215
8216 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8217
8218         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8219         Change read_shndx type to unsigned int.
8220         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8221         int.
8222         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8223         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8224         Change read_shndx type to unsigned int.
8225         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8226         int.
8227         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8228         * layout.cc (Layout::create_symtab_sections): Cast the result of
8229         local_symcount * symsize to off_t in the gold_assert.
8230
8231 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8232
8233         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8234         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8235         R_ARM_BASE_ABS.
8236         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8237         (Arm_relocate_functions::thm_abs5): New function.
8238         (Arm_relocate_functions::abs12): New function.
8239         (Arm_relocate_functions::abs16): New function.
8240         (Arm_relocate_functions::base_abs): New function.
8241         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8242         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8243         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8244         R_ARM_BASE_ABS.
8245         (Scan::global): Likewise.
8246         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8247         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8248         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8249         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8250         R_ARM_BASE_ABS.
8251
8252 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8253
8254         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8255         (Arm_relocate_functions::movt_prel): New function.
8256         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8257         (Arm_relocate_functions::thm_movt_prel): New function.
8258         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8259         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8260         (Scan::global, Relocate::relocate): Likewise.
8261         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8262
8263 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8264
8265         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8266         Incremental_checker.
8267         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8268         unsigned int.
8269         (class Incremental_inputs_header): New class.
8270         (Incremental_inputs_header_writer): Edit comment.
8271         (Incremental_inputs_entry): New class.
8272         (Incremental_inputs_entry_writer): Edit comment.
8273         (Sized_incremental_binary::do_find_incremental_inputs_section):
8274         Add *strtab_shndx parameter, fill it.
8275         (Sized_incremental_binary::do_check_inputs): New method.
8276         (Incremental_checker::can_incrementally_link_output_file): Use
8277         Sized_incremental_binary::check_inputs.
8278         (Incremental_inputs::report_command_line): Save command line in
8279         command_line_.
8280         * incremental.h:
8281         (Incremental_binary::find_incremental_inputs_section): New
8282         method.
8283         (Incremental_binary::do_find_incremental_inputs_section): Add
8284         strtab_shndx parameter.
8285         (Incremental_binary::do_check_inputs): New pure virtual method.
8286         (Sized_incremental_binary::do_check_inputs): Declare.
8287         (Incremental_checker::Incremental_checker): Add incremental_inputs
8288         parameter, use it to initialize incremental_inputs_.
8289         (Incremental_checker::incremental_inputs_): New field.
8290         (Incremental_checker::command_line): New method.
8291         (Incremental_checker::inputs): New method.
8292         (Incremental_checker::command_line_): New field.
8293
8294 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8295
8296         * incremental.cc: Include <cstdarg> and "target-select.h".
8297         (vexplain_no_incremental): New function.
8298         (explain_no_incremental): New function.
8299         (Incremental_binary::error): New method.
8300         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8301         method.
8302         (make_sized_incremental_binary): New function.
8303         (open_incremental_binary): New function.
8304         (can_incrementally_link_file): Add checks if output is ELF and has
8305         inputs section.
8306         * incremental.h: Include "elfcpp_file.h" and "output.h".
8307         (Incremental_binary): New class.
8308         (Sized_incremental_binary): New class.
8309         (open_incremental_binary): Declare.
8310         * object.cc (is_elf_object): Use
8311         elfcpp::Elf_recognizer::is_elf_file.
8312         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8313         * output.h (Output_file::filesize): New method.
8314
8315 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8316
8317         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8318         New function.
8319         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8320         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8321         function.
8322         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8323         function.
8324         (Arm_relocate_functions::movw_abs_nc): New function.
8325         (Arm_relocate_functions::movt_abs): New function.
8326         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8327         (Arm_relocate_functions::thm_movt_abs): New function.
8328         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8329         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8330         (Scan::global): Likewise.
8331         (Relocate::relocate): Likewise.
8332         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8333
8334 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8335
8336         * arm.cc (Arm_relocate_functions::got_prel) New function.
8337         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8338         (Relocate::relocate): Likewise.
8339         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8340
8341 2009-10-06  Ian Lance Taylor  <iant@google.com>
8342
8343         * options.h (class General_options): Define
8344         split_stack_adjust_size parameter.
8345         * object.h (class Object): Add uses_split_stack_ and
8346         has_no_split_stack_ fields.  Add uses_split_stack and
8347         has_no_split_stack accessor functions.  Declare
8348         handle_split_stack_section.
8349         (class Reloc_symbol_changes): Define.
8350         (class Sized_relobj): Define Function_offsets.  Declare
8351         split_stack_adjust, split_stack_adjust_reltype, and
8352         find_functions.
8353         * object.cc (Object::handle_split_stack_section): New function.
8354         (Sized_relobj::do_layout): Call handle_split_stack_section.
8355         * dynobj.cc (Sized_dynobj::do_layout): Call
8356         handle_split_stack_section.
8357         * reloc.cc (Sized_relobj::relocate_sections): Call
8358         split_stack_adjust for executable sections in split_stack
8359         objects.  Pass reloc_map to relocate_section.
8360         (Sized_relobj::split_stack_adjust): New function.
8361         (Sized_relobj::split_stack_adjust_reltype): New function.
8362         (Sized_relobj::find_functions): New function.
8363         * target-reloc.h: Include "object.h".
8364         (relocate_section): Add reloc_symbol_changes parameter.  Change
8365         all callers.
8366         * target.h (class Target): Add calls_non_split method.  Declare
8367         do_calls_non_split virtual method.  Declare match_view and
8368         set_view_to_nop.
8369         * target.cc: Include "elfcpp.h".
8370         (Target::do_calls_non_split): New function.
8371         (Target::match_view): New function.
8372         (Target::set_view_to_nop): New function.
8373         * gold.cc (queue_middle_tasks): Give an error if mixing
8374         split-stack and non-split-stack objects with -r.
8375         * i386.cc (Target_i386::relocate_section): Add
8376         reloc_symbol_changes parameter.
8377         (Target_i386::do_calls_non_split): New function.
8378         * x86_64.cc (Target_x86_64::relocate_section): Add
8379         reloc_symbol_changes parameter.
8380         (Target_x86_64::do_calls_non_split): New function.
8381         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8382         parameter.
8383         * powerpc.cc (Target_powerpc::relocate_section): Add
8384         reloc_symbol_changes parameter.
8385         * sparc.cc (Target_sparc::relocate_section): Add
8386         reloc_symbol_changes parameter.
8387         * configure.ac: Call AM_CONDITIONAL for the default target.
8388         * configure: Rebuild.
8389         * testsuite/Makefile.am (TEST_AS): New variable.
8390         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8391         (check_DATA): Add split_i386 and split_x86_64 files.
8392         (SPLIT_DEFSYMS): Define.
8393         (split_i386_[1234n].o): New targets.
8394         (split_i386_[124]): New targets.
8395         (split_i386_[1234r].stdout): New targets.
8396         (split_x86_64_[1234n].o): New targets.
8397         (split_x86_64_[124]): New targets.
8398         (split_x86_64_[1234r].stdout): New targets.
8399         (MOSTLYCLEANFILES): Add new executables.
8400         * testsuite/split_i386.sh: New file.
8401         * testsuite/split_x86_64.sh: New file.
8402         * testsuite/split_i386_1.s: New file.
8403         * testsuite/split_i386_2.s: New file.
8404         * testsuite/split_i386_3.s: New file.
8405         * testsuite/split_i386_4.s: New file.
8406         * testsuite/split_i386_n.s: New file.
8407         * testsuite/split_x86_64_1.s: New file.
8408         * testsuite/split_x86_64_2.s: New file.
8409         * testsuite/split_x86_64_3.s: New file.
8410         * testsuite/split_x86_64_4.s: New file.
8411         * testsuite/split_x86_64_n.s: New file.
8412         * testsuite/testfile.cc (Target_test): Update relocation_section
8413         function.
8414         * testsuite/Makefile.in: Rebuild.
8415
8416 2009-10-06  Ian Lance Taylor  <iant@google.com>
8417
8418         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8419         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8420         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8421         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8422         the address on ldo_addrs_.
8423         (Target_i386::Relocate::fix_up_ldo): New function.
8424
8425 2009-10-06   Rafael Espindola  <espindola@google.com>
8426
8427         * plugin.cc (add_input_library): New.
8428         (Plugin::load): Add add_input_library to tv.
8429         (Plugin_manager::add_input_file): Add the is_lib argument.
8430         (add_input_file): Update call to Plugin_manager::add_input_file.
8431         (add_input_library): New.
8432         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8433
8434 2009-09-30  Doug Kwan  <dougkwan@google.com>
8435
8436         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8437         symbol and call Symbol::may_need_copy_reloc to determine if
8438         a copy reloc is needed.
8439         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8440         nocopyreloc is given in command line.
8441         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8442         given in command line.
8443         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8444         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8445         of the removed Target_i386::may_need_copy_reloc.
8446         * options.h (copyreloc): New option with default value false.
8447         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8448         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8449         instead of the removed Target_powerpc::may_need_copy_reloc.
8450         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8451         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8452         instead of the removed Target_sparc::may_need_copy_reloc.
8453         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8454         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8455         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8456         instead of the removed Target_x86_64::may_need_copy_reloc.
8457
8458 2009-09-30  Ian Lance Taylor  <iant@google.com>
8459
8460         * object.h (class Object): Remove target_ field, and target,
8461         sized_target, and set_target methods.
8462         (Object::sized_target): Remove.
8463         (class Sized_relobj): Update declarations.  Remove sized_target.
8464         * object.cc (Sized_relobj::setup): Remove target parameter.
8465         Change all callers.
8466         (Input_objects::add_object): Don't do anything with the target.
8467         (make_elf_sized_object): Add punconfigured parameter.  Change all
8468         callers.  Set or test parameter target.
8469         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8470         Change all callers.
8471         * parameters.cc (Parameters::set_target): Change parameter type to
8472         be non-const.
8473         (Parameters::default_target): Remove.
8474         (set_parameters_target): Change parameter type to be non-const.
8475         (parameters_force_valid_target): New function.
8476         (parameters_clear_target): New function.
8477         * parameters.h (class Parameters): Update declarations.  Remove
8478         default_target method.  Add sized_target and clear_target
8479         methods.  Change target_ to be non-const.
8480         (set_parameters_target): Update declaration.
8481         (parameters_force_valid_target): Declare.
8482         (parameters_clear_target): Declare.
8483         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8484         as NULL if we aren't searching.
8485         (Add_symbols::run): Don't check for compatible target.
8486         * fileread.cc (Input_file::open_binary): Call
8487         parameters_force_valid_target.
8488         * gold.cc (queue_middle_tasks): Likewise.
8489         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8490         set_target on object.
8491         * dynobj.h (class Sized_dynobj): Update declarations.
8492         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8493         make_elf_object returns NULL.
8494         (Archive::include_member): Don't check whether object target is
8495         compatible.
8496         * output.cc (Output_section::add_input_section): Get target from
8497         parameters.
8498         (Output_section::relax_input_section): Likewise.
8499         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8500         parameters.
8501         (Sized_relobj::do_scan_relocs): Likewise.
8502         (Sized_relobj::relocate_sections): Likewise.
8503         * resolve.cc (Symbol_table::resolve): Likewise.
8504         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8505         parameter.  Change all callers.
8506         (Symbol_table::add_from_object): Get target from parameters.
8507         (Symbol_table::add_from_relobj): Don't check object target.
8508         (Symbol_table::add_from_dynobj): Likewise.
8509         (Symbol_table::define_special_symbol): Get target from
8510         parameters.
8511         * symtab.h (class Symbol_table): Update declaration.
8512         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8513         parameter.  Change all callers.  Clear parameter target.
8514         (Binary_test): Test target here.
8515         * testsuite/object_unittest.cc (gold_testsuite): Remove
8516         target_test_pointer parameter.  Change all callers.
8517         (Object_test): Test target here.
8518
8519 2009-09-26  Ian Lance Taylor  <iant@google.com>
8520
8521         * testsuite/initpri1.c: Don't try to use constructor priorities if
8522         compiling with gcc before 4.3.
8523
8524 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8525
8526         * testsuite/retain_symbols_file_test.sh (check_present): Change
8527         output file name to retain_symbols_file_test.stdout.
8528         (check_absent): Likewise.
8529
8530 2009-09-18  Craig Silverstein  <csilvers@google.com>
8531
8532         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8533         * options.cc: Include <cerrno> and <fstream>.
8534         (General_options::finalize): Parse -retain-symbols-file tag.
8535         * options.h: New flag.
8536         (General_options): New method should_retain_symbol, new
8537         variable symbols_to_retain.
8538         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8539         should_retain_symbol map.
8540         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8541         * testsuite/Makefile.in: Regenerate.
8542         * testsuite/retain_symbols_file_test.sh: New file.
8543
8544 2009-09-18  Nick Clifton  <nickc@redhat.com>
8545
8546         * po/es.po: Updated Spanish translation.
8547
8548 2009-09-17  Doug Kwan  <dougkwan@google.com>
8549
8550         * debug.h (DEBUG_RELAXATION): New constant.
8551         (DEBUG_ALL): Add DEBUG_RELAXATION.
8552         (debug_string_to_enum): Add relaxation debug option.
8553         * layout.cc
8554         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8555         Layout::Relaxation_debug_check::read_sections,
8556         Layout::Relaxation_debug_check::read_sections): New method definitions.
8557         (Layout::Layout): Initialize data members
8558         record_output_section_data_from_scrips_,
8559         script_output_section_data_list_ and relaxation_debug_check_.
8560         (Layout::save_segments, Layout::restore_segments,
8561         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8562         Layout::relaxation_loop_body): New method definitions.
8563         (Layout::finalize): Support relaxation.  Move section layout code to
8564         Layout::relaxation_loop_body.
8565         (Layout::set_asection_address_from_script): Move code for orphan
8566         section placement out.
8567         (Layout::place_orphan_sections_in_script): New method definition.
8568         * layout.h (Output_segment_headers, Output_file_header):
8569         New forward class declarations.
8570         (Layout::~Layout): Define.
8571         (Layout::new_output_section_data_from_script): New method definition.
8572         (Layout::place_orphan_sections_in_script): New method declaration.
8573         (Layout::Segment_states): New type declaration.
8574         (Layout::save_segments, Layout::restore_segments,
8575         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8576         Layout::relaxation_loop_body): New method declarations.
8577         (Layout::Output_section_data_list): New type declaration.
8578         (Layout::Relaxation_debug_check): New class definition.
8579         (Layout::record_output_section_data_from_script_,
8580         Layout::script_output_section_data_list_, Layout::segment_states_,
8581         Layout::relaxation_debug_check_): New data members.
8582         * output.cc: (Output_section_headers::do_size): New method definition.
8583         (Output_section_headers::Output_section_headers): Move size
8584         computation to Output_section_headers::do_size.
8585         (Output_segment_headers::do_size): New method definition.
8586         (Output_file_header::Output_file_header): Move size computation to
8587         Output_file_header::do_size and call it.
8588         (Output_file_header::do_size): New method definition.
8589         (Output_data_group::Output_data_group): Adjust call to
8590         Output_section_data.
8591         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8592         (Output_symtab_xindex::do_write): Add array bound check.
8593         (Output_section::Input_section::print_to_mapfile): Handle
8594         RELAXED_INPUT_SECTION_CODE.
8595         (Output_section::Output_section): Initialize data member checkpoint_.
8596         (Output_section::~Output_section): Delete checkpoint object pointed
8597         by checkpoint_.
8598         (Output_section::add_input_section): Always add an Input_section if
8599         relaxing.
8600         (Output_section::add_merge_input_section): Add assert.
8601         (Output_section::relax_input_section): New method definition.
8602         (Output_section::set_final_data_size): Set load address to zero for
8603         an unallocated section.
8604         (Output_section::do_address_and_file_offset_have_reset_values):
8605         New method definition.
8606         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8607         Handle relaxed input section.
8608         (Output_section::sort_attached_input_sections): Checkpoint input
8609         section list lazily.
8610         (Output_section::get_input_sections): Change type of input_sections to
8611         list of Simple_input_section pointers.  Checkpoint input section list
8612         lazily.  Also handle relaxed input sections.
8613         (Output_section::add_input_section_for_script): Take a reference to
8614         a Simple_input_section object instead of Relobj pointer and section
8615         index as parameter.  Handle relaxed input sections.
8616         (Output_section::save_states, Output_section::restore_states): New
8617         method definitions.
8618         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8619         (Output_data::is_data_size_fixed): New method definition.
8620         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8621         if it is fixed.
8622         (Output_data::address_and_file_offset_have_reset_values): New method
8623         definition.
8624         (Output_data::do_address_and_file_offset_have_reset_values): New method
8625         definition.
8626         (Output_data::set_data_size): Check that data size is not fixed.
8627         (Output_data::fix_data_size): New method definition.
8628         (Output_data::is_data_size_fixed_): New data member.
8629         (Output_section_headers::set_final_data_size): New method definition.
8630         (Output_section_headers::do_size): New method declaration.
8631         (Output_segment_headers::set_final_data_size): New method definition.
8632         (Output_segment_headers::do_size): New method declaration.
8633         (Output_file_header::set_final_data_size)::New method definition.
8634         (Output_file_header::do_size)::New method declaration.
8635         (Output_section_data::Output_section_data): Add new parameter
8636         is_data_size_fixed and use it to fix data size.
8637         (Output_data_const::Output_data_const): Adjust call to base class
8638         constructor and fix data size.
8639         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8640         base class constructor and fix data size.
8641         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8642         base class constructor and fix data size.
8643         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8644         class constructor and fix data size.
8645         (Output_data_group::set_final_data_size): New method definition.
8646         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8647         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8648         class constructor and fix data size.
8649         (Output_relaxed_input_section): New class definition.
8650         (Output_section::Simple_input_section): New class definition.
8651         (Output_section::get_input_sections): Adjust parameter list.
8652         (Output_section::add_input_section_for_script): Same.
8653         (Output_section::save_states, Output_section::restore_states,
8654         Output_section::do_address_and_file_offset_have_reset_values,
8655         (Output_section::Input_section::Input_section): Handle
8656         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8657         Output_relaxed_input_section.
8658         (Output_section::Input_section::is_input_section,
8659         Output_section::Input_section::set_output_section): Handle relaxed
8660         input section.
8661         (Output_section::Input_section::is_relaxed_input_section,
8662         Output_section::Input_section::output_section_data,
8663         Output_section::Input_section::relaxed_input_section): New method
8664         definitions.
8665         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8666         value.
8667         (Output_section::Input_section::u1_): Update comments.
8668         (Output_section::Input_section::u2_): Add new union member poris.
8669         (Output_section::Checkpoint_output_section): New classs definition.
8670         (Output_section::relax_input_section): New method declaration.
8671         (Output_section::checkpoint_): New data member.
8672         (Output_segment): Update comments.
8673         (Output_segment::Output_segment): Un-privatize copy constructor.
8674         (Output_segment::operator=): Un-privatize.
8675         * script-sections.cc (Output_section_element::Input_section_list):
8676         Change element type to Output_section::Simple_input_section.
8677         (Output_section_element_dot_assignment::set_section_addresses):
8678         Register output section data for relaxation clean up.
8679         (Output_data_exression::Output_data_expression): Adjust call to base
8680         constructor to fix data size.
8681         (Output_section_element_data::set_section_addresses): Register
8682         Output_data_expression object for relaxation clean up.
8683         (struct Input_section_info): Replace Relobj pointer and section index
8684         pair with Output_section::Simple_input_section and Convert struct to a
8685         class.
8686         (Input_section_sorter::operator()): Adjust access to
8687         Input_section_info data member to use accessors.
8688         (Output_section_element_input::set_section_addresses): Use layout
8689         parameter.  Adjust code to use Output_section::Simple_input_section
8690         and Input_secction_info classes.  Register filler for relaxation
8691         clean up.
8692         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8693         and section index pair with Output_section::Simple_input_section
8694         class.  Adjust code accordingly.
8695         (Phdrs_element::release_segment): New method definition.
8696         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8697         segment list.
8698         (Script_sections::release_segments): New method definition.
8699         * gold/script-sections.h (Script_sections::release_segments): New
8700         method declaration.
8701         * gold/target.h (Target::may_relax, Target::relax,
8702         Target::do_may_relax, Target::do_relax): New method definitions.
8703
8704 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8705
8706         * arm.cc (has_signed_unsigned_overflow): New function.
8707         (Arm_relocate_functions::abs8): New function.
8708         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8709         (Target_arm::Scan::global): Likewise.
8710         (Target_arm::relocate::relocate): Likewise.
8711         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8712         Likewise.
8713
8714 2009-09-16  Cary Coutant  <ccoutant@google.com>
8715
8716         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8717         * testsuite/Makefile.in: Regenerate.
8718
8719 2009-09-11  Nick Clifton  <nickc@redhat.com>
8720
8721         * po/gold.pot: Updated by the Translation project.
8722
8723 2009-09-08  Cary Coutant  <ccoutant@google.com>
8724
8725         * output.cc (Output_file::open): Add execute permission to empty file.
8726         * testsuite/Makefile.am (permission_test): New test.
8727         * testsuite/Makefile.in: Regenerate.
8728
8729 2009-09-02  Ian Lance Taylor  <iant@google.com>
8730
8731         * output.cc (Output_file::resize): Call map_no_anonymous rather
8732         than map.
8733
8734 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8735
8736         * gold.cc: Include "incremental.h".
8737         (queue_initial_tasks): Call Incremental_checker methods.
8738         * incremental.cc: Include "output.h".
8739         (Incremental_checker::can_incrementally_link_output_file): New
8740         method.
8741         * incremental.h (Incremental_checker): New class.
8742
8743         * output.cc (Output_file::open_for_modification): New method.
8744         (Output_file::map_anonymous): Changed return type to bool.  Record
8745         map in base_ field.
8746         (Output_file::map_no_anonymous): New method, broken out of map.
8747         (Output_file::map): Use map_no_anonymous and map_anonymous.
8748         * output.h (class Output_file): Update declarations.
8749
8750 2009-08-24  Cary Coutant  <ccoutant@google.com>
8751
8752         * options.h (Command_line::Pre_options): New class.
8753         (Command_line::pre_options): New member.
8754         * options.cc (gold::options::ready_to_register): New variable.
8755         (One_option::register_option): Do nothing if not registering options.
8756         Assert if same short option registered twice.
8757         (General_options::General_options): Turn off option registration when
8758         done constructing.
8759         (Command_line::Pre_options::Pre_options): New constructor.
8760
8761 2009-08-24  Cary Coutant  <ccoutant@google.com>
8762
8763         * options.h (General_options::no_keep_memory): Remove incorrect
8764         short option.
8765
8766 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8767
8768         * Makefile.am (am__skiplex, am__skipyacc): New.
8769         * Makefile.in: Regenerate.
8770
8771 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8772
8773         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8774         (INCLUDES): ... this.
8775         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8776         (AM_CPPFLAGS): Renamed from ...
8777         (INCLUDE): ... this.
8778         * Makefile.in, testsuite/Makefile.in: Regenerate.
8779
8780         * Makefile.in: Regenerate.
8781         * aclocal.m4: Likewise.
8782         * config.in: Likewise.
8783         * configure: Likewise.
8784         * testsuite/Makefile.in: Likewise.
8785
8786         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8787         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8788         * Makefile.in: Regenerate.
8789         * testsuite/Makefile.in: Regenerate.
8790
8791 2009-08-19  Cary Coutant  <ccoutant@google.com>
8792
8793         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8794         symbols in shared libraries overridden by hidden or internal symbols
8795         in the main program.
8796
8797 2009-08-19  Chris Demetriou  <cgd@google.com>
8798
8799         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8800         checking source file names in error messages.
8801
8802 2009-08-18  Doug Kwan  <dougkwan@google.com>
8803
8804         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8805         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8806         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8807         an elfcpp::Ehdr as parameter.
8808         * object.cc (Object::set_target): Remove the version that looks up
8809         a target and sets it.
8810         (Sized_relobj::setup): Take a Target object instead of
8811         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8812         (make_elf_sized_object): Find target and ask target to
8813         make an ELF object.
8814         * object.h: (Object::set_target): Remove the version that looks up
8815         a target and sets it.
8816         (Sized_relobj::setup): Take a Target object instead of
8817         an elfcpp:Ehdr as parameter.
8818         * target.cc: Include dynobj.h.
8819         (Target::do_make_elf_object_implementation): New.
8820         (Target::do_make_elf_object): New.
8821         * target.h (Target::make_elf_object): New template declaration.
8822         (Target::do_make_elf_object): New method declarations.
8823         (Target::do_make_elf_object_implementation): New template declaration.
8824
8825 2009-08-14  Ian Lance Taylor  <iant@google.com>
8826
8827         * gold.h (FUNCTION_NAME): Define.
8828         (gold_unreachable): Use FUNCTION_NAME.
8829
8830 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8831
8832         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8833         symbol in the --keep-unique list is not found.
8834
8835 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8836
8837         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8838         been maked as --keep-unique.
8839         (Icf::unfold_section): New function.
8840         * icf.h (Icf::unfold_section): New function.
8841         * options.h (General_options::keep_unique): New option.
8842         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8843         * testsuite/Makefile.in: Regenerate.
8844         * testsuite/icf_keep_unique_test.sh: New file.
8845         * testsuite/icf_keep_unique_test.cc: New file.
8846
8847 2009-08-12  Cary Coutant  <ccoutant@google.com>
8848
8849         PR 10471
8850         * resolve.cc (Symbol_table::resolve): Check for references from
8851         dynamic objects to hidden and internal symbols.
8852         * testsuite/Makefile.am (hidden_test.sh): New test.
8853         * testsuite/Makefile.in: Regenerate.
8854         * testsuite/hidden_test.sh: New script.
8855         * testsuite/hidden_test_1.c: New test source.
8856         * testsuite/hidden_test_main.c: New test source.
8857
8858 2009-08-11  Doug Kwan  <dougkwan@google.com>
8859
8860         * arm.cc: Update comments.
8861         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8862         segment to locate the .ARM.exidx section if present.
8863
8864 2009-08-09  Doug Kwan  <dougkwan@google.com>
8865
8866         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8867         patch.
8868
8869 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8870         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8871         compiler warnings.
8872
8873 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8874
8875         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8876         valid tls_segment only for non-debug-section relocations.
8877         * testsuite/Makefile.am: Add gc_tls_test.
8878         * testsuite/Makefile.in: Regenerate.
8879         * testsuite/gc_tls_test.cc: New file.
8880         * testsuite/gc_tls_test.sh: New file.
8881
8882 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8883
8884         * icf.cc: New file.
8885         * icf.h: New file.
8886         * Makefile.am (CCFILES): Add icf.cc.
8887         (HFILES): Add icf.h
8888         * Makefile.in: Regenerate.
8889         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8890         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8891         section, symbol and addend information for the relocs.
8892         * gold.cc (queue_middle_tasks): Call identical code folding.
8893         * gold.h: Add defines for multimap.
8894         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8895         to the call of finalize_local_symbols.
8896         * main.cc (main): Create object of class Icf.
8897         * object.cc (Sized_relobj::do_layout): Allow this function to be
8898         called twice during icf.
8899         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8900         to sections marked as identical by icf.
8901         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8902         when available.
8903         (Sized_relobj::do_section_entsize): New function.
8904         * object.h (Object::section_entsize): New function.
8905         (Object::do_section_entsize): New pure virtual function.
8906         (Relobj::finalize_local_symbols): Add new parameter.
8907         (Relobj::do_section_entsize): New function.
8908         * options.h (General_options::icf): New option.
8909         (General_options::icf_iterations): New option.
8910         (General_options::print_icf_sections): New option.
8911         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8912         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8913         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8914         icf.
8915         * symtab.cc (Symbol_table::is_section_folded): New function.
8916         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8917         to sections marked as identical by icf.
8918         * symtab.h (Symbol_table::set_icf): New function.
8919         (Symbol_table::icf): New function.
8920         (Symbol_table::is_section_folded): New function.
8921         (Symbol_table::icf_): New data member.
8922         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8923         * testsuite/Makefile.am: Add commands to build icf_test.
8924         * testsuite/Makefile.in: Regenerate.
8925         * testsuite/icf_test.sh: New file.
8926         * testsuite/icf_test.cc: New file.
8927
8928 2009-07-24  Chris Demetriou  <cgd@google.com>
8929
8930         * layout.cc (is_compressible_debug_section): Fix incorrect
8931         comment about compressed section names.
8932
8933 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8934
8935         PR 10419
8936         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8937
8938 2009-07-16  Ian Lance Taylor  <iant@google.com>
8939
8940         PR 10400
8941         * layout.h: #include <map>.
8942         (class Kept_section): Change from struct to class.  Add accessors
8943         and setters.  Add section size to Comdat_group mapping.  Change
8944         Comdat_group to std::map.  Add is_comdat_ field.  Add
8945         linkonce_size field in union.
8946         (class Layout): Update declaration of find_or_add_kept_section.
8947         Don't declare find_kept_object.
8948         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8949         parameter.  Add object, shndx, is_comdat, and is_group_name
8950         parameters.  Change all callers.  Adjust for new Kept_section.
8951         (Layout::find_kept_object): Remove.
8952         * object.cc (Sized_relobj::include_section_group): Update use of
8953         Kept_section.  Rename secnum to shndx.  Only record
8954         Kept_comdat_section if sections are the same size.
8955         (Sized_relobj::include_linkonce_section): Update use of
8956         Kept_section.  Only record Kept_comdat_section if sections are the
8957         same size.  Set size of linkonce section.
8958         (Sized_relobj::map_to_kept_section): Update call to
8959         get_kept_comdat_section.
8960         * object.h (class Sized_relobj): Rename fields in
8961         Kept_comdat_section to drop trailing underscores; change object
8962         field to Relobj*.  Change Kept_comdat_section_table to store
8963         struct rather than pointer.
8964         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8965         Add kept_object and kept_shndx parameters.  Change all callers.
8966         (Sized_relobj::get_kept_comdat_section): Change return type to
8967         bool.  Add kept_object and kept_shndx parameters.  Change all
8968         callers.
8969         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8970         Layout::find_or_add_kept_section.
8971
8972 2009-07-09  Ian Lance Taylor  <iant@google.com>
8973
8974         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8975         Reserve space in the hash table.
8976
8977 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8978
8979         * fileread.cc (File_read::get_mtime): New method.
8980         * fileread.h (Timespec): New structure.
8981         (File_read::get_mtime): New method.
8982         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8983         Renamed from timestamp_nsec.
8984         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8985         Elf_Xword.
8986         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8987         timestamp_nsec.
8988         (Incremental_inputs::report_archive): Save mtime; style fix.
8989         (Incremental_inputs::report_obejct): Save mtime; style fix.
8990         (Incremental_inputs::report_script): Save mtime; style fix.
8991         (Incremental_inputs::finalize_inputs): Style fix.
8992         (Incremental_inputs::finalize): Style fix.
8993         (Incremental_inputs::create_input_section_data): Store inputs
8994         mtime.
8995         * incremental.h (Incremental_inputs::report_script): Add mtime
8996         argument.
8997         (Incremental_inputs::Input_info::Input_info): Intialize only one
8998         union member.
8999         (Incremental_inputs::Input_info::archive): Move to nameless
9000         union.
9001         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9002         (Incremental_inputs::Input_info::script): Move to nameless union.
9003         (Incremental_inputs::mtime): New field.
9004         * script.cc (read_input_script): Pass file mtime to
9005         Incremental_input.
9006         * script.h (Script_info::inputs): Style fix.
9007
9008 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9009
9010         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9011         instead of 32.
9012
9013 2009-06-24  Ian Lance Taylor  <iant@google.com>
9014
9015         PR 10156
9016         * layout.cc (Layout::choose_output_section): If we find an
9017         existing section, update the flags.
9018         (Layout::create_notes): New function, broken out of
9019         Layout::finalize.
9020         (Layout::finalize): Don't create note sections.
9021         (Layout::create_note): Don't crash if linker script discards
9022         section.
9023         (Layout::create_gold_note): Likewise.
9024         (Layout::create_build_id): Likewise.  Don't set
9025         after_input_sections on the section.
9026         (Layout::create_executable_stack_info): Remove target parameter.
9027         Change caller.
9028         * layout.h (class Layout): Declare create_notes.  Update
9029         declaration of create_executable_stack_info.
9030         * gold.cc (queue_middle_tasks): Call create_notes.
9031         * output.cc (Output_section::update_flags_for_input_section): Move
9032         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9033         invalid.
9034         * output.h (Output_data::mark_address_invalid): New function.
9035         (class Output_section): Only declare, not define,
9036         update_flags_for_input_section.  Remove set_flags.
9037
9038 2009-06-24  Ian Lance Taylor  <iant@google.com>
9039
9040         * script-sections.cc (Output_section_definition::
9041         set_section_addresses): Rename shadowing local load_address to
9042         laddr.
9043
9044 2009-06-24  Ian Lance Taylor  <iant@google.com>
9045
9046         PR 10244
9047         * reloc.cc (relocate_sections): Skip empty relocation sections.
9048
9049 2009-06-23  Ian Lance Taylor  <iant@google.com>
9050
9051         PR 10156
9052         * layout.cc (Layout::create_note): Use choose_output_section
9053         rather than make_output_section.
9054
9055 2009-06-23  Ian Lance Taylor  <iant@google.com>
9056
9057         PR 10237
9058         * options.cc (General_options::parse_V): Set printed_version_.
9059         (General_options::General_options): Initialize printed_version_.
9060         * options.h (class General_options): Add printed_version_ field.
9061         * gold.cc (queue_initial_tasks): If there are no input files,
9062         don't give a fatal error if we printed the version information.
9063         (queue_middle_tasks): If using -r with a shared object, give a
9064         fatal error rather than an ordinary error.
9065
9066 2009-06-23  Ian Lance Taylor  <iant@google.com>
9067
9068         PR 10219
9069         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9070         (Layout::make_output_section): Set have_stabstr_section_ if we see
9071         a .stab*str section.
9072         (Layout::finalize): Call link_stabs_sections.
9073         (Layout::link_stabs_sections): New file.
9074         * layout.h (class Layout): Add have_stabstr_section_ field.
9075         Declare link_stabs_sections.
9076
9077 2009-06-23  Doug Kwan  <dougkwan@google.com>
9078
9079         * Makefile.am (libgold_a_LIBADD): New.
9080         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9081         * Makefile.in: Regenerate.
9082         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9083         * configure: Regenerate.
9084         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9085         * fileread.cc: Include sys/state.h
9086         * gold.h: Declare memmem and strndup if found missing.
9087         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9088
9089 2009-06-23  Ian Lance Taylor  <iant@google.com>
9090
9091         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9092         * configure: Rebuild.
9093
9094 2009-06-23  Ian Lance Taylor  <iant@google.com>
9095
9096         PR 10147
9097         * object.cc (Object::section_contents): Don't try to get a view if
9098         the section has length zero.
9099         (Object::handle_gnu_warning_section): If the section is empty, use
9100         the name of the section as the warning.
9101
9102 2009-06-23  Ian Lance Taylor  <iant@google.com>
9103
9104         PR 10133
9105         * stringpool.h (class Stringpool_template): Add optimize_ field.
9106         (Stringpool_template::set_optimize): New function.
9107         * stringpool.cc (Stringpool_template::Stringpool_template):
9108         Initialize optimize_ field.
9109         (Stringpool_template::set_string_offsets): Test local optimize
9110         fild rather than parameter.
9111         * layout.cc (Layout::Layout): Call set_optimize on the section
9112         name stringpool.
9113
9114 2009-06-22  Ian Lance Taylor  <iant@google.com>
9115
9116         PR 10030
9117         * yyscript.y: Parse TARGET.
9118         * script.cc (script_set_target): New function.
9119         * script-c.h (script_set_target): Declare.
9120         * options.cc (General_options::string_to_object_format): Rename
9121         from string_to_object_format in anonymous namespace.  Change
9122         callers.
9123         * options.h (class General_options): Declare
9124         string_to_object_format.
9125
9126 2009-06-22  Ian Lance Taylor  <iant@google.com>
9127
9128         * script-sections.cc (Script_sections::create_segments): Don't put
9129         program headers in a PT_LOAD segment if -n or -N.
9130
9131 2009-06-22  Ian Lance Taylor  <iant@google.com>
9132
9133         PR 10141
9134         * options.h (class General_options): Add -z lazy and -z now.  Sort
9135         -z options into alphabetical order.
9136         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9137
9138 2009-06-21  Ian Lance Taylor  <iant@google.com>
9139
9140         * layout.cc (Layout::make_output_section): Call
9141         Target::new_output_section.
9142         (Layout::attach_allocated_section_to_segment): Put large section
9143         sections in a separate load segment with the large segment flag
9144         set.
9145         (Layout::segment_precedes): Sort large data segments after other
9146         load segments.
9147         (align_file_offset): New static function.
9148         (Layout::set_segment_offsets): Use align_file_offset.
9149         * output.h (class Output_section): Add is_small_section_ and
9150         is_large_section_ fields.
9151         (Output_section::is_small_section): New function.
9152         (Output_section::set_is_small_section):  New function.
9153         (Output_section::is_large_section): New function.
9154         (Output_section::set_is_large_section): New function.
9155         (Output_section::is_large_data_section): New function.
9156         (class Output_segment): Add is_large_data_segment_ field.
9157         (Output_segment::is_large_data_segment): New function.
9158         (Output_segment::set_is_large_data_segment): New function.
9159         * output.cc (Output_section::Output_section): Initialize new
9160         fields.
9161         (Output_segment::Output_segment): Likewise.
9162         (Output_segment::add_output_section): Add assertion that large
9163         data sections always go in large data segments.  Force small data
9164         sections to the end of the list of data sections.  Force small BSS
9165         sections to the start of the list of BSS sections.  For large BSS
9166         sections to the end of the list of BSS sections.
9167         * symtab.h (class Symbol): Declare is_common_shndx.
9168         (Symbol::is_defined): Check Symbol::is_common_shndx.
9169         (Symbol::is_common): Likewise.
9170         (class Symbol_table): Define enum Commons_section_type.  Update
9171         declarations.  Add small_commons_ and large_commons_ fields.
9172         * symtab.cc (Symbol::is_common_shndx): New function.
9173         (Symbol_table::Symbol_table): Initialize new fields.
9174         (Symbol_table::add_from_object): Put small and large common
9175         symbols in the right list.
9176         (Symbol_table::sized_finalized_symbol): Check
9177         Symbol::is_common_shndx.
9178         (Symbol_table::sized_write_globals): Likewise.
9179         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9180         common symbol lists.  Don't call do_allocate_commons_list if the
9181         list is empty.
9182         (Symbol_table::do_allocate_commons_list): Remove is_tls
9183         parameter.  Add comons_section_type parameter.  Change all
9184         callers.  Handle small and large common symbols.
9185         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9186         Symbol::is_common_shndx.
9187         * resolve.cc (symbol_to_bits): Likewise.
9188         * target.h (Target::small_common_shndx): New function.
9189         (Target::small_common_section_flags): New function.
9190         (Target::large_common_shndx): New function.
9191         (Target::large_common_section_flags): New function.
9192         (Target::new_output_section): New function.
9193         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9194         small_common_section_flags, and large_common_section_flags
9195         fields.
9196         (Target::do_new_output_section): New virtual function.
9197         * arm.cc (Target_arm::arm_info): Initialize new fields.
9198         * i386.cc (Target_i386::i386_info): Likewise.
9199         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9200         Likewise.
9201         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9202         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9203         (Target_x86_64::do_new_output_section): New function.
9204         * configure.ac: Define conditional MCMODEL_MEDIUM.
9205         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9206         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9207         (large_LDFLAGS): Define.
9208         * testsuite/large.c: New file.
9209         * testsuite/testfile.cc (Target_test::test_target_info):
9210         Initialize new fields.
9211         * configure, testsuite/Makefile.in: Rebuild.
9212
9213 2009-06-05  Doug Kwan  <dougkwan@google.com>
9214
9215         * Makefile.am (CCFILES): Add target.cc.
9216         * Makefile.in: Regenerate.
9217         * i386.cc (class Target_i386): Define new virtual method to
9218         override do_is_local_label_name in parent.
9219         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9220         local symbols if --discard-locals or -X is given.
9221         * options.h (class General_options): Declare new options
9222         '--discard-locals' and '-X' for discarding locals.
9223         * target.h (class Target): Define new methods is_local_label_name.
9224         Declare new virtual method do_is_local_label_name.
9225         * target.cc: New file.
9226         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9227         (check_SCRIPTS): Add discard_locals_test.sh.
9228         (check_DATA): Add discard_local_tests.syms.
9229         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9230         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9231         * testsuite/Makefile.in: Regenerate.
9232         * testsuite/discard_locals_test.c: New file.
9233         * testsuite/discard_locals_test.sh: Same.
9234
9235 2009-06-05  Doug Kwan  <dougkwan@google.com>
9236
9237         * object.cc (Sized_relobj::Sized_relobj): Initialize
9238         discarded_eh_frame_shndx_ to -1U.
9239         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9240         section.
9241         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9242         a discarded .eh_frame section.
9243         (Sized_relobj::do_finalize_local_symbols): Ditto.
9244         * object.h (class Sized_relobj): Declare new member
9245         discarded_eh_frame_shndx_.
9246         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9247         (local_labels_test.o, local_labels_test): New rules.
9248         * testsuite/Makefile.in: Regenerate.
9249
9250 2009-06-04  Doug Kwan  <dougkwan@google.com>
9251
9252         * layout.cc (Layout::section_name_mapping): Add mapping for
9253         special ARM sections.
9254
9255 2009-06-03  Doug Kwan  <dougkwan@google.com>
9256
9257         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9258         (utils::has_overflow): Same.
9259
9260 2009-06-03  Ian Lance Taylor  <iant@google.com>
9261
9262         * layout.cc (Layout::section_name_mapping): New array, replacing
9263         Layout::linkonce_mapping.
9264         (Layout::section_name_mapping_count): New variable, replacing
9265         Layout::linkonce_mapping_count.
9266         (Layout::linkonce_output_name): Remove.
9267         (Layout::output_section_name): Rewrite.
9268         * layout.h (class Layout): Rename Linkonce_mapping to
9269         Section_name_mapping, linkonce_mapping to section_name_mapping,
9270         linkonce_mapping_count to section_name_mapping_count.  Don't
9271         declare linkonce_output_name.
9272
9273 2009-06-03  Doug Kwan  <dougkwan@google.com>
9274
9275         * gold/arm.cc (namespace utils): New.
9276         (Target_arm::reloc_is_non_pic): Define new method.
9277         (class Arm_relocate_functions): New.
9278         (Target_arm::Relocate::relocate): Handle relocation types used by
9279         Android.
9280
9281 2009-06-03  Ian Lance Taylor  <iant@google.com>
9282
9283         * arm.cc (Target_arm::scan::global): Use || instead of |.
9284
9285 2009-06-02  Doug Kwan  <dougkwan@google.com>
9286
9287         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9288         issued_non_pic_error_.
9289         (class Target_arm::Scan): Declare new method check_non_pic.
9290         Define new method symbol_needs_plt_entry.
9291         Declare new data member issued_non_pic_error_.
9292         (class Target_arm::Relocate): Declare new method
9293         should_apply_static_reloc.
9294         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9295         (Target_arm::Scan::check_non_pic): Define new method.
9296         (Target_arm::Scan::local): Handle a small subset of reloc types used
9297         by Android.
9298         (Target_arm::Scan::local): Same.
9299         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9300
9301 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9302
9303         * incremental.cc (Incremental_inputs::report_command_line): Filter
9304         out --incremental-* options.
9305
9306 2009-05-29  Doug Kwan  <dougkwan@google.com>
9307
9308         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9309         template class.
9310         (class Target_arm): Update comment.
9311         (Target_arm::Target_arm): Initialize new data members GOT_,
9312         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9313         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9314         and Target_arm::rel_dyn_section.
9315         Declare new_enum Target_arm::Got_type.
9316         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9317         and DYNBSS_.
9318         Update commments for member do_dynsym_value.
9319         (Target_arm::got_size, Target_arm::plt_section,
9320         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9321         new methods inside class defintion.
9322         (Target_arm::got_section): Define new method.
9323         (Target_arm::rel_dyn_section): Same.
9324         (Output_data_plt_arm): New template class.
9325         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9326         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9327         (Output_data_plt_arm::add_entry): Same.
9328         (Output_data_plt_arm::first_plt_entry): Define new
9329         static data member for PLT instruction template.
9330         (Output_data_plt_arm::plt_entry): Same.
9331         (Output_data_plt_arm::do_write): Define new method.
9332         (Target_arm::make_plt_entry): Same.
9333         (Target_arm::do_finalize_sections): Same.
9334         (Target_arm::do_dynsym_value): Same.
9335
9336 2009-05-28  Doug Kwan  <dougkwan@google.com>
9337
9338         * Makefile.am (TARGETSOURCES): Add arm.cc.
9339         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9340         * Makefile.in: Regenerate.
9341         * arm.cc: New file.
9342         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9343
9344 2009-05-26  Doug Kwan  <dougkwan@google.com>
9345
9346         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9347         (General_options::check_excluded_libs): Strip off directories in
9348         archive name before matching like GNU ld does.
9349         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9350         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9351         (exclude_libs_test_LDFLAGS): Add linker option
9352         -Wl,--exclude-libs,libexclude_libs_test_3
9353         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9354         an explicit archive without using -l.
9355         (alt/libexclude_libs_test_3.a): New make rule.
9356         * testsuite/Makefile.in: Regenerate.
9357         * testsuite/exclude_libs_test.c : Declare lib3_default().
9358         (main): Call it.
9359         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9360         * exclude_libs_test_3.c: New file.
9361
9362 2009-05-26  Nick Clifton  <nickc@redhat.com>
9363
9364         * po/id.po: New Indonesian translation.
9365         * po/gold.pot: Updated template file.
9366
9367 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9368
9369         * testsuite/Makefile.am: Add -ffunction-sections to compile
9370         gc_comdat_test files.  Add -Wl,--gc-sections to build
9371         gc_comdat_test.
9372         * testsuite/Makefile.in: Regenerate.
9373         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9374
9375 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9376
9377         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9378         kept comdat section was garbage collected.
9379         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9380         * testsuite/Makefile.in: Regenerate.
9381         * testsuite/gc_comdat_test.sh: New file.
9382         * testsuite/gc_comdat_test_1.cc: New file.
9383         * testsuite/gc_comdat_test_2.cc: New file.
9384
9385 2009-05-19  Doug Kwan  <dougkwan@google.com>
9386
9387         * archive.cc (Archive::Archive): Move constructor from archive.h
9388         to here.  Initialize no_export_.
9389         (Archive::get_elf_object_for_member): Set no_export flag of object.
9390         * archive.h (Archive::Archive): Move constructor body to
9391         archive.cc.
9392         (Archive::no_export): New method.
9393         (Archive::no_export_): New field.
9394         * object.h (Object::Object): Initialize no_export_ to false.
9395         (Object::no_export, Object::set_no_export): New methods.
9396         (Object::no_export_): New field.
9397         * options.cc (General_options::parse_exclude_libs): New method.
9398         (General_options::check_excluded_libs) Same.
9399         * options.h (exclude_libs): New option.
9400         (General_options::check_excluded_libs): New method declaration.
9401         (General_options::excluded_libs_): New field.
9402         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9403         default or protected visibility if an object has no-export flag set.
9404         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9405         (check_SCRIPTS): Add exclude_libs_test.sh.
9406         (check_DATA): Add exclude_libs_test.syms.
9407         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9408         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9409         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9410         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9411         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9412         libexclude_libs_test_2.a): New rules.
9413         * testsuite/Makefile.in: Regenerate.
9414         * testsuite/exclude_libs_test.c: New file.
9415         * testsuite/exclude_libs_test.sh: Ditto.
9416         * testsuite/exclude_libs_test_1.c: Ditto.
9417         * testsuite/exclude_libs_test_2.c: Ditto.
9418
9419 2009-05-15  Ian Lance Taylor  <iant@google.com>
9420
9421         * configure.ac: Check for declarations for cases where libiberty.h
9422         checks HAVE_DECL_xxx.
9423         * configure, config.in: Rebuild.
9424
9425 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9426
9427         * gold.h (Incremental_argument_list): Remove (invalid) forward
9428         declaration.
9429         * incremental.cc (Incremental_inputs::report_achive): New method.
9430         (Incremental_inputs::report_object): New method.
9431         (Incremental_inputs::report_script): New method.
9432         (Incremental_inputs::finalize_inputs): New method.
9433         (Incremental_inputs::finalize): Call finalize_inputs().
9434         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9435         Create inputs entries.
9436         * incremental.h (Incremental_input_type): New enum.
9437         (Incremental_inputs::Incremental_input): Initialize new fields.
9438         (Incremental_inputs::report_inputs): New method.
9439         (Incremental_inputs::report_achive): New method.
9440         (Incremental_inputs::report_object): New method.
9441         (Incremental_inputs::report_script): New method.
9442         (Incremental_inputs::finalize_inputs): New method.
9443         (Incremental_inputs::Input_info): New struct.
9444         (Incremental_inputs::Input_info_map): New typedef.
9445         (Incremental_inputs::lock_): New field.
9446         (Incremental_inputs::Inputs_): New field.
9447         (Incremental_inputs::Inputs_map): New field.
9448         * main.cc (main): Call Incremental_input::report_inputs.
9449         * options.h (Input_argument_list): Typedef moved from
9450         Input_arguments.
9451         (Input_file_group::Files): Remove, use ::Input_argument_list.
9452         (Input_file_group::Input_argument_list): Remove, use
9453         ::Input_argument_list.
9454         * plugin.cc (Plugin_manager::add_input_file): Add error in
9455         incremental build.
9456         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9457         functions.
9458         * script.cc (read_input_script): Call
9459         Incremental_input::report_script.
9460         * script.h (Script_info): New class.
9461
9462 2009-04-27  Ian Lance Taylor  <iant@google.com>
9463
9464         * x86_64.cc (do_adjust_output_section): Set entsize to
9465         plt_entry_size.
9466
9467 2009-04-23  Elliott Hughes  <enh@google.com>
9468
9469         * output.cc (Output_file::close): After short writes, continue
9470         writing from the correct offset in the buffer being written.
9471
9472 2009-04-23  Chris Demetriou  <cgd@google.com>
9473
9474         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9475         * configure: Regenerate.
9476         * config.in: Regenerate.
9477         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9478         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9479
9480 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9481
9482         * incremental.cc (Incremental_inputs_header_data): Renamed from
9483         Incremental_input_header_data.
9484         (Incremental_inputs_header_data::data_size): New field.
9485         (Incremental_inputs_header_data::put_input_file_count): Renamed
9486         from input_file_count.
9487         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9488         from command_line_offset.
9489         (Incremental_inputs_header_data::put_reserved): Renamed from
9490         put_reserved.
9491         (Incremental_inputs_entry_data): Renamed from
9492         Incremental_input_entry_data.
9493         (Incremental_inputs_entry_data::data_size): New field.
9494         (Incremental_inputs::report_command_line): New method.
9495         (Incremental_inputs::finalize): New method.
9496         (Incremental_inputs::create_incremental_inputs_data): New method.
9497         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9498         * incremental.h: New file.
9499         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9500        (Layout::finalize): Create incremental inputs section in
9501         incremental builds.
9502        (Layout::create_incremental_info_sections): New method.
9503         * layout.h (Layout::incremental_inputs): New method.
9504        (Layout::create_incremental_info_sections): New method.
9505        (Layout::incremental_inputs_): New field.
9506         * main.cc (main): Notify Incremental_input of the command line.
9507
9508 2009-04-01  Ian Lance Taylor  <iant@google.com>
9509             Mikolaj Zalewski  <mikolajz@google.com>
9510
9511         * gold.h (reserve_unordered_map): Define, three versions, one for
9512         each version of Unordered_map.
9513         * layout.cc (Layout::Layout): Remove options parameter.  Add
9514         number_of_input_files parameter.  Don't initialize options_.
9515         Initialize number_of_input_files_ and resized_signatures_.  Move
9516         sections_are_attached_.
9517         (Layout::layout_group): Reserve space for group_signatures_.
9518         (Layout::find_or_add_kept_section): Change name parameter to be a
9519         reference.  Resize signatures_ map when it gets large enough.
9520         (Layout::layout_eh_frame): Use parameters->options() instead of
9521         this->options_.
9522         (Layout::make_output_section): Likewise.
9523         (Layout::attach_allocated_section_to_segment): Likewise.
9524         (Layout::finalize, Layout::create_executable_stack): Likewise.
9525         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9526         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9527         * layout.h (class Layout): Update declarations.  Remove options_
9528         field.  Add number_of_input_files_ and resized_signatures_
9529         fields.  Move sections_are_attached_ field.
9530         * main.cc (main): Pass number of input files to Layout
9531         constructor.  Don't pass options.
9532
9533 2009-03-30  Ian Lance Taylor  <iant@google.com>
9534
9535         * ffsll.c (ffsll): Correct implementation.
9536
9537 2009-03-27  Ian Lance Taylor  <iant@google.com>
9538
9539         * ffsll.c: New file.
9540         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9541         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9542         * ftruncate.c (ftruncate): Declare before definition.
9543         * mremap.c (mremap): Likewise.
9544         * pread.c (pread): Likewise.
9545         * configure, Makefile.in, config.in: Rebuild.
9546
9547         * mremap.c: New file.
9548         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9549         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9550         (mremap): Declare if HAVE_MREMAP is not defined.
9551         * configure, Makefile.in, config.in: Rebuild.
9552
9553 2009-03-27  Cary Coutant  <ccoutant@google.com>
9554
9555         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9556         position independent.
9557         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9558         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9559
9560 2009-03-24  Cary Coutant  <ccoutant@google.com>
9561
9562         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9563         an executable.
9564         (needs_dynamic_reloc): Likewise.
9565
9566 2009-03-24  Ian Lance Taylor  <iant@google.com>
9567
9568         * yyscript.y (file_cmd): Recognize EXTERN.
9569         (extern_name_list, extern_name_list_body): New nonterminals.
9570         * script.cc (script_add_extern): Define.
9571         * script-c.h (script_add_extern): Declare.
9572
9573 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9574
9575         * object.cc (is_elf_object): Define.
9576         * object.h (is_elf_object): Declare.
9577         * archive.cc (Archive::get_elf_object_for_member): Call
9578         is_elf_object.
9579         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9580
9581 2009-03-24  Elliott Hughes  <enh@google.com>
9582
9583         * output.cc (Output_file::map_anonymous): Define.
9584         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9585         try an anonymous one.  Report the size if the mmap fails.
9586         * output.h (class Output_file): Declare map_anonymous.
9587
9588 2009-03-24  Ian Lance Taylor  <iant@google.com>
9589
9590         * target-select.cc (instantiate_target): Don't acquire the lock if
9591         the instantiated_target_ field has already been set.
9592
9593 2009-03-23  Ian Lance Taylor  <iant@google.com>
9594
9595         * gold-threads.h (class Initialize_lock): Define.
9596         * gold-threads.cc (class Initialize_lock_once): Define.
9597         (initialize_lock_control): New static variable.
9598         (initialize_lock_pointer): New static variable.
9599         (initialize_lock_once): New static function.
9600         (Initialize_lock::Initialize_lock): Define.
9601         (Initialize_lock::initialize): Define.
9602         * target-select.h: Include "gold-threads.h".
9603         (class Target_selector): Add lock_ and initialize_lock_ fields.
9604         Don't define instantiate_target, just declare it.
9605         * target-select.cc (Target_selector::Target_selector): Initialize
9606         new fields.
9607         (Target_selector::instantiate_target): Define.
9608         * descriptors.h: Include "gold-threads.h".
9609         (class Descriptors): Add initialize_lock_ field.
9610         * descriptors.cc (Descriptors::Descriptors): Initialize new
9611         field.
9612         (Descriptors::open): Use initialize_lock_ field
9613         * errors.h (class Errors): Add initialize_lock_ field.
9614         * errors.cc (Errors::Errors): Initialize new field.
9615         (Errors::initialize_lock): Use initialize_lock_ field.
9616         * powerpc.cc (class Target_selector_powerpc): Remove
9617         instantiated_target_ field.  In do_recognize call
9618         instantiate_target rather than do_instantiate_target.  In
9619         do_instantiate_target just allocate a new target.
9620         * sparc.cc (class Target_selector_sparc): Likewise.
9621
9622         * freebsd.h: New file.
9623         * i386.cc: Include "freebsd.h".
9624         (Target_i386): Derive from Target_freebsd rather than
9625         Sized_target.
9626         (Target_selector_i386): Derive from Target_selector_freebsd rather
9627         than Target_selector.
9628         * x86_64.cc: Include "freebsd.h".
9629         (Target_x86_64): Derive from Target_freebsd rather than
9630         Sized_target.
9631         (Target_selector_x86_64): Derive from Target_selector_freebsd
9632         rather than Target_selector.
9633         * target.h (class Target): Add adjust_elf_header and
9634         do_adjust_elf_header.
9635         * output.cc (Output_file_header:: do_sized_write): Call target
9636         adjust_elf_header routine.
9637         * configure.tgt: Set targ_osabi.
9638         * configure.ac: Define GOLD_DEFAULT_OSABI.
9639         * parameters.cc (Parameters::default_target): Pass
9640         GOLD_DEFAULT_OSABI to select_target.
9641         * target-select.h (class Target_selector): Make instantiate_target
9642         protected rather than private.
9643         * Makefile.am (HFILES): Add freebsd.h.
9644         * configure, Makefile.in, config.in: Rebuild.
9645
9646         * merge.cc (do_add_input_section): Correct pend value.  Change
9647         message about last entry not being null terminated from error to
9648         warning.
9649
9650 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9651
9652         * incremental.cc: New file.
9653         * Makefile.am (CCFILES): Add incremental.cc.
9654         * Makefile.in: Rebuild.
9655
9656 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9657
9658         * layout.cc (Layout::output_section_name): Preserve names
9659         of '.note.' sections.
9660
9661 2009-03-19  Ian Lance Taylor  <iant@google.com>
9662
9663         * descriptors.cc (Descriptors::open): Check that the options are
9664         valid before using them.
9665
9666 2009-03-18  Ian Lance Taylor  <iant@google.com>
9667
9668         * script-sections.h: Include <list>.
9669         (class Script_sections): Change Sections_elements from std::vector
9670         to std::list.  Typedef public Elements_iterator.  Add
9671         orphan_section_placement_, data_segment_align_start_, and
9672         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9673         field.
9674         * script-sections.cc (class Orphan_section_placement): New class.
9675         (class Sections_element): Add virtual functions is_relro and
9676         orphan_section_init.  Remove virtual function place_orphan_here.
9677         (class Output_section_definition): Add is_relro and
9678         orphan_section_init.  Remove place_orphan_here.
9679         (class Orphan_output_section): Likewise.
9680         (Script_sections::Script_sections): Update for field changes.
9681         (Script_sections::data_segment_align): Set saw_data_segment_align_
9682         and data_segment_align_start_, not data_segment_align_index.
9683         (Script_sections::data_segment_relro_end): Check
9684         saw_data_segment_align_.  Use data_segment_align_start_ rather
9685         than data_segment_align_index_.
9686         (Script_sections::place_orphan): Rewrite to use
9687         Orphan_section_placement.
9688
9689 2009-03-17  Ian Lance Taylor  <iant@google.com>
9690
9691         * archive.cc (Archive::add_symbols): Check for a version attached
9692         to the symbol name in the archive map.
9693         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9694         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9695         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9696         (ver_test_11.a): New target.
9697         * testsuite/Makefile.in: Rebuild.
9698
9699         * configure.ac: Check for chsize and posix_fallocate.  Replace
9700         ftruncate.
9701         * ftruncate.c: New file, from gnulib.
9702         * output.cc (posix_fallocate): Define dummy version if not
9703         HAVE_POSIX_FALLOCATE.
9704         (Output_file::map): Call posix_fallocate rather than lseek and
9705         write.
9706         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9707         * configure, Makefile.in, config.in: Rebuild.
9708
9709 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9710
9711         * layout.h (Layout::create_note): Add section_name parameter.
9712         * layout.cc (Layout::create_note): Likewise.
9713         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9714
9715 2009-03-17  Ian Lance Taylor  <iant@google.com>
9716
9717         * descriptors.cc: Include "options.h".
9718         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9719         (Descriptors::open): Always use O_CLOEXEC when opening a new
9720         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9721         then set FD_CLOEXEC.
9722
9723         * sparc.cc (class Target_sparc): Add has_got_section.
9724         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9725         make sure we have a GOT section.
9726
9727         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9728         (Target_sparc::Scan::local): Likewise.
9729         (Target_sparc::Scan::global): Likewise.
9730         (Target_sparc::Relocate::relocate): Likewise.
9731         (Target_sparc::Relocate::relocate_tls): Likewise.
9732
9733         * symtab.cc (Symbol_table::define_default_version): New function,
9734         broken out of add_from_object.
9735         (Symbol_table::add_from_object): Call define_default_version.
9736         (Symbol_table::define_special_symbol): Add resolve_oldsym
9737         parameter.  Change all callers.  If the version for a symbol comes
9738         from a version script, resolve it with the symbol with the same
9739         name with no version.  Also add the symbol without a version if
9740         appropriate.
9741         (do_define_in_output_data): If resolving with oldsym, don't delete
9742         sym.
9743         (do_define_in_output_segment): Likewise.
9744         (do_define_as_constant): Likewise.
9745         * symtab.h (class Symbol_table): Update declarations.
9746
9747 2009-03-13  Ian Lance Taylor  <iant@google.com>
9748
9749         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9750         (Read_symbols::requeue): New function.
9751         (Read_symbols::do_read_symbols): If make_elf_object fails because
9752         the target type is not configured, and the file was searched for,
9753         issue a warning and retry with the next directory.
9754         (Add_symbols::run): If the file has an incompatible format, and
9755         it was searched for, requeue the Read_symbols task.  On error,
9756         release the object.
9757         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9758         dirindex parameter to constructor.  Change all callers.  Declare
9759         incompatible_warning and requeue.
9760         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9761         input_argument_ and input_group_ fields.  Add them to
9762         constructor.  Change all callers.
9763         (class Read_script): Add dirindex_ field.  Add it to constructor.
9764         Change all callers.
9765         * archive.cc (Archive::setup): Remove input_objects parameter.
9766         Change all callers.
9767         (Archive::get_file_and_offset): Likewise.
9768         (Archive::read_all_symbols): Likewise.
9769         (Archive::read_symbols): Likewise.
9770         (Archive::get_elf_object_for_member): Remove input_objects
9771         parameter.  Add punconfigured parameter.  Change all callers.
9772         (Archive::add_symbols): Change return type to bool.  Check return
9773         value of include_member.
9774         (Archive::include_all_members): Likewise.
9775         (Archive::include_member): Change return type to bool.  Return
9776         false if first included object has incompatible target.  Set
9777         included_member_ field.
9778         (Add_archive_symbols::run): If add_symbols returns false, requeue
9779         Read_symbols task.
9780         * archive.h (class Archive): Add included_member_ field.
9781         Initialize it in constructor.  Add input_file and searched_for
9782         methods.  Update declarations.
9783         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9784         input_argument_ fields.  Add them to constructor.  Change all
9785         callers.
9786         * script.cc: Include "target-select.h".
9787         (class Parser_closure): Add skip_on_incompatible_target_ and
9788         found_incompatible_target_ fields.  Add
9789         skip_on_incompatible_target parameter to constructor.  Change all
9790         callers.  Add methods skip_on_incompatible_target,
9791         clear_skip_on_incompatible_target, found_incompatible_target, and
9792         set_found_incompatible_target.
9793         (read_input_script): Add dirindex parameter.  Change all callers.
9794         If parser finds an incompatible target, requeue Read_symbols
9795         task.
9796         (script_set_symbol): Clear skip_on_incompatible_target in
9797         closure.
9798         (script_add_assertion, script_parse_option): Likewise.
9799         (script_start_sections, script_add_phdr): Likewise.
9800         (script_check_output_format): New function.
9801         * script.h (read_input_script): Update declaration.
9802         * script-c.h (script_check_output_format): Declare.
9803         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9804         (ignore_cmd): Remove OUTPUT_FORMAT.
9805         * fileread.cc (Input_file::Input_file): Add explicit this.
9806         (Input_file::will_search_for): New function.
9807         (Input_file::open): Add pindex parameter.  Change all callers.
9808         * fileread.h (class Input_file): Add input_file_argument method.
9809         Declare will_search_for.  Update declarations.
9810         * object.cc (make_elf_object): Add punconfigured parameter.
9811         Change all callers.
9812         * object.h (class Object): Make input_file public.  Add
9813         searched_for method.
9814         (make_elf_object): Update declaration.
9815         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9816         restart search.
9817         * dirsearch.h (class Dirsearch): Update declaration.
9818         * options.h (class General_options): Add --warn-search-mismatch.
9819         * parameters.cc (Parameters::is_compatible_target): New function.
9820         * parameters.h (class Parameters): Declare is_compatible_target.
9821         * workqueue.cc (Workqueue::add_blocker): New function.
9822         * workqueue.h (class Workqueue): Declare add_blocker.
9823
9824         * fileread.cc (Input_file::open): Remove options parameter.
9825         Change all callers.
9826         (Input_file::open_binary): Likewise.
9827         * script.cc (read_input_script): Likewise.
9828         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9829         options parameter from constructor.  Change all callers.
9830         (class Read_script): Likewise.
9831         * fileread.h (class Input_file): Update declarations.
9832         * script.h (read_input_script): Update declaration.
9833
9834 2009-03-10  Nick Clifton  <nickc@redhat.com>
9835
9836         * po/es.po: New Spanish translation.
9837
9838 2009-03-06  Cary Coutant  <ccoutant@google.com>
9839
9840         * options.cc (parse_short_option): Keep dash_z from registering itself.
9841
9842 2009-03-03  Ian Lance Taylor  <iant@google.com>
9843
9844         PR 9918
9845         * target-reloc.h (relocate_section): Pass output_section to
9846         relocate.
9847         * i386.cc (Target_i386::should_apply_static_reloc): Add
9848         output_section parameter.  Change all callers.
9849         (Target_i386::Relocate::relocate): Add output_section parameter.
9850         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9851         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9852         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9853         * testsuite/two_file_shared.sh: New script.
9854         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9855         (check_DATA): Add two_file_shared.dbg.
9856         (two_file_shared.dbg): New target.
9857         * testsuite/Makefile.in: Rebuild.
9858
9859 2009-03-01  Ian Lance Taylor  <iant@google.com>
9860
9861         * configure.ac: Check for byteswap.h.
9862         * configure: Rebuild.
9863         * config.in: Rebuild.
9864
9865 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9866
9867         * layout.cc (Layout::find_or_add_kept_section): New function.
9868         (Layout::add_comdat): Removed.
9869         * layout.h (struct Kept_section): Move out of class Layout.
9870         Remove trailing underscores from field names.  Add group_sections
9871         field.  Rename group_ field to is_group.  Change all uses.
9872         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9873         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9874         comdat_groups_ field.
9875         (Sized_relobj::include_section_group): Use
9876         find_or_add_kept_section and Kept_section::group_sections.
9877         (Sized_relobj::include_linkonce_section): Likewise.
9878         * object.cc (class Sized_relobj): Don't define Comdat_group or
9879         Comdat_group_table.  Remove find_comdat_group and
9880         add_comdat_group.  Remove comdat_groups_ field.
9881         * plugin.cc (include_comdat_group): Use
9882         Layout::find_or_add_kept_section.
9883
9884 2009-02-28  Ian Lance Taylor  <iant@google.com>
9885
9886         * README: --gc-sections and map files are now supported.  Document
9887         some build requirements.
9888
9889         PR 6992
9890         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9891         relocatable link set the value of the section symbol to zero.
9892         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9893         relocatable link don't include the section address in the local
9894         symbol value.
9895
9896 2009-02-27  Ian Lance Taylor  <iant@google.com>
9897
9898         PR 6811
9899         * options.h (class Search_directory): Add is_system_directory.
9900         (class General_options): Declare is_in_system_directory.
9901         * options.cc (get_relative_sysroot): Make static.
9902         (get_default_sysroot): Make static.
9903         (General_optoins::is_in_system_directory): New function.
9904         * fileread.cc (Input_file::is_in_system_directory): New function.
9905         * fileread.h (class Input_file): Declare is_in_system_directory.
9906         * object.h (class Object): Add is_in_system_directory.
9907         (class Input_objects): Remove system_library_directory_ field.
9908         * object.cc (Input_objects::add_object): Don't set
9909         system_library_directory_.
9910         (input_objects::found_in_system_library_directory): Remove.
9911         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9912         parameter.  Change all callers.
9913         (Symbol_table::sized_write_globals): Likewise.
9914         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9915         Call Object::is_in_system_directory.
9916         * symtab.h (class Symbol_table): Update declarations.
9917
9918         PR 5990
9919         * descriptors.h (Open_descriptor): Add is_on_stack field.
9920         * descriptors.cc (Descriptors::open): If the descriptor is on the
9921         top of the stack, remove it.  Initialize is_on_stack field.
9922         (Descriptors::release): Only add pod to stack if it is not on the
9923         stack already.
9924         (Descriptors::close_some_descriptor): Clear stack_next and
9925         is_on_stack fields.
9926
9927         PR 7091
9928         * output.cc (Output_section::find_starting_output_address): Rename
9929         from starting_output_address; add PADDR parameter; change return
9930         type.
9931         * output.h (class Output_section): Declare
9932         find_starting_output_address instead of starting_output_address.
9933         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9934         section symbol for which we can't find a merge section.
9935
9936         PR 9836
9937         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9938         hidden or internal, force the symbol to be local.
9939         * resolve.cc (Symbol::override_visibility): Define.
9940         (Symbol::override_base): Use override_visibility.
9941         (Symbol_table::resolve): Likewise.
9942         (Symbol::override_base_with_special): Likewise.
9943         (Symbol_table::override_with_special): If the visibility is hidden
9944         or internal, force the symbol to be local.
9945         * symtab.h (class Symbol): Add set_visibility and
9946         override_visibility.
9947         * testsuite/ver_test_1.sh: New file.
9948         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9949         (check_DATA): Add ver_test_1.syms.
9950         (ver_test_1.syms): New target.
9951         * testsuite/Makefile.in: Rebuild.
9952
9953 2009-02-25  Cary Coutant  <ccoutant@google.com>
9954
9955         * layout.cc (Layout::choose_output_section): Don't rename sections
9956         when using a linker script that has a SECTIONS clause.
9957         * Makefile.in: Regenerate.
9958
9959         * testsuite/Makefile.am (script_test_5.sh): New test case.
9960         * testsuite/Makefile.in: Regenerate.
9961         * testsuite/script_test_5.cc: New file.
9962         * testsuite/script_test_5.sh: New file.
9963         * testsuite/script_test_5.t: New file.
9964
9965 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9966
9967         * archive.cc (Archive::include_member): Update calls to add_symbols.
9968         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9969         the Layout argument.
9970         * dynobj.h (do_add_symbols): Add the Layout argument.
9971         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9972         Layout argument.
9973         * object.h (Object::add_symbols): Add the Layout argument.
9974         (Object::do_add_symbols): Add the Layout argument.
9975         (Sized_relobj::do_add_symbols): Add the Layout argument.
9976         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9977         Unify the two versions.
9978         (Add_plugin_symbols): Remove.
9979         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9980         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9981         (Add_plugin_symbols): Remove.
9982         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9983         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9984         (Add_symbols::run): Make it work with Pulginobj.
9985
9986 2009-02-06  Ian Lance Taylor  <iant@google.com>
9987
9988         * object.cc (Sized_relobj::do_layout): Make info message start
9989         with lower case letter.
9990
9991 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9992
9993         * binary.cc: Fix file comment.
9994
9995         * options.h (enum Incremental_disposition): Define.
9996         (class General_options): Add new options: --incremental,
9997         --incremental_changed, --incremental_unchanged,
9998         --incremental_unknown.  Add incremental_disposition_ and
9999         implicit_incremental_ fields.
10000         (General_options::incremental_disposition): New function.
10001         (class Position_dependent_options): Add incremental_disposition
10002         option.
10003         (Position_dependent_options::copy_from_options): Set incremental
10004         dispositions.
10005         * options.cc (General_options::parse_incremental_changed): New
10006         function.
10007         (General_options::parse_incremental_unchanged): New function.
10008         (General_options::parse_incremental_unknown): New function.
10009         (General_options::General_options): Initialize new fields
10010         incremental_disposition_ and implicit_incremental_.
10011         (General_options::finalize): Check for uasge of --incremental-*
10012         without --incremental.
10013
10014 2009-02-06  Chris Demetriou  <cgd@google.com>
10015
10016         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10017         pointer and to report location as the file name associated with
10018         the symbol.
10019         (gold_undefined_symbol_at_location): New function to replace the
10020         old gold_undefined_symbol functionality.
10021         * target-reloc.h (relocate_section): Update to use
10022         gold_undefined_symbol_at_location.
10023         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10024         Call gold_undefined_symbol function rather than gold_error.
10025         * errors.h (Errors::undefined_symbol): Take location as a
10026         string, rather than calculating it from a relocation.
10027         * errors.cc (Errors::fatal): Print "fatal error:" before the
10028         formatted message.
10029         (Errors::error, Errors::error_at_location): Print "error: "
10030         before the formatted message.
10031         (Errors::undefined_symbol): Take location as a string, rather
10032         than calculating it from a relocation.
10033         (gold_undefined_symbol_at_location): New function akin to
10034         old gold_undefined_symbol, calculates location from relocation.
10035         (gold_undefined_symbol): Change to take only a Symbol pointer
10036         and to report location as the file name associated with the symbol.
10037         * testsuite/debug_msg.sh: Update for changed error messages.
10038         * testsuite/undef_symbol.sh: Likewise.
10039
10040 2009-02-04  Duncan Sands  <baldrick@free.fr>
10041
10042         PR 9812
10043         * reduced_debug_output.h
10044         (Output_reduced_debug_abbrev_section::failed): Use format for
10045         gold_warning.
10046         (Output_reduced_debug_info_section::faild): Likewise.
10047
10048 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10049
10050         * script.cc (Lazy_demangler): New class.
10051         (Version_script_info::get_symbol_version_helper): Demangle a
10052         symbol only once.
10053
10054 2009-01-29  Cary Coutant  <ccoutant@google.com>
10055
10056         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10057         to __tls_get_addr.
10058         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10059
10060 2009-01-28  Ian Lance Taylor  <iant@google.com>
10061
10062         * version.cc (version_string): Bump to 1.9.
10063
10064         * gold.h: Include <cstring> and <stdint.h>.
10065         * version.cc: Include <cstdio>.
10066         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10067         warning.
10068         * reduced_debug_output.cc (insert_into_vector): Rename from
10069         Insert_into_vector; change all callers.  Use Swap_unaligned to
10070         avoid aliasing issue; remove union since it is unnecessary.
10071
10072 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10073
10074         * Makefile.am (CCFILES): Add gc.cc.
10075         (HFILES): Add gc.h.
10076         * Makefile.in: Regenerate.
10077         * gold.cc (Gc_runner): New class.
10078         (queue_initial_tasks): Call garbage collection related tasks
10079         when corresponding options are invoked.
10080         (queue_middle_gc_tasks): New function.
10081         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10082         processed early before laying out sections during garbage collection.
10083         * gold.h (queue_middle_gc_tasks): New function.
10084         (is_prefix_of): Move from "layout.cc".
10085         * i386.cc (Target_i386::gc_process_relocs): New function.
10086         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10087         * main.cc (main): Create object of class "Garbage_collection".
10088         * object.cc (Relobj::copy_symbols_data): New function.
10089         (Relobj::is_section_name_included): New function.
10090         (Sized_relobj::do_layout): Allow this function to be called twice
10091         during garbage collection and defer layout of section during the
10092         first call.
10093         * object.h (Relobj::get_symbols_data): New function.
10094         (Relobj::is_section_name_included): New function.
10095         (Relobj::copy_symbols_data): New function.
10096         (Relobj::set_symbols_data): New function.
10097         (Relobj::get_relocs_data): New function.
10098         (Relobj::set_relocs_data): New function.
10099         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10100         (Relobj::gc_process_relocs): New function.
10101         (Relobj::do_gc_process_relocs): New pure virtual function.
10102         (Relobj::sd_): New data member.
10103         (Sized_relobj::is_output_section_offset_invalid): New function.
10104         (Sized_relobj::do_gc_process_relocs): New function.
10105         * options.h (General_options::gc_sections): Modify to not be a no-op.
10106         (General_options::print_gc_sections): New option.
10107         * plugin.cc (Plugin_finish::run): Remove function call to
10108         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10109         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10110         * reloc.cc (Read_relocs::run): Add task to process relocs and
10111         determine unreferenced sections when doing garbage collection.
10112         (Gc_process_relocs): New class.
10113         (Sized_relobj::do_gc_process_relocs): New function.
10114         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10115         sections that are garbage collected.
10116         * reloc.h (Gc_process_relocs): New class.
10117         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10118         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10119         symbols whose corresponding sections are garbage collected.
10120         (Symbol_table::Symbol_table): Add new parameter for the garbage
10121         collection object.
10122         (Symbol_table::gc_mark_undef_symbols): New function.
10123         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10124         (Symbol_table::gc_mark_dyn_syms): New function.
10125         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10126         as garbage.
10127         (Symbol_table::add_from_object): Likewise.
10128         (Symbol_table::add_from_relobj): When building shared objects, do not
10129         treat externally visible symbols as garbage.
10130         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10131         table information for static and relocatable links.
10132         * symtab.h (Symbol_table::set_gc): New function.
10133         (Symbol_table::gc): New function.
10134         (Symbol_table::gc_mark_undef_symbols): New function.
10135         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10136         (Symbol_table::gc_mark_dyn_syms): New function.
10137         (Symbol_table::gc_): New data member.
10138         * target.h (Sized_target::gc_process_relocs): New pure virtual
10139         function.
10140         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10141         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10142
10143 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10144
10145         * options.h (General_options::gc_sections): Define as a no-op for now.
10146         (General_options::no_keep_memory): Ditto.
10147         (General_options::Bshareable): Define.
10148         * options.cc (General_options::finalize): Honor -Bshareable.
10149
10150 2009-01-20  Andreas Schwab  <schwab@suse.de>
10151
10152         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10153         read the value in the contents, since we don't use it.  Use the
10154         template endianness when writing.
10155         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10156
10157 2009-01-19  Andreas Schwab  <schwab@suse.de>
10158
10159         * configure.tgt (powerpc64-*): Fix targ_obj.
10160
10161 2009-01-15  Ian Lance Taylor  <iant@google.com>
10162
10163         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10164         local symbols when stripping all symbols.
10165
10166 2009-01-14  Cary Coutant  <ccoutant@google.com>
10167
10168         * output.cc (Output_reloc): Add explicit instantiations.
10169
10170 2009-01-14  Cary Coutant  <ccoutant@google.com>
10171
10172         * archive.cc (Archive::get_elf_object_for_member): Remove call
10173         to File_read::claim_for_plugin.
10174         * descriptors.cc (Descriptors::open): Remove reference to
10175         is_claimed.
10176         (Descriptors::claim_for_plugin): Remove.
10177         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10178         (Descriptors::is_claimed): Remove.
10179         (claim_descriptor_for_plugin): Remove.
10180         * fileread.cc (File_read::claim_for_plugin): Remove.
10181         * fileread.h (File_read::claim_for_plugin): Remove.
10182         (File_read::descriptor): Reopen descriptor if necessary.
10183         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10184         (Plugin_manager::all_symbols_read): Add task parameter. Change
10185         all callers.
10186         (Plugin_manager::get_input_file): New function.
10187         (Plugin_manager::release_input_file): New function.
10188         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10189         corresponding data member.
10190         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10191         and pass to base constructor. Change all callers.
10192         (get_input_file, release_input_file): New functions.
10193         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10194         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10195         (Plugin_manager::all_symbols_read): Add task parameter.
10196         (Plugin_manager::get_input_file): New function.
10197         (Plugin_manager::release_input_file): New function.
10198         (Plugin_manager::task_): New data member.
10199         (Pluginobj::Pluginobj): Add filesize parameter.
10200         (Pluginobj::filename): New function.
10201         (Pluginobj::descriptor): New function.
10202         (Pluginobj::filesize): New function.
10203         (Pluginobj::filesize_): New data member.
10204         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10205         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10206         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10207
10208         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10209         with archive libraries.
10210         * testsuite/Makefile.in: Regenerate.
10211         * testsuite/plugin_test.c (struct sym_info): New type.
10212         (get_input_file, release_input_file): New static variables.
10213         (onload): Capture new transfer vector entries.
10214         (claim_file_hook): Stop reading at end of file according to filesize.
10215         Factor out parsing of readelf output into separate function.
10216         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10217         APIs and get the source file name from the symbol table.  Convert
10218         source file name to corresponding object file name.  Print info
10219         message when adding new input files.
10220         (parse_readelf_line): New function.
10221         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10222         * testsuite/plugin_test_2.sh: Likewise.
10223         * testsuite/plugin_test_3.sh: Likewise.
10224         * testsuite/plugin_test_4.sh: New test case.
10225
10226 2009-01-07  Ian Lance Taylor  <iant@google.com>
10227
10228         * version.cc (version_string): Bump to 1.8.
10229
10230 2008-12-23  Cary Coutant  <ccoutant@google.com>
10231
10232         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10233         * plugin.cc (Plugin_manager::finish): Rename as
10234         layout_deferred_objects.  Move cleanup to separate function.
10235         (Plugin_manager::cleanup): New function.
10236         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10237         separately.
10238         * plugin.h (Plugin_manager::finish): Rename as
10239         layout_deferred_objects.
10240         (Plugin_manager::cleanup): New function.
10241         (Plugin_manager::cleanup_done): New field.
10242
10243 2008-12-23  Cary Coutant  <ccoutant@google.com>
10244
10245         * plugin.cc (is_visible_from_outside): New function.
10246         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10247         so we don't return "IR only" status for exported symbols or -r links.
10248
10249         * testsuite/Makefile.am (plugin_test_3): New test case.
10250         * testsuite/Makefile.in: Regenerate.
10251         * testsuite/plugin_test_3.sh: New file.
10252
10253 2008-12-22  Cary Coutant  <ccoutant@google.com>
10254
10255         * object.cc (Sized_relobj::layout_section): New function.
10256         (Sized_relobj::do_layout): Defer layout of input sections until after
10257         plugin has provided replacement files.
10258         (Sized_relobj::do_layout_deferred_sections): New function.
10259         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10260         (Relobj::layout_deferred_sections): New function.
10261         (Relobj::do_layout_deferred_sections): New function.
10262         (Sized_relobj::do_layout_deferred_sections): New function.
10263         (Sized_relobj::layout_section): New function.
10264         (Sized_relobj::Deferred_layout): New structure.
10265         (Sized_relobj::deferred_layout_): New field.
10266         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10267         Change all callers.  Layout deferred sections.
10268         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10269         references.
10270         (Plugin_hook::run): Move code from do_plugin_hook inline.
10271         (Plugin_hook::do_plugin_hook): Remove.
10272         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10273         (Plugin_manager::finish): Renamed, was cleanup.
10274         (Plugin_manager::should_defer_layout): New function.
10275         (Plugin_manager::add_deferred_layout_object): New function.
10276         (Plugin_manager::Deferred_layout_list): New type.
10277         (Plugin_manager::deferred_layout_objects_): New field.
10278         (Plugin_hook::do_plugin_hook): Remove.
10279
10280 2008-12-17  Ian Lance Taylor  <iant@google.com>
10281
10282         * options.h (class General_options): Add --no case for
10283         --export-dynamic.
10284
10285 2008-12-16  Cary Coutant  <ccoutant@google.com>
10286
10287         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10288         vector.
10289         (Plugin_manager::claim_file): Create plugin object even if
10290         plugin did not call the add_symbols callback.
10291         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10292         asking for more symbols than were added.
10293         * testsuite/Makefile.am (plugin_test_1): Add test case with
10294         no global symbols.
10295         (empty.syms): New target.
10296         * testsuite/Makefile.in: Regenerate.
10297         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10298         message. Don't call add_symbols if no globals.
10299         (all_symbols_read_hook): Don't provide replacement for empty
10300         claimed file.
10301
10302 2008-12-12  Ian Lance Taylor  <iant@google.com>
10303
10304         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10305         r_type == 0 for a local symbol with r_sym == 0.
10306         (scan_relocatable_relocs): Pass r_sym to
10307         local_non_section_strategy.
10308         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10309         r_sym parameter.
10310
10311         * configure.ac: Update test for TLS descriptors: they are
10312         supported as of glibc 2.9.
10313         * configure: Rebuild.
10314
10315 2008-12-11  Ian Lance Taylor  <iant@google.com>
10316
10317         PR 7091
10318         * target-reloc.h (Default_scan_relocatable_relocs): For each
10319         function, map r_type == 0 to RELOC_DISCARD.
10320
10321 2008-12-10  Cary Coutant  <ccoutant@google.com>
10322
10323         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10324         object to override a kept COMDAT group from a plugin object.
10325
10326 2008-12-09  Ian Lance Taylor  <iant@google.com>
10327
10328         PR 7088
10329         * yyscript.y (file_cmd): Handle INPUT.
10330
10331         * testsuite/initpri1.c: Change all declarations to be full
10332         prototypes by adding void, to avoid compiler warnings.
10333
10334 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10335
10336         * options.cc (General_options::parse_plugin_opt): New.
10337         (General_options::add_plugin): The argument now is just the filename.
10338         (General_options::add_plugin_option): New.
10339         * options.h (plugin_opt): New.
10340         (add_plugin): Change argument name.
10341         (add_plugin_option): New.
10342         * plugin.cc (Plugin::load): Don't parse the plugin option.
10343         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10344         (Plugin::add_option): New.
10345         (Plugin::args_): Change type.
10346         (Plugin::filename_): New.
10347         (Plugin_manager::add_plugin_option): New.
10348         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10349         * testsuite/Makefile.in: Regenerate.
10350
10351 2008-12-05  Cary Coutant  <ccoutant@google.com>
10352
10353         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10354         Handle --strip-lto-sections option.
10355         * options.h (strip_lto_sections): New option.
10356
10357 2008-12-01  Cary Coutant  <ccoutant@google.com>
10358
10359         * plugin.cc (ld_plugin_message): Change format parameter to const.
10360         Fix mismatch between new[] and delete.
10361
10362 2008-11-14  Cary Coutant  <ccoutant@google.com>
10363
10364         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10365         instead of -1U.
10366
10367 2008-11-05  Craig Silverstein  <csilvers@google.com>
10368
10369         * options.cc (General_options::parse_dynamic_list): New function.
10370         * options.h (General_options): New flags dynamic_list,
10371         dynamic_list_data, dynamic_list_cpp_new, and
10372         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10373         (General_options::in_dynamic_list): New function.
10374         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10375         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10376         (Lex::can_continue_name): Likewise.
10377         (yylex): Likewise.
10378         (read_script_file): New parameter script_options.
10379         (read_dynamic_list): New function.
10380         (Script_options::define_dynamic_list): New function.
10381         (dynamic_list_keyword_parsecodes): New variable.
10382         (dynamic_list_keywords): New variable.
10383         * script.h (Script_options::define_dynamic_list): New function
10384         prototype.
10385         (read_dynamic_list): New function prototype.
10386         * symtab.cc (strprefix): New macro.
10387         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10388         dynamic_list_data, dynamic_list_cpp_new, and
10389         dynamic_list_cpp_typeinfo.
10390         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10391         (dynamic_list_expr): New rule.
10392         (dynamic_list_nodes): Likewise.
10393         (dynamic_list_node): Likewise.
10394         * testsuite/Makefile.am (dynamic_list): New test.
10395         * testsuite/Makefile.in: Regenerated.
10396         * testsuite/dynamic_list.t: New file.
10397         * testsuite/dynamic_list.sh: New file.
10398
10399 2008-11-05  Craig Silverstein  <csilvers@google.com>
10400
10401         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10402         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10403         (t11_last): Likewise.
10404         * testsuite/ver_test_6.c (main): Likewise.
10405
10406 2008-10-07  Cary Coutant  <ccoutant@google.com>
10407
10408         * options.c (General_options::finalize): Add check for -static and
10409         -shared.
10410         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10411         is not empty.
10412
10413 2008-10-02  Cary Coutant  <ccoutant@google.com>
10414
10415         * plugin.cc (make_sized_plugin_object): Fix conditional
10416         compilation to work when not all targets are enabled.
10417
10418 2008-09-29  Cary Coutant  <ccoutant@google.com>
10419
10420         * archive.cc (Archive::get_file_and_offset): Use filename instead
10421         of name to get library path.
10422         (Archive::include_member): Unlock external member of a thin archive.
10423
10424         * testsuite/Makefile.am (TEST_AR): New variable.
10425         (thin_archive_test_1): New test.
10426         (thin_archive_test_2): New test.
10427         * testsuite/Makefile.in: Regenerate.
10428         * testsuite/thin_archive_main.cc: New file.
10429         * testsuite/thin_archive_test_1.cc: New file.
10430         * testsuite/thin_archive_test_2.cc: New file.
10431         * testsuite/thin_archive_test_3.cc: New file.
10432         * testsuite/thin_archive_test_4.cc: New file.
10433
10434 2008-09-29  Cary Coutant  <ccoutant@google.com>
10435
10436         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10437         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10438         instead of -1U.
10439         (Sized_relobj::do_finalize_local_symbols): Likewise.
10440         (Sized_relobj::map_to_kept_section): Likewise.
10441         * object.h (Sized_relobj::invalid_address): New constant.
10442         (Sized_relobj::do_output_section_offset): Check for invalid_address
10443         and return -1ULL.
10444         * output.cc (Output_reloc::local_section_offset): Use constant
10445         invalid_address instead of -1U.
10446         (Output_reloc::get_address): Likewise.
10447         (Output_section::output_address): Change -1U to -1ULL.
10448         * output.h (Output_reloc::invalid_address): New constant.
10449         * reloc.cc (Sized_relobj::write_sections): Use constant
10450         invalid_address instead of -1U.
10451         (Sized_relobj::relocate_sections): Likewise.
10452         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10453         values for merge sections.
10454         * target-reloc.h (relocate_for_relocatable): Use constant
10455         invalid_address instead of -1U.
10456
10457 2008-09-19  Cary Coutant  <ccoutant@google.com>
10458
10459         Add plugin functionality for link-time optimization (LTO).
10460         * configure.ac (plugins): Add --enable-plugins option.
10461         * configure: Regenerate.
10462         * config.in: Regenerate.
10463         * Makefile.am (LIBDL): New variable.
10464         (CCFILES): Add plugin.cc.
10465         (HFILES): Add plugin.h.
10466         (ldadd_var): Add LIBDL.
10467         * Makefile.in: Regenerate.
10468
10469         * archive.cc: Include "plugin.h".
10470         (Archive::setup): Don't preread archive symbols when using a plugin.
10471         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10472         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10473         files.
10474         (Archive::include_member): Add symbols from plugin objects.
10475         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10476         * descriptors.cc (Descriptors::open): Check for file descriptors
10477         abandoned by plugins.
10478         (Descriptors::claim_for_plugin): New function.
10479         * descriptors.h (Descriptors::claim_for_plugin): New function.
10480         (Open_descriptor::is_claimed): New field.
10481         (claim_descriptor_for_plugin): New function.
10482         * fileread.cc (File_read::claim_for_plugin): New function.
10483         * fileread.h (File_read::claim_for_plugin): New function.
10484         (File_read::descriptor): New function.
10485         * gold.cc: Include "plugin.h".
10486         (queue_initial_tasks): Add task to call plugin hooks for generating
10487         new object files.
10488         * main.cc: Include "plugin.h".
10489         (main): Load plugin libraries.
10490         * object.h (Pluginobj): Declare.
10491         (Object::pluginobj): New function.
10492         (Object::do_pluginobj): New function.
10493         (Object::set_target): New function.
10494         * options.cc: Include "plugin.h".
10495         (General_options::parse_plugin): New function.
10496         (General_options::General_options): Initialize plugins_ field.
10497         (General_options::add_plugin): New function.
10498         * options.h (Plugin_manager): Declare.
10499         (General_options): Add --plugin option.
10500         (General_options::has_plugins): New function.
10501         (General_options::plugins): New function.
10502         (General_options::add_plugin): New function.
10503         (General_options::plugins_): New field.
10504         * plugin.cc: New file.
10505         * plugin.h: New file.
10506         * readsyms.cc: Include "plugin.h".
10507         (Read_symbols::do_read_symbols): Check for archive before checking
10508         for ELF file.  Call plugin hooks to claim files.
10509         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10510         from a real object file; force override when processing replacement
10511         files.
10512         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10513         (Symbol::init_base_object): Likewise.
10514         (Symbol::init_base_output_data): Likewise.
10515         (Symbol::init_base_output_segment): Likewise.
10516         (Symbol::init_base_constant): Likewise.
10517         (Symbol::init_base_undefined): Likewise.
10518         (Symbol::output_section): Assert that object is not a plugin.
10519         (Symbol_table::add_from_pluginobj): New function.
10520         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10521         undefined.
10522         (Symbol_table::sized_write_globals): Likewise.
10523         (Symbol_table::add_from_pluginobj): Instantiate template.
10524         * symtab.h (Sized_pluginobj): Declare.
10525         (Symbol::in_real_elf): New function.
10526         (Symbol::set_in_real_elf): New function.
10527         (Symbol::in_real_elf_): New field.
10528         (Symbol_table::add_from_pluginobj): New function.
10529
10530         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10531         (LIBDL): New variable.
10532         (LDADD): Add LIBDL.
10533         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10534         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10535         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10536         (MOSTLYCLEANFILES): Likewise.
10537         * testsuite/Makefile.in: Regenerate.
10538         * testsuite/plugin_test.c: New file.
10539         * testsuite/plugin_test_1.sh: New file.
10540         * testsuite/plugin_test_2.sh: New file.
10541
10542 2008-09-16  Ian Lance Taylor  <iant@google.com>
10543
10544         * target-reloc.h (relocate_section): Check whether a symbol is
10545         defined by the ABI before reporting an undefined symbol error.
10546         * target.h (Target::is_defined_by_abi): Make parameter const.
10547         (Target::do_is_defined_by_abi): Likewise.
10548         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10549         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10550         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10551         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10552         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10553         * testsuite/Makefile.in: Rebuild.
10554
10555         * fileread.cc (make_view): Add casts to avoid warning.
10556
10557 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10558
10559         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10560         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10561
10562 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10563
10564         * options.h (General_options::output_is_executable): New.
10565         (General_options::output_is_pie): New.
10566         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10567         for shared libraries.
10568         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10569
10570 2008-09-11  Chris Demetriou  <cgd@google.com>
10571
10572         * options.h (origin): New -z option.
10573         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10574         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10575         in DT_FLAGS_1.
10576
10577 2008-09-05  Cary Coutant  <ccoutant@google.com>
10578
10579         * fileread.cc (File_read::make_view): Add check for attempt to map
10580         beyond end of file.
10581
10582 2008-09-05  Cary Coutant  <ccoutant@google.com>
10583
10584         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10585         explicit instantiations.
10586
10587 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10588
10589         PR gold/6858
10590         * options.cc (General_options::finalize): Allow undefined symbols
10591         in shlibs if linking -shared.
10592
10593         PR gold/6859
10594         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10595         symbols as not needing a dynsym entry.
10596
10597 2008-08-20  Craig Silverstein  <csilvers@google.com>
10598
10599         * fileread.cc (File_read::open): Do not lock the file unless it
10600         was successfully opened.
10601
10602 2008-08-14  Cary Coutant  <ccoutant@google.com>
10603
10604         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10605         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10606         * testsuite/tls_test.cc (struct int128): 128-bit struct
10607         for testing TLS relocs with non-zero addend.
10608         (v12): New TLS variable.
10609         (t12): New test.
10610         (t_last): Add check for v12.
10611         * testsuite/tls_test.h (t12): New function.
10612         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10613
10614 2008-08-13  Ian Lance Taylor  <iant@google.com>
10615
10616         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10617         set tls_segment_ or relro_segment_.
10618         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10619         when appropriate.
10620         * output.h (Output_section::clear_is_relro): New function.
10621         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10622         sections specially even when output_data_ is empty.
10623         (Output_segment::maximum_alignment): When first section is relro,
10624         only force alignment for PT_LOAD segments.
10625         * script.cc (script_data_segment_align): New function.
10626         (script_data_segment_relro_end): New function.
10627         * script-c.h (script_data_segment_align): Declare.
10628         (script_data_segment_relro_end): Declare.
10629         * script-sections.h (class Script_sections): Declare
10630         data_segment_align and data_segment_relro_end.  Add fields
10631         segment_align_index_ and saw_relro_end_.
10632         * script-sections.cc (class Sections_element): Add set_is_relro
10633         virtual function.  Add new bool* parameter to place_orphan_here.
10634         Add get_output_section virtual function.
10635         (class Output_section_definition): Add set_is_relro.  Add new
10636         bool* parameter to place_orphan_here.  Add get_output_section.
10637         Add is_relro_ field.
10638         (Output_section_definition::Output_section_definition): Initialize
10639         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10640         and is_relro_ fields.
10641         (Output_section_definition::place_orphan_here): Add is_relro
10642         parameter.
10643         (Output_section_definition::set_section_addresses): Set relro for
10644         output section.
10645         (Output_section_definition::alternate_constraint): Likewise.
10646         (class Orphan_output_section): Add new bool* parameter to
10647         place_orphan_here.  Add get_output_section.
10648         (Orphan_output_section::place_orphan_here): Add is_relro
10649         parameter.
10650         (Script_sections::Script_sections): Initialize
10651         data_segment_align_index_ and saw_relro_end_.
10652         (Script_sections::data_segment_align): New function.
10653         (Script_sections::data_segment_relro_end): New function.
10654         (Script_sections::place_orphan): Set or clear is_relro.
10655         (Script_sections::set_section_addresses): Force alignment of first
10656         TLS section.
10657         * yyscript.y (exp): Call script_data_segment_align and
10658         script_data_segment_relro_end.
10659         * testsuite/relro_script_test.t: New file.
10660         * testsuite/relro_test.cc (using_script): Declare.
10661         (t1, t2): Test using_script.
10662         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10663         (relro_script_test_SOURCES): Define.
10664         (relro_script_test_DEPENDENCIES): Define.
10665         (relro_script_test_LDFLAGS): Define.
10666         (relro_script_test_LDADD): Define.
10667         (relro_script_test.so): New target.
10668         * testsuite/Makefile.in: Rebuild.
10669
10670 2008-08-06  Cary Coutant <ccoutant@google.com>
10671
10672         * archive.cc (Archive::total_archives, Archive::total_members)
10673         (Archive::total_members_loaded): New variables.
10674         (Archive::setup): Add parameter.  Add option to preread
10675         archive symbols.
10676         (Archive::read_armap): Add counter.
10677         (Archive::get_file_and_offset): New function.
10678         (Archive::get_elf_object_for_member): New function.
10679         (Archive::read_all_symbols): New function.
10680         (Archive::read_symbols): New function.
10681         (Archive::add_symbols): Add counters.
10682         (Archive::include_all_members): Use armap to find members if it's
10683         already built.
10684         (Archive::include_member): Skip reading symbols if already read.
10685         Factored code into Archive::get_file_and_offset and
10686         Archive::get_elf_object_for_member.  Changed call to
10687         Mapfile::report_include_archive_member.
10688         (Archive::print_stats): New function.
10689         * archive.h: Declare Object and Read_symbols_data classes.
10690         (Archive::Archive): Add initializers for new members.
10691         (Archive::setup): Add parameter.
10692         (Archive::print_stats): New function.
10693         (Archive::total_archives, Archive::total_members)
10694         (Archive::total_members_loaded): New variables.
10695         (Archive::get_file_and_offset): New function.
10696         (Archive::get_elf_object_for_member): New function.
10697         (Archive::read_all_symbols): New function.
10698         (Archive::read_symbols): New function.
10699         (Archive::Archive_member): New class.
10700         (Archive::members_): New member.
10701         (Archive::num_members_): New member.
10702         * main.cc: Include archive.h.
10703         (main): Call Archive::print_stats.
10704         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10705         archive parameter; member_name is now the fully-decorated name.
10706         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10707         * options.h: (General_options): Add --preread-archive-symbols option.
10708         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10709         Archive::setup.
10710
10711 2008-08-04  Ian Lance Taylor  <iant@google.com>
10712
10713         * symtab.h (Symbol::use_plt_offset): New function.
10714         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10715         * powerpc.cc (Relocate::relocate): Likewise.
10716         * sparc.cc (Relocate::relocate): Likewise.
10717         * x86_64.cc (Relocate::relocate): Likewise.
10718         * testsuite/weak_plt.sh: New test.
10719         * testsuite/weak_plt_main.cc: New test.
10720         * testsuite/weak_plt_shared.cc: New test.
10721         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10722         (check_PROGRAMS): Add weak_plt.
10723         (check_DATA): Add weak_plt_shared.so.
10724         (weak_plt_main_pic.o, weak_plt): New targets.
10725         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10726         * testsuite/Makefile.in: Rebuild.
10727
10728         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10729         gcctestdir/ld.
10730         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10731         * testsuite/Makefile.in: Rebuild.
10732
10733 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10734
10735         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10736         * Makefile.in: Regenerate.
10737         * po/POTFILES.in: Regenerate.
10738
10739 2008-07-29  Ian Lance Taylor  <iant@google.com>
10740
10741         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10742         symbols before other symbols.
10743         * testsuite/script_test_2.cc (test_addr): Declare.
10744         (test_addr_alias): Declare.
10745         (main): Check that test_addr and test_addr_alias have the right
10746         values.
10747         * testsuite/script_test_2.t: Define test_addr_alias and
10748         test_addr.
10749
10750 2008-07-24  Ian Lance Taylor  <iant@google.com>
10751
10752         PR 5990
10753         * descriptors.cc: New file.
10754         * descriptors.h: New file.
10755         * gold-threads.h (class Hold_optional_lock): New class.
10756         * fileread.cc: Include "descriptors.h".
10757         (File_read::~File_read): Release descriptor rather than closing
10758         it.
10759         (File_read::open) [file]: Call open_descriptor rather than open.
10760         Set is_descriptor_opened_.
10761         (File_read::open) [memory]: Assert that descriptor is not open.
10762         (File_read::reopen_descriptor): New function.
10763         (File_read::release): Release descriptor.
10764         (File_read::do_read): Make non-const.  Reopen descriptor.
10765         (File_read::read): Make non-const.
10766         (File_read::make_view): Reopen descriptor.
10767         (File_read::do_readv): Likewise.
10768         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10769         Update declarations.
10770         * layout.cc: Include "descriptors.h".
10771         (Layout::create_build_id): Use open_descriptor rather than open.
10772         * output.cc: Include "descriptors.h".
10773         (Output_file::open): Use open_descriptor rather than open.
10774         * archive.cc (Archive::const_iterator): Change Archive to be
10775         non-const.
10776         (Archive::begin, Archive::end): Make non-const.
10777         (Archive::count_members): Likewise.
10778         * archive.h (class Archive): Update declarations.
10779         * object.h (Object::read): Make non-const.
10780         * Makefile.am (CCFILES): Add descriptors.cc.
10781         (HFILES): Add descriptors.h.
10782         * Makefile.in: Rebuild.
10783
10784         PR 6716
10785         * gold.h: Always include <clocale>.  Add Solaris workarounds
10786         following code in binutils/sysdep.h.
10787
10788         PR 6048
10789         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10790         this->eh_frame_hdr_ is NULL before using it.
10791
10792         * dynobj.cc (Versions::Versions): Update comment.
10793
10794         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10795         the base version name.
10796
10797         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10798         array size plus one.
10799         (Stringpool_template::set_string_offsets): Subtract one from key
10800         before using it as an array index.
10801         (Stringpool_template::get_offset_with_length): Likewise.
10802         (Stringpool_template::write_to_buffer): Likewise.
10803         * stringpool.h (Stringpool_template::get_offset_from_key):
10804         Likewise.
10805
10806 2008-07-23  Ian Lance Taylor  <iant@google.com>
10807
10808         PR 6658
10809         * object.h (Merged_symbol_value::value): Do our best to handle a
10810         negative addend.
10811
10812         PR 6647
10813         * script.cc (Version_script_info::get_versions): Don't add empty
10814         version tag to return value.
10815         (Version_script_info::get_symbol_version_helper): Change return
10816         type to bool.  Add pversion parameter.  Change all callers.
10817         (script_register_vers_node): Don't require a non-NULL tag.
10818         * script.h (class Version_script_info): Update declarations.
10819         (Version_script_info::get_symbol_version): Change return type to
10820         bool.  Add version parameter.  Change all callers.
10821         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10822         handling.  Handle an empty version from a version script.
10823         (Symbol_table::define_special_symbol): Likewise.
10824         * testsuite/ver_test_10.script: New file.
10825         * testsuite/ver_test_10.sh: New file.
10826         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10827         (check_DATA): Add ver_test_10.syms.
10828         (ver_test_10.syms, ver_test_10.so): New target.
10829         * testsuite/Makefile.in: Rebuild.
10830
10831 2008-07-23  Simon Baldwin  <simonb@google.com>
10832
10833         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10834         to zero for undefined symbols from dynamic libraries.
10835
10836 2008-07-23  Ian Lance Taylor  <iant@google.com>
10837
10838         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10839         Change all callers.
10840         * symtab.h (class Symbol_table): Update declaration.
10841         * testsuite/ver_test_9.cc: New file.
10842         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10843         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10844         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10845         (ver_test_9.so, ver_test_9.o): New targets.
10846         * testsuite/Makefile.in: Rebuild.
10847
10848 2008-07-22  Ian Lance Taylor  <iant@google.com>
10849
10850         * options.h (class General_options): Define --check-sections.
10851         * layout.cc (Layout::set_segment_offsets): Handle
10852         --check-sections.
10853
10854         * options.h (class General_options): Define -n/--nmagic and
10855         -N/--omagic.
10856         * options.cc (General_options::finalize): For -n/--nmagic or
10857         -N/--omagic, set -static.
10858         * layout.cc (Layout::attach_allocated_section_to_segment): If
10859         -N/--omagic, don't put read-only and read-write sections in
10860         different segments.
10861         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10862         finding a read-only segment.
10863         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10864         don't set the minimum segment alignment to the common page size,
10865         and don't set the file offset to the address modulo the page size.
10866         * script-sections.cc (Script_sections::create_segments): If
10867         -n/--omagic, don't put read-only and read-write sections in
10868         different segments.
10869
10870         * cref.cc: New file.
10871         * cref.h: New file.
10872         * options.h (class General_options): Add --print-symbol-counts.
10873         * main.cc (main): Issue defined symbol report if requested.
10874         * archive.cc (Archive::interpret_header): Make into a const member
10875         function.
10876         (Archive::add_symbols): Call Input_objects::archive_start and
10877         archive_stop.
10878         (Archive::const_iterator): Define new class.
10879         (Archive::begin, Archive::end): New functions.
10880         (Archive::include_all_members): Rewrite to use iterator.
10881         (Archive::count_members): New function.
10882         * archive.h (class Archive): Update declarations.
10883         (Archive::filename): New function.
10884         * object.cc: Include "cref.h".
10885         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10886         (Sized_relobj::do_get_global_symbol_counts): New function.
10887         (Input_objects::add_object): Add object to cross-referencer.
10888         (Input_objects::archive_start): New function.
10889         (Input_objects::archive_stop): New function.
10890         (Input_objects::print_symbol_counts): New function.
10891         * object.h: Declare Cref and Archive.
10892         (Object::get_global_symbol_counts): New function.
10893         (Object::do_get_global_symbol_counts): New pure virtual function.
10894         (class Sized_relobj): Add defined_count_ field.  Update
10895         declarations.
10896         (class Input_objects): Add cref_ field.  Update constructor.
10897         Update declarations.
10898         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10899         defined_count_.
10900         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10901         symbol counts.
10902         (Sized_dynobj::do_get_global_symbol_counts): New function.
10903         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10904         defined_count_.  Update declarations.  Define Symbols typedef.
10905         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10906         parameter.  Change all callers.
10907         (Symbol_table::add_from_dynobj): Add sympointers and defined
10908         parameters.  Change all callers.
10909         * symtab.h (class Symbol_table): Update declarations.
10910         * Makefile.am (CCFILES): Add cref.cc.
10911         (HFILES): Add cref.h.
10912         * Makefile.in: Rebuild.
10913
10914 2008-07-22  Simon Baldwin  <simonb@google.com>
10915
10916         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10917         to zero when writing undefined symbols.
10918
10919 2008-07-22  Ian Lance Taylor  <iant@google.com>
10920
10921         * output.cc (Output_section::add_input_section): Don't try to
10922         merge empty merge sections.
10923
10924 2008-07-21  Craig Silverstein  <csilvers@google.com>
10925
10926         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10927         Include symbol version in error message.
10928
10929 2008-07-20  Chris Demetriou  <cgd@google.com>
10930
10931         * configure.ac (gold_cv_c_random_seed): New configured variable.
10932         (RANDOM_SEED_CFLAGS): New substituted variable.
10933         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10934         * configure: Rebuild.
10935         * Makefile.in: Likewise.
10936         * testsuite/Makefile.in: Likewise.
10937
10938 2008-07-18  Ian Lance Taylor  <iant@google.com>
10939
10940         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10941         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10942         * testsuite/ver_test_main.cc (main): Call t4.
10943         (t4, t4_2a): Define.
10944         * testsuite/ver_test_2.cc (t4_2): Define.
10945         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10946         * testsuite/ver_test_4.cc (t4_2a): Define.
10947         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10948         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10949
10950 2008-07-17  Ian Lance Taylor  <iant@google.com>
10951
10952         * dynobj.cc (Versions::add_def): If we give an error about a
10953         missing version, go ahead and create the version anyhow.
10954
10955 2008-07-10  Ian Lance Taylor  <iant@google.com>
10956
10957         Handle output sections with more than 0x7fffffff bytes.
10958         * object.h (class Relobj): Change map_to_output_ to
10959         output_sections_, and just keep a section pointer.  Change all
10960         uses.  Move comdat group support to Sized_relobj.
10961         (Relobj::is_section_specially_mapped): Remove.
10962         (Relobj::output_section): Remove poff parameter.  Change all
10963         callers.
10964         (Relobj::output_section_offset): New function.
10965         (Relobj::set_section_offset): Rewrite.
10966         (Relobj::map_to_output): Remove.
10967         (Relobj::output_sections): New function.
10968         (Relobj::do_output_section_offset): New pure virtual function.
10969         (Relobj::do_set_section_offset): Likewise.
10970         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10971         group support from Relobj.  Update declarations.
10972         (Sized_relobj::get_output_section_offset): New function.
10973         (Sized_relobj::do_output_section_offset): New function.
10974         (Sized_relobj::do_set_section_offset): New function.
10975         * object.cc (Relobj::output_section_address): Remove.
10976         (Sized_relobj::Sized_relobj): Initialize new fields.
10977         (Sized_relobj::include_section_group): Cast find_kept_object to
10978         Sized_relobj.
10979         (Sized_relobj::include_linkonce_section): Likewise.
10980         (Sized_relobj::do_layout): Use separate arrays for output section
10981         and output offset.
10982         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10983         output_sections.
10984         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10985         output_sections and section_offsets.
10986         (Sized_relobj::write_local_symbols): Likewise.
10987         (map_to_kept_section): Compute output address directly.
10988         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10989         output_sections and section_offsets.
10990         (Sized_relobj::write_sections): Likewise.
10991         (Sized_relobj::relocate_sections): Likewise.
10992         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10993         * output.h (class Output_reloc): Update declarations.  Change
10994         u2_.relobj to Sized_relobj*.
10995         (class Output_data_reloc): Change add functions to use
10996         Sized_relobj*.
10997         * output.cc (Output_reloc::Output_reloc): Change relobj to
10998         Sized_relobj*.
10999         (Output_reloc::local_section_offset): Change return type to
11000         Elf_Addr.  Use get_output_section_offset.
11001         (Output_reloc::get_address): Likewise.
11002         (Output_section::is_input_address_mapped): Don't call
11003         is_section_specially_mapped.
11004         (Output_section::output_offset): Likewise.
11005         (Output_section::output_address): Likewise.
11006         (Output_section::starting_output_address): Likewise.
11007         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11008         parameter to Sized_relobj*.
11009         (Copy_relocs::need_copy_reloc): Likewise.
11010         (Copy_relocs::save): Likewise.
11011         * copy-relocs.h (class Copy_relocs): Update declarations.
11012         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11013         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11014         * target-reloc.h (relocate_for_relocatable): Change
11015         offset_in_output_section type to Elf_Addr.  Change code that uses
11016         it as well.
11017         * layout.cc (Layout::layout): Always set *off.
11018         * mapfile.cc (Mapfile::print_input_section): Use
11019         output_section_offset.
11020         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11021         Sized_relobj*.
11022         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11023         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11024         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11025
11026 2008-07-03  Ian Lance Taylor  <iant@google.com>
11027
11028         * layout.cc (Layout::include_section): Do not discard unrecognized
11029         SHT_STRTAB sections.
11030
11031 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11032
11033         * script.cc (Lex::can_continue_name): Make '?' allowable in
11034         version-script names.
11035         * testsuite/version_script.map: Change glob pattern to use '?'
11036
11037 2008-06-30  Manish Singh  <yosh@gimp.org>
11038
11039         PR 6585
11040         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11041         Correct typo.
11042
11043 2008-06-30  Ian Lance Taylor  <iant@google.com>
11044
11045         PR 6660
11046         PR 6682
11047         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11048         versions]: Don't try to read the value in the contents, since we
11049         don't use it.  Use the template endianness when writing.
11050
11051 2008-06-25  Cary Coutant  <ccoutant@google.com>
11052
11053         * fileread.cc (File_read::make_view): Assert on zero-length view.
11054         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11055         symbol table when there are no symbols to read.
11056
11057 2008-06-23  Craig Silverstein  <csilvers@google.com>
11058
11059         * version.cc (version_string): Bump to 1.7
11060
11061 2008-06-18  Craig Silverstein  <csilvers@google.com>
11062
11063         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11064         constant 0xFFFF to type Valtype.
11065         (Powerpc_relocate_functions::rel16_ha): Likewise.
11066
11067 2008-06-17  Ian Lance Taylor  <iant@google.com>
11068
11069         * output.h (Output_section::Input_section): Initialize p2align_ to
11070         zero for Output_section_data constructors.
11071         (Output_section::Input_section::addralign): If not an input
11072         section, return the alignment of the Output_section_data.
11073         * testsuite/copy_test.cc: New file.
11074         * testsuite/copy_test_1.cc: New file.
11075         * testsuite/copy_test_2.cc: New file.
11076         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11077         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11078         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11079         (copy_test_1_pic.o, copy_test_1.so): New targets.
11080         (copy_test_2_pic.o, copy_test_2.so): New targets.
11081         * testsuite/Makefile.in: Rebuild.
11082
11083         * script-sections.cc (Script_sections::place_orphan): Initialize
11084         local variable exact.
11085
11086 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11087
11088         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11089
11090 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11091             David S. Miller  <davem@davemloft.net>
11092
11093         * powerpc.cc: New file.
11094         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11095         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11096         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11097         * Makefile.in: Rebuild.
11098
11099 2008-06-09  Ian Lance Taylor  <iant@google.com>
11100
11101         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11102         <exception>.
11103         (throwing, orig_terminate): New static variables.
11104         (terminate_handler): New static function.
11105         (t2): Set terminate handler.
11106
11107 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11108
11109         PR 6584
11110         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11111         alignment.
11112
11113 2008-05-30  Cary Coutant  <ccoutant@google.com>
11114
11115         * archive.cc (Archive::include_all_members) Correct to step
11116         over symbol table and extended name table in thin archives.
11117
11118 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11119
11120         PR 6407
11121         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11122         calculation.
11123
11124 2008-05-28  Caleb Howe  <cshowe@google.com>
11125
11126         * reduced_debug_output.cc: New file.
11127         * reduced_debug_output.h: New file.
11128         * options.h (class General_options): Add --strip-debug-non-line.
11129         * options.cc (General_options::finalize): Add strip_debug_non_line
11130         to the strip heirarchy.
11131         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11132         fields.
11133         * layout.cc: Include "reduced_debug_output.h".
11134         (Layout::Layout): Initialize new fields.
11135         (line_only_debug_sections): New static array.
11136         (is_lines_only_debug_sections): New static inline function.
11137         (Layout::include_section): Handle --strip-debug-non-line.
11138         (Layout::make_output_section): If --strip-debug-non-line, build
11139         new output sections for .debug_abbrev and .debug_info.
11140         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11141         gold.  Warn about possible overflow.
11142         (read_signed_LEB_128): Likewise.
11143         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11144         (read_signed_LEB_128): Declare.
11145         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11146         (HFILES): Add reduced_debug_output.h.
11147         * Makefile.in: Rebuild.
11148
11149 2008-05-21  Ian Lance Taylor  <iant@google.com>
11150
11151         * mapfile.cc: New file.
11152         * mapfile.h: New file.
11153         * options.h (class General_options): Add -M/--print-map and -Map.
11154         * options.cc (General_options::finalize): Make -M equivalent to
11155         -Map -.
11156         * main.cc: Include <cstdio> and "mapfile.h".
11157         (main): Open mapfile if requested.
11158         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11159         constructor.  Change caller.
11160         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11161         (queue_middle_tasks): Likewise.
11162         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11163         declarations.
11164         * archive.cc: Include "mapfile.h".
11165         (Archive::add_symbols): Add mapfile parameter.  Change all
11166         callers.  Pass mapfile, symbol, and reason to include_member.
11167         (Archive::include_all_members): Add mapfile parameter.  Change all
11168         callers.
11169         (Archive::include_member): Add mapfile, sym, and why parameters.
11170         Change all callers.  Report inclusion to map file.
11171         * archive.h: Include "fileread.h".
11172         (class Archive): Update declarations.
11173         (Archive::file): New const method.
11174         (class Add_archive_symbols): Add mapfile_ field.  Update
11175         constructor.  Change all callers.
11176         * readsyms.h (class Read_symbols): Likewise.
11177         (class Finish_group): Likewise.
11178         (class Read_script): Likewise.
11179         * common.cc: Include "mapfile.h".
11180         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11181         all callers.
11182         (Symbol_table::do_allocate_commons): Likewise.
11183         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11184         symbol allocation to mapfile.
11185         * common.h (class Allocate_commons_task): Add mapfile_ field.
11186         Update constructor.  Change all callers.
11187         * symtab.h (class Symbol_table): Update declarations.
11188         * layout.cc: Include "mapfile.h".
11189         (Layout_task_runner::run): Print information to mapfile.
11190         (Layout::create_gold_note): Change Output_data_fixed_space to
11191         Output_data_zero_fill.
11192         (Layout::create_build_id): Likewise.
11193         (Layout::print_to_mapfile): New function.
11194         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11195         constructor.  Change caller.
11196         (class Layout): Declare print_to_mapfile.
11197         * output.cc (Output_section::Input_section::print_to_mapfile): New
11198         function.
11199         (Output_section::add_input_section): If producing a map, always
11200         add to input_sections_ list.
11201         (Output_section::do_print_to_mapfile): New function.
11202         (Output_segment::print_sections_to_mapfile): New function.
11203         (Output_segment::print_section_list_to_mapfile): New function.
11204         * output.h: Include "mapfile.h".
11205         (Output_data::print_to_mapfile): New function.
11206         (Output_data::do_print_to_mapfile): New virtual function.
11207         (Output_segment_headers::do_print_to_mapfile): New function.
11208         (Output_file_header::do_print_to_mapfile): New function.
11209         (Output_data_const::do_print_to_mapfile): New function.
11210         (class Output_data_const_buffer): Add map_name_ field.  Update
11211         constructor.  Change all callers.  Add do_print_to_mapfile
11212         function.
11213         (class Output_data_fixed_space): Likewise.
11214         (class Output_data_space): Likewise.
11215         (class Output_data_zero_fill): New class.
11216         (Output_data_strtab::do_print_to_mapfile): New function.
11217         (Output_data_reloc_base::do_print_to_mapfile): New function.
11218         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11219         (Output_data_group::do_print_to_mapfile): New function.
11220         (Output_data_got::do_print_to_mapfile): New function.
11221         (Output_data_dynamic::do_print_to_mapfile): New function.
11222         (Output_symtab_xindex::do_print_to_mapfile): New function.
11223         (class Output_section): Declare do_print_to_mapflie.  Declare
11224         print_to_mapfile in Input_section.
11225         (class Output_segment): Declare new functions.
11226         * object.h (Sized_relobj::symbol_count): New function.
11227         * script-sections.cc
11228         (Output_section_element_dot_assignment::set_section_addresses):
11229         Change Output_data_fixed_space to Output_data_zero_fill.
11230         (Output_data_expression::do_print_to_mapfile): New function.
11231         * script.cc (read_input_script): Add mapfile parameter.  Change
11232         all callers.
11233         * script.h (read_input_script): Update declaration.
11234         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11235         (Eh_frame::do_print_to_mapfile): New function.
11236         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11237         (Output_merge_string::do_print_to_mapfile): New function.
11238         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11239         function.
11240         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11241         function.
11242         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11243         function.
11244         * Makefile.am (CCFILES): Add mapfile.cc.
11245         (HFILES): Add mapfile.h.
11246         * Makefile.in: Rebuild.
11247
11248 2008-05-19  Ian Lance Taylor  <iant@google.com>
11249
11250         * options.h (class General_options): Add -z relro.
11251         * layout.cc (Layout::Layout): Initialize relro_segment_.
11252         (Layout::add_output_section_data): Return the output section.
11253         (Layout::make_output_section): Rcognize relro sections and mark
11254         them appropriately.
11255         (Layout::attach_allocated_section_to_segment): Put relro sections
11256         in a PT_GNU_RELRO segment.
11257         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11258         section as relro.
11259         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11260         PT_TLS segments.
11261         (Layout::linkonce_mapping): Map d.rel.ro.local to
11262         .data.rel.ro.local.
11263         (Layout::output_section_name): Us .data.rel.ro.local for any
11264         section which begins with that.
11265         * layout.h (class Layout): Update add_output_section_data
11266         declaration.  Add relro_segment_ field.
11267         * output.cc (Output_section::Output_section): Initialize is_relro_
11268         and is_relro_local_ fields.
11269         (Output_segment::add_output_section): Group relro sections.
11270         (Output_segment::is_first_section_relro): New function.
11271         (Output_segment::maximum_alignment): If there is a relro section,
11272         align the segment to the common page size.
11273         (Output_segment::set_section_addresses): Track whether we are
11274         looking at relro sections.  If the last section is a relro
11275         section, align to the common page size.
11276         (Output_segment::set_section_list_addresses): Add in_relro
11277         parameter.  Change all callers.  Align to the page size when
11278         moving from relro to non-relro section.
11279         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11280         segment.
11281         * output.h (class Output_section): Add is_relro_ and
11282         is_relro_local_ fields.
11283         (Output_section::is_relro): New function.
11284         (Output_section::set_is_relro): New function.
11285         (Output_section::is_relro_local): New function.
11286         (Output_section::set_is_relro_local): New function.
11287         (class Output_segment): Update declarations.
11288         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11289         * sparc.cc (Target_sparc::got_section): Likewise.
11290         * x86_64.cc (Target_x86_64::got_section): Likewise.
11291         * testsuite/relro_test_main.cc: New file.
11292         * testsuite/relro_test.cc: New file.
11293         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11294         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11295         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11296         (relro_test.so, relro_test_pic.o): New targets.
11297         * testsuite/Makefile.in: Rebuild.
11298
11299 2008-05-16  Ian Lance Taylor  <iant@google.com>
11300
11301         * output.cc (Output_segment::add_output_section): Remove front
11302         parameter.
11303         * output.h (class Output_segment): Remove
11304         add_initial_output_section and overloaded add_output_section.
11305         Update declaration of remaining add_output_section.
11306         * layout.cc (Layout::create_interp): Call add_output_section
11307         rather than add_initial_output_section.
11308         (Layout::finish_dynamic_section): Likewise.
11309
11310         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11311         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11312         know the dynamic type.
11313         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11314         field.  Initialize it in constructor.
11315         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11316         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11317         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11318         reloc.
11319
11320         * output.cc (Output_reloc::get_address): Change return type to
11321         Elf_Addr.
11322         * output.h (class Output_reloc): Update get_address declaration.
11323         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11324         for section addresses.
11325
11326 2008-05-09  Ian Lance Taylor  <iant@google.com>
11327
11328         PR 6493
11329         * gold.cc (gold_nomem): Use return value of write.
11330
11331 2008-05-08  Ian Lance Taylor  <iant@google.com>
11332
11333         * symtab.c (Symbol::init_base_output_data): Add version
11334         parameter.  Change all callers.
11335         (Symbol::init_base_output_segment): Likewise.
11336         (Symbol::init_base_constant): Likewise.
11337         (Symbol::init_base_undefined): Likewise.
11338         (Sized_symbol::init_output_data): Likewise.
11339         (Sized_symbol::init_output_segment): Likewise.
11340         (Sized_symbol::init_constant): Likewise.
11341         (Sized_symbol::init_undefined): Likewise.
11342         (Symbol_table::do_define_in_output_data): If the new symbol has a
11343         version, mark it as the default.
11344         (Symbol_table::do_define_in_output_segment): Likewise.
11345         (Symbol_table::do_define_as_constant): Likewise.
11346         * symtab.h (class Symbol): Update declarations.
11347         (class Sized_symbol): Likewise.
11348         * resolve.cc (Symbol::override_version): New function.
11349         (Symbol::override_base): Call override_version.
11350         (Symbol::override_base_with_special): Likewise.
11351         * testsuite/ver_script_8.script: New file.
11352         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11353         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11354         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11355         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11356
11357 2008-05-06  Ian Lance Taylor  <iant@google.com>
11358
11359         PR 6049
11360         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11361         functions.
11362         (class General_options): Remove existing --undefined, and add
11363         --no-undefined instead.  Add new --undefined as synonym for -u.
11364         * archive.cc (Archive::add_symbols): Check whether symbol was
11365         named with -u.
11366         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11367         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11368         all uses.  Add IS_UNDEFINED.  Update declarations to split
11369         different versions of init_base.  Declare init_base_undefined.
11370         (Symbol::is_defined): Handle IS_UNDEFINED.
11371         (Symbol::is_undefined): Likewise.
11372         (Symbol::is_weak_undefined): Call is_undefined.
11373         (Symbol::is_absolute): Handle IS_CONSTANT.
11374         (class Sized_symbol): Update declarations to split different
11375         versions of init.  Declare init_undefined.
11376         (class Symbol_table): Declare new functions.
11377         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11378         Change all callers.
11379         (Symbol::init_base_output_data): Likewise.
11380         (Symbol::init_base_output_segment): Likewise.
11381         (Symbol::init_base_constant): Likewise.
11382         (Symbol::init_base_undefined): New function.
11383         (Sized_symbol::init_object): Rename from init.  Change all
11384         callers.
11385         (Sized_symbol::init_output_data): Likewise.
11386         (Sized_symbol::init_output_segment): Likewise.
11387         (Sized_symbol::init_constant): Likewise.
11388         (Sized_symbol::init_undefined): New function.
11389         (Symbol_table::add_undefined_symbols_from_command_line): New
11390         function.
11391         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11392         function.
11393         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11394         (Symbol::output_section): Likewise.
11395         (Symbol::set_output_section): Likewise.
11396         (Symbol_table::sized_finalize_symbol): Likewise.
11397         (Symbol_table::sized_write_globals): Likewise.
11398         * resolve.cc (Symbol_table::should_override): Likewise.
11399         (Symbol::override_base_with_special): Likewise.
11400
11401         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11402         symbol, change it to have default visibility.
11403         * testsuite/protected_1.cc: New file.
11404         * testsuite/protected_2.cc: New file.
11405         * testsuite/protected_3.cc: New file.
11406         * testsuite/protected_main_1.cc: New file.
11407         * testsuite/protected_main_2.cc: New file.
11408         * testsuite/protected_main_3.cc: New file.
11409         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11410         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11411         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11412         (protected_1.so): New target.
11413         (protected_1_pic.o, protected_2_pic.o): New targets.
11414         (protected_3_pic.o): New target.
11415         (check_PROGRAMS): Add protected_2.
11416         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11417         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11418         * testsuite/Makefile.in: Rebuild.
11419
11420         * options.h (DEFINE_var): Add set_user_set_##varname__.
11421         (DEFINE_bool_alias): New macro.
11422         (class General_options): Define -Bstatic using DEFINE_bool_alias
11423         rather than DEFINE_special.  Add --undefined as an alias for -z
11424         defs.
11425         * options.cc (General_options::parse_Bstatic): Remove.
11426
11427         * options.h (class General_options): Add --fatal-warnings.
11428         * main.cc (main): Implement --fatal-warnings.
11429         * errors.h (Errors::warning_count): New function.
11430
11431         * options.h (class General_options): Add -Bsymbolic-functions.
11432         * symtab.h (Symbol::is_preemptible): Check for
11433         -Bsymbolic-functions.
11434
11435 2008-05-05  Ian Lance Taylor  <iant@google.com>
11436
11437         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11438         as noVARNAME rather than no-VARNAME.
11439         (class General_options): Add option -z combreloc.
11440         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11441         get_address.
11442         (Output_reloc::sort_before) [SHT_REL]: New function.
11443         (Output_reloc::sort_before) [SHT_RELA]: New function.
11444         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11445         Sort_relocs_comparison.
11446         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11447         parameter.  Change all callers.
11448         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11449         sort_relocs parameter.  Change all callers.
11450         * output.cc (Output_reloc::get_address): New function, broken out
11451         of write_rel.
11452         (Output_reloc::write_rel): Call it.
11453         (Output_reloc::compare): New function.
11454         (Output_data_reloc_base::do_write): Optionally sort relocs.
11455
11456         * configure.ac: If targ_extra_obj is set, link it in.
11457         * configure.tgt: Initialize all variables.
11458         (x86_64*): Set targ_extra_obj and targ_extra_size.
11459         * configure: Rebuild.
11460
11461         * object.cc (Sized_relobj::include_section_group): Adjust section
11462         indexes read from group data.  Build vector to pass to
11463         layout_group.
11464         * layout.cc (Layout::layout_group): Add flags and shndxes
11465         parameters.  Remove contents parameter.  Change caller.  Update
11466         explicit instantiations.
11467         * layout.h (class Layout): Update layout_group declaration.
11468         * output.cc (Output_data_group::Output_data_group): Add flags and
11469         input_shndxes parameters.  Remove contents parameter.  Change
11470         caller.
11471         (Output_data_group::do_write): Change input_sections_ to
11472         input_shndxes_.
11473         * output.h (class Output_data_group): Update constructor
11474         declaration.  Rename input_sections_ to input_shndxes_.
11475         * testsuite/many_sections_test.cc: Add template.
11476
11477 2008-04-30  Cary Coutant  <ccoutant@google.com>
11478
11479         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11480
11481         * layout.cc (Layout::include_section): Refactored check for debug
11482         info section.
11483         (Layout::add_comdat): Add new parameters.  Change type
11484         of signature parameter.  Add object and shndx to signatures table.
11485         (Layout::find_kept_object): New function.
11486         * layout.h: Include <cstring>.
11487         (Layout::is_debug_info_section): New function.
11488         (Layout::add_comdat): Add new parameters.
11489         (Layout::find_kept_object): New function.
11490         (Layout::Kept_section): New struct.
11491         (Layout::Signatures): Change type of map range.
11492         * object.cc (Relobj::output_section_address): New function.
11493         (Sized_relobj::include_section_group): Add new parameters.  Change
11494         calls to Layout::add_comdat.  Change to build table of kept comdat
11495         groups and table mapping discarded sections to kept sections.
11496         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11497         (Sized_relobj::do_layout): Change calls to include_section_group and
11498         include_linkonce_section.
11499         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11500         value to zero when section is discarded.
11501         (Sized_relobj::map_to_kept_section): New function.
11502         * object.h (Relobj::output_section_address): New function.
11503         (Relobj::Comdat_group): New type.
11504         (Relobj::find_comdat_group): New function.
11505         (Relobj::Comdat_group_table): New type.
11506         (Relobj::Kept_comdat_section): New type.
11507         (Relobj::Kept_comdat_section_table): New type.
11508         (Relobj::add_comdat_group): New function.
11509         (Relobj::set_kept_comdat_section): New function.
11510         (Relobj::get_kept_comdat_section): New function.
11511         (Relobj::comdat_groups_): New field.
11512         (Relobj::kept_comdat_sections_): New field.
11513         (Symbol_value::input_value): Update comment.
11514         (Sized_relobj::map_to_kept_section) New function.
11515         (Sized_relobj::include_linkonce_section): Add new parameter.
11516         * target-reloc.h (Comdat_behavior): New type.
11517         (get_comdat_behavior): New function.
11518         (relocate_section): Add code to map a discarded section to the
11519         corresponding kept section when applying a relocation.
11520
11521 2008-04-30  Craig Silverstein  <csilvers@google.com>
11522
11523         * dwarf_reader.cc (next_generation_count): New static var.
11524         (Addr2line_cache_entry): New struct.
11525         (addr2line_cache): New static var.
11526         (Dwarf_line_info::one_addr2line): Added caching.
11527         (Dwarf_line_info::clear_addr2line_cache): New function.
11528         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11529         cache-size parameter.
11530         (Dwarf_line_info::one_addr2line_cache): New function.
11531         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11532         new cache-size argument to one_addr2line(), and clear cache.
11533
11534 2008-04-28  Cary Coutant  <ccoutant@google.com>
11535
11536         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11537         R_386_PC8 relocations.
11538
11539 2008-04-23  Ian Lance Taylor  <iant@google.com>
11540
11541         * object.cc (Sized_relobj::include_section_group): Check for
11542         invalid section group.
11543
11544         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11545         header size.
11546
11547         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11548         than read for file header.
11549         * archive.cc (Archive::include_member): Likewise.
11550
11551 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11552
11553         * aclocal.m4: Regenerate.
11554         * configure: Regenerate.
11555
11556 2008-04-19  Ian Lance Taylor  <iant@google.com>
11557
11558         * version.cc (version_string): Bump to 1.6.
11559
11560         * testsuite/Makefile.am (many_sections_r_test): New target.
11561         (many_sections_r_test_SOURCES): Remove.
11562         (many_sections_r_test_DEPENDENCIES): Remove.
11563         (many_sections_r_test_LDFLAGS): Remove.
11564         (many_sections_r_test_LDADD): Remove.
11565
11566         * object.cc (Sized_relobj::do_add_symbols): Always pass
11567         local_symbol_count_ to add_from_relobj.
11568
11569         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11570         every thousand variables.
11571         * testsuite/Makefile.in: Rebuild.
11572
11573         * object.cc (Xindex::initialize_symtab_xindex): New function.
11574         (Xindex::read_symtab_xindex): New function.
11575         (Xindex::sym_xindex_to_shndx): New function.
11576         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11577         available.
11578         (Sized_relobj::do_initialize_xindex): New function.
11579         (Sized_relobj::do_read_symbols): Adjust section links.
11580         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11581         parameter.  Change all callers.
11582         (Sized_relobj::include_section_group): Adjust section links and
11583         symbol section indexes.
11584         (Sized_relobj::do_layout): Adjust section links.
11585         (Sized_relobj::do_count_local_symbols): Adjust section links and
11586         symbol section indexes.
11587         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11588         ordinary and special symbols.
11589         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11590         dynsym_xindex parameters.  Change all callers.  Adjust section
11591         links.  Use SHN_XINDEX when needed.
11592         (Sized_relobj::get_symbol_location_info): Adjust section links.
11593         Don't get fooled by special symbols.
11594         * object.h (class Xindex): Define.
11595         (class Object): Add xindex_ parameter.  Declare virtual functoin
11596         do_initialize_xindex.
11597         (Object::adjust_sym_shndx): New function.
11598         (Object::set_xindex): New protected function.
11599         (class Symbol_value): Add is_ordinary_shndx_ field.
11600         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11601         (Symbol_value::value): Assert ordinary section.
11602         (Symbol_value::initialize_input_to_output_map): Likewise.
11603         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11604         Change all callers.
11605         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11606         all callers.
11607         (class Sized_relobj): Update declarations.
11608         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11609         parameter.  Change all callers.
11610         (Sized_relobj::adjust_shndx): New function.
11611         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11612         field.
11613         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11614         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11615         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11616         (Sized_dynobj::read_dynsym_section): Adjust section links.
11617         (Sized_dynobj::read_dynamic): Likewise.
11618         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11619         section links.
11620         (Sized_dynobj::do_initialize_xindex): New function.
11621         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11622         do_initialize_xindex.
11623         (Sized_dynobj::adjust_shndx): New function.
11624         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11625         dynsym_xindex_ fields.
11626         (Layout::finalize): Add a call to set_section_indexes before
11627         creating the symtab sections.
11628         (Layout::set_section_indexes): Don't do anything if the section
11629         already has a section index.
11630         (Layout::create_symtab_sections): Add shnum parameter.  Change
11631         caller.  Create .symtab_shndx section if needed.
11632         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11633         caller.
11634         (Layout::allocated_output_section_count): New function.
11635         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11636         needed.
11637         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11638         fields.  Update declarations.
11639         (Layout::symtab_xindex): New function.
11640         (Layout::dynsym_xindex): New function.
11641         (class Write_symbols_task): Add layout_ field.
11642         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11643         Change caller.
11644         * output.cc (Output_section_headers::Output_section_headers): Add
11645         shstrtab_section parameter.  Change all callers.
11646         (Output_section_headers::do_sized_write): Store overflow values
11647         for section count and section string table section index in
11648         section header zero.
11649         (Output_file_header::do_sized_write): Check for overflow of
11650         section count and section string table section index.
11651         (Output_symtab_xindex::do_write): New function.
11652         (Output_symtab_xindex::endian_do_write): New function.
11653         * output.h (class Output_section_headers): Add shstrtab_section_.
11654         Update declarations.
11655         (class Output_symtab_xindex): Define.
11656         (Output_section::has_out_shndx): New function.
11657         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11658         field.
11659         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11660         Change all callers.
11661         (Sized_symbol::init): Likewise.
11662         (Symbol::output_section): Check for ordinary symbol.
11663         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11664         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11665         callers.
11666         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11667         Change all callers.  Simplify handling of symbols from sections
11668         not included in the link.
11669         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11670         distinction.
11671         (Weak_alias_sorter::operator()): Assert that symbols are
11672         ordinary.
11673         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11674         distinction.
11675         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11676         parameters.  Change all callers.
11677         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11678         symbol distinction.  Use SHN_XINDEX when needed.
11679         (Symbol_table::write_section_symbol): Add symtab_xindex
11680         parameter.  Change all callers.
11681         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11682         SHN_XINDEX when needed.
11683         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11684         declarations.
11685         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11686         (Symbol::is_defined): Check is_ordinary.
11687         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11688         (Symbol::is_absolute, Symbol::is_common): Likewise.
11689         (class Sized_symbol): Update declarations.
11690         (class Symbol_table): Update declarations.
11691         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11692         parameters.  Change all callers.
11693         (Sized_symbol::override): Likewise.
11694         (Symbol_table::override): Likewise.
11695         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11696         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11697         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11698         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11699         to be in an ordinary section.
11700         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11701         object and is_ordinary parameters.  Change all callers.
11702         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11703         Change all callers.  Don't add undefined or non-ordinary symbols
11704         to reloc_map_.
11705         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11706         Change all callers.
11707         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11708         declarations.
11709         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11710         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11711         (Sized_relobj::relocate_sections): Likewise.
11712         * target-reloc.h (scan_relocs): Adjust section symbol index.
11713         (scan_relocatable_relocs): Likewise.
11714         * i386.cc (Scan::local): Check for ordinary symbols.
11715         * sparc.cc (Scan::local): Likewise.
11716         * x86_64.cc (Scan::local): Likewise.
11717         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11718         to symbol_section_and_value.
11719         * testsuite/many_sections_test.cc: New file.
11720         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11721         (check_PROGRAMS): Add many_sections_test.
11722         (many_sections_test_SOURCES): Define.
11723         (many_sections_test_DEPENDENCIES): Define.
11724         (many_sections_test_LDFLAGS): Define.
11725         (BUILT_SOURCES): Add many_sections_define.h.
11726         (many_sections_define.h): New target.
11727         (BUILT_SOURCES): Add many_sections_check.h.
11728         (many_sections_check.h): New target.
11729         (check_PROGRAMS): Add many_sections_r_test.
11730         (many_sections_r_test_SOURCES): Define.
11731         (many_sections_r_test_DEPENDENCIES): Define.
11732         (many_sections_r_test_LDFLAGS): Define.
11733         (many_sections_r_test_LDADD): Define.
11734         (many_sections_r_test.o): New target.
11735         * testsuite/Makefile.in: Rebuild.
11736
11737 2008-04-17  Cary Coutant  <ccoutant@google.com>
11738
11739         * errors.cc (Errors::info): New function.
11740         (gold_info): New function.
11741         * errors.h (Errors::info): New function.
11742         * gold.h (gold_info): New function.
11743         * object.cc (Input_objects::add_object): Print trace output.
11744         * options.cc (options::parse_set): New function.
11745         (General_options::parse_wrap): Deleted.
11746         (General_options::General_options): Deleted initializer.
11747         * options.h (options::String_set): New typedef.
11748         (options::parse_set): New function.
11749         (DEFINE_set): New macro.
11750         (General_options::wrap): Changed to use DEFINE_set. Changed
11751         callers of any_wrap_symbols and is_wrap_symbol.
11752         (General_options::trace, General_options::trace_symbol):
11753         New options.
11754         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11755         (General_options::wrap_symbols_): Deleted.
11756         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11757
11758 2008-04-17  David S. Miller  <davem@davemloft.net>
11759
11760         * options.cc (General_options::parse_V): New function.
11761         * options.h: Add entries for -V and -Qy.
11762
11763 2008-04-17  Ian Lance Taylor  <iant@google.com>
11764
11765         * common.cc (Symbol_table::allocate_commons): Remove options
11766         parameter.  Change caller.
11767         (Symbol_table::do_allocate_commons): Remove options parameter.
11768         Change caller.  Just call do_allocate_commons_list twice.
11769         (Symbol_table::do_allocate_commons_list): New function, broken out
11770         of do_allocate_commons.
11771         * common.h (class Allocate_commons_task): Remove options_ field.
11772         Update constructor.
11773         * symtab.cc (Symbol_table::Symbol_table): Initialize
11774         tls_commons_.
11775         (Symbol_table::add_from_object): Put TLS common symbols on
11776         tls_commons_ list.
11777         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11778         which are IN_OUTPUT_DATA.
11779         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11780         allocate_commons and do_allocate_commons declarations.  Declare
11781         do_allocate_commons_list.
11782         * gold.cc (queue_middle_tasks): Update creation of
11783         Allocate_commons_task to not pass options.
11784         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11785         (TLS_TEST_C_FLAGS): New variable.
11786         (tls_test_c_pic.o): New target.
11787         (tls_test_shared.so): Link in tls_test_c_pic.o.
11788         (tls_test_c_pic_ie.o): New target.
11789         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11790         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11791         (tls_test_c.o): New target.
11792         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11793         (tls_pic_test_LDADD): Likewise.
11794         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11795         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11796         (tls_test_c_gnu2.o): New target.
11797         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11798         tls_test_c_gnu2.o.
11799         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11800         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11801         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11802         * testsuite/tls_test.cc: Include "config.h".
11803         (t_last): Call t11_last.
11804         * testsuite/tls_test.h (t11, t11_last): Declare.
11805         * testsuite/tls_test_c.c: New file.
11806         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11807         * configure.ac: Check for OpenMP support.
11808         * configure, config.in, Makefile.in: Rebuild.
11809         * testsuite/Makefile.in: Rebuild.
11810
11811 2008-04-16  Cary Coutant  <ccoutant@google.com>
11812
11813         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11814         (Target_i386::tls_base_symbol_defined_): New field.
11815         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11816         (Target_i386::Scan::global): Likewise.
11817         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11818         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11819         (Target_x86_64::tls_base_symbol_defined_): New field.
11820         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11821         (Target_x86_64::Scan::global): Likewise.
11822
11823 2008-04-16  Cary Coutant  <ccoutant@google.com>
11824
11825         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11826         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11827         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11828         building shared libraries.
11829         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11830         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11831         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11832         * testsuite/Makefile.in: Rebuild.
11833         * testsuite/weak_undef.h: New file.
11834         * testsuite/weak_undef_file1.cc: Add extra test cases.
11835         * testsuite/weak_undef_file2.cc: Likewise.
11836         * testsuite/weak_undef_test.cc: Likewise.
11837
11838 2008-04-16  David S. Miller  <davem@davemloft.net>
11839
11840         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11841         Add issued_non_pic_error_ field.  Declare check_non_pic.
11842         (Target_sparc::Scan::check_non_pic): New function.
11843         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11844         (Target_sparc::Scan::global): Likewise.
11845
11846         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11847         * configure: Rebuild.
11848
11849         * options.h (DEFINE_enable): New macro.
11850         (new_dtags): New enable option.
11851         (initfirst, interpose, loadfltr, nodefaultlib,
11852         nodelete, nodlopen, nodump): New -z options.
11853         * layout.cc (Layout:finish_dynamic_section): If new
11854         dtags enabled, emit DT_RUNPATH.  Also, emit a
11855         DT_FLAGS_1 containing any specified -z flags.
11856
11857 2008-04-16  Ian Lance Taylor  <iant@google.com>
11858
11859         * copy-relocs.cc: New file.
11860         * copy-relocs.h: New file.
11861         * reloc.cc: Remove Copy_relocs code.
11862         * reloc.h: Likewise.
11863         * reloc-types.h (struct Reloc_types) [both versions]: Add
11864         get_reloc_addend_noerror.
11865         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11866         variants of add_global which take an addend which must be zero.
11867         * i386.cc: Include "copy-relocs.h".
11868         (class Target_i386): Change type of copy_relocs_ to variable,
11869         update initializer.
11870         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11871         Change all callers.
11872         (Target_i386::do_finalize_sections): Change handling of
11873         copy_relocs_.
11874         * sparc.cc: Include "copy-relocs.h".
11875         (class Target_sparc): Change type of copy_relocs_ to variable,
11876         update initializer.
11877         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11878         Change all callers.
11879         (Target_sparc::do_finalize_sections): Change handling of
11880         copy_relocs_.
11881         * x86_64.cc: Include "copy-relocs.h".
11882         (class Target_x86_64): Change type of copy_relocs_ to variable,
11883         update initializer.
11884         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11885         class.  Change all callers.
11886         (Target_x86_64::do_finalize_sections): Change handling of
11887         copy_relocs_.
11888         * Makefile.am (CCFILES): Add copy-relocs.cc.
11889         (HFILES): Add copy-relocs.h.
11890
11891         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11892
11893         * testsuite/script_test_4.sh: Permit leading zeroes.
11894
11895 2008-04-15  Ian Lance Taylor  <iant@google.com>
11896
11897         * script-sections.cc (Script_sections::create_segments): Use
11898         header_size_adjustment even when there is enough room for the
11899         headers.
11900         * testsuite/script_test_4.sh: New file.
11901         * testsuite/script_test_4.t: New file.
11902         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11903         (check_DATA): Add script_test_4.stdout.
11904         (MOSTLYCLEANFILES): Likewise.
11905         (script_test_4): New target.
11906         (script_test_4.stdout): New target.
11907         * testsuite/Makefile.in: Rebuild.
11908
11909         * sparc.cc: Add definitions for Output_data_plt_sparc class
11910         constants.
11911
11912 2008-04-14  David S. Miller  <davem@davemloft.net>
11913
11914         * sparc.cc: New file.
11915         * Makefile.am (TARGETSOURCES): Add sparc.cc
11916         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11917         * configure.tgt: Document targ_extra_size and
11918         targ_extra_big_endian.  Add entries for sparc-* and
11919         sparc64-*.
11920         * configure.ac: Handle targ_extra_size and
11921         targ_extra_big_endian.
11922         * Makefile.in: Rebuild.
11923         * configure: Likewise.
11924         * po/POTFILES.in: Likewise.
11925         * po/gold.pot: Likewise.
11926
11927 2008-04-14  Ian Lance Taylor  <iant@google.com>
11928
11929         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11930         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11931         in the name/type/flags to section mapping.  Don't call
11932         allocate_output_section.
11933         (Layout::choose_output_section): Change parameter from adjust_name
11934         to is_input_section.  Don't permit input sections after sections
11935         are attached to segments.  Don't call allocate_output_section.
11936         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11937         not write_enable_output_section.
11938         (Layout::make_output_section): Don't push to
11939         unattached_section_list_ nor call attach_to_segment.  Call
11940         attach_section_to_segment if sections are attached.
11941         (Layout::attach_sections_to_segments): New function.
11942         (Layout::attach_section_to_segment): New function.
11943         (Layout::attach_allocated_section_to_segment): Rename from
11944         attach_to_segment.  Remove flags parameter.
11945         (Layout::allocate_output_section): Remove function.
11946         (Layout::write_enable_output_section): Remove function.
11947         * layout.h (class Layout): Update for above changes.  Add new
11948         field sections_are_attached_.
11949         * output.h (Output_section::update_flags_for_input_section): New
11950         function.
11951         * output.cc (Output_section::add_input_section): Call
11952         update_flags_for_input_section.
11953         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11954
11955 2008-04-11  Cary Coutant  <ccoutant@google.com>
11956
11957         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11958         thought unnecessary.
11959         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11960
11961 2008-04-11  Ian Lance Taylor  <iant@google.com>
11962
11963         * output.h (class Output_section_data): Remove inline definition
11964         of set_addralign.
11965         * output.cc (Output_section_data::set_addralign): New function.
11966
11967 2008-04-11  Cary Coutant  <ccoutant@google.com>
11968
11969         Add support for TLS descriptors for i386 and x86_64.
11970         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11971         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11972         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11973         GOT_TYPE_TLS_DESC.
11974         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11975         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11976         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11977         relocations.
11978         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11979         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11980         Fix problem with initial-exec relocations.
11981         (Target_i386::Relocate::relocate_tls): Likewise.
11982         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11983         relaxation.
11984         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11985         support for section-plus-offset dynamic table entries.
11986         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11987         (Output_data_dynamic::Dynamic_entry): Add support for
11988         section-plus-offset dynamic table entries.
11989         (Output_data_dynamic::Classification): Likewise.
11990         (Output_data_dynamic::classification_): Renamed offset_.
11991         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11992         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11993         (Target_x86_64::make_plt_section): New function.
11994         (Target_x86_64::reserve_tlsdesc_entries): New function.
11995         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11996         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11997         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11998         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11999         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12000         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12001         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12002         add extra PLT entry for TLS descriptors.
12003         (Output_data_plt_x86_64::got_): New field.
12004         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12005         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12006         fields.
12007         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12008         descriptors.
12009         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12010         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12011         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12012         R_386_TLS_DESC_CALL relocations.
12013         (Target_x86_64::Scan::global): Likewise.
12014         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12015         for TLS descriptors.
12016         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12017         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12018         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12019         GD-to-IE relaxation.
12020         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12021         and TLS_DESCRIPTORS.
12022         * Makefile.in: Rebuild.
12023         * configure: Rebuild.
12024         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12025         (tls_test_shared2.so): New target.
12026         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12027         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12028         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12029         (tls_shared_gd_to_ie_test_LDADD): New variable.
12030         (tls_shared_gnu2_gd_to_ie_test): New target.
12031         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12032         New targets.
12033         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12034         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12035         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12036         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12037         (tls_shared_gnu2_test): New target.
12038         (tls_test_gnu2_shared.so): New target.
12039         (tls_shared_gnu2_test_SOURCES): New variable.
12040         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12041         (tls_shared_gnu2_test_LDFLAGS): New variable.
12042         (tls_shared_gnu2_test_LDADD): New variable.
12043         * testsuite/Makefile.in: Rebuild.
12044         * testsuite/Makefile.
12045
12046 2008-04-11  Ian Lance Taylor  <iant@google.com>
12047
12048         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12049         justsyms.t.
12050         * testsuite/Makefile.in: Rebuild.
12051
12052         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12053         long.
12054         * testsuite/script_test_2.cc (main): Adjust test.
12055
12056 2008-04-11  David S. Miller  <davem@davemloft.net>
12057             Ian Lance Taylor  <iant@google.com>
12058
12059         * options.h (General_options): Add entries for '-Y' and
12060         '-relax'.
12061         * options.cc (General_options:finalize): If -Y was used, add those
12062         entries to the library path instead of the default "/lib" and
12063         "/usr/lib".
12064
12065 2008-04-11  David S. Miller  <davem@davemloft.net>
12066
12067         * testsuite/justsyms.t: Start at 0x100.
12068         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12069         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12070         long.
12071         * testsuite/script_test_2.cc: Adjust string and section length
12072         checks.
12073
12074 2008-04-09  Ian Lance Taylor  <iant@google.com>
12075
12076         PR gold/5996
12077         * script-sections.cc (Sections_element::allocate_to_segment): Add
12078         orphan parameter.
12079         (Output_section_definition::allocate_to_segment): Likewise.
12080         (Orphan_output_section::allocate_to_segment): Likewise.
12081         (Script_sections::attach_sections_using_phdrs_clause): Don't
12082         propagate non-PT_LOAD segments to orphan sections.
12083         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12084         readelf rather than objdump.
12085         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12086         .interp section and PT_INTERP segment are the same size.
12087         * testsuite/Makefile.in: Rebuild.
12088
12089         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12090         aliases for symbols defined in the same object.
12091         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12092         (weak_alias_test_SOURCES): New variable.
12093         (weak_alias_test_DEPENDENCIES): New variable.
12094         (weak_alias_test_LDFLAGS): New variable.
12095         (weak_alias_test_LDADD): New variable.
12096         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12097         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12098         (weak_alias_test_3.o): New target.
12099         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12100         * testsuite/weak_alias_test_main.cc: New file.
12101         * testsuite/weak_alias_test_1.cc: New file.
12102         * testsuite/weak_alias_test_2.cc: New file.
12103         * testsuite/weak_alias_test_3.cc: New file.
12104
12105 2008-04-08  Ian Lance Taylor  <iant@google.com>
12106
12107         * options.h (class General_options): Add --noinhibit-exec option.
12108         * main.cc (main): Check --noinhibit-exec.
12109
12110         * options.h (class General_options): Define --wrap as a special
12111         option.  Add wrap_symbols_ field.
12112         (General_options::any_wrap_symbols): New function.
12113         (General_options::is_wrap_symbol): New function.
12114         * options.cc (General_options::parse_wrap): New function.
12115         (General_options::General_options): Initialize wrap_symbols_.
12116         * symtab.cc (Symbol_table::wrap_symbol): New function.
12117         (Symbol_table::add_from_object): Handle --wrap.
12118         * symtab.h (class Symbol_table): Declare wrap_symbol.
12119         * target.h (Target::wrap_char): New function.
12120         (Target::Target_info): Add wrap_char field.
12121         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12122         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12123         * testsuite/testfile.cc (Target_test::test_target_info):
12124         Likewise.
12125
12126         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12127         there is one.
12128
12129         * layout.h (class Layout): Add added_eh_frame_data_ field.
12130         * layout.cc (Layout::Layout): Initialize new field.
12131         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12132         output section until we find a section we merged successfully.
12133         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12134         that the size be non-zero.
12135
12136         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12137         qualifier.
12138
12139 2008-04-08  Craig Silverstein  <csilvers@google.com>
12140
12141         * configure.ac: Export new conditional variable HAVE_ZLIB.
12142         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12143         on HAVE_ZLIB.
12144         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12145         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12146
12147 2008-04-07  Ian Lance Taylor  <iant@google.com>
12148
12149         * version.cc (version_string): Set to "1.5".
12150
12151         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12152         Add issued_non_pic_error_ field.  Declare check_non_pic.
12153         (Target_x86_64::Scan::check_non_pic): New function.
12154         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12155         (Target_x86_64::Scan::global): Likewise.
12156
12157         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12158         addend parameter.  Change caller.  Handle merge sections.
12159         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12160         Address to Addend.  Don't add in the result of
12161         local_section_offset, pass down the addend and use the returned
12162         value.
12163         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12164         Update declarations of local_section_offset and symbol_value.
12165         * testsuite/two_file_test_1.cc (t18): New function.
12166         * testsuite/two_file_test_2.cc (f18): New function.
12167         * testsuite/two_file_test_main.cc (main): Call t18.
12168         * testsuite/two_file_test.h (t18, f18): Declare.
12169
12170         * configure.ac: Don't test for objdump, c++filt, or readelf.
12171         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12172         conditionals.
12173         (TEST_READELF): New variable.
12174         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12175         (check_PROGRAMS): Add two_file_strip_test.
12176         (two_file_strip_test): New target.
12177         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12178         (two_file_same_shared_strip_test_SOURCES): New variable.
12179         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12180         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12181         (two_file_same_shared_strip_test_LDADD): New variable.
12182         (two_file_shared_strip.so): New target.
12183         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12184         (ver_test_5.syms, ver_test_7.syms): Likewise.
12185         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12186         (strip_test_3.stdout): Use TEST_OBJDUMP.
12187         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12188
12189 2008-04-04  Cary Coutant  <ccoutant@google.com>
12190
12191         * symtab.h (Symbol::is_weak_undefined): New function.
12192         (Symbol::is_strong_undefined): New function.
12193         (Symbol::is_absolute): New function.
12194         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12195         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12196         absolute symbols.
12197         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12198         (weak_undef_test): New target.
12199         * testsuite/Makefile.in: Rebuild.
12200         * testsuite/weak_undef_file1.cc: New file.
12201         * testsuite/weak_undef_file2.cc: New file.
12202         * testsuite/weak_undef_test.cc: New file.
12203
12204 2008-04-03  Craig Silverstein  <csilvers@google.com>
12205
12206         * compressed_output.h (class Output_compressed_section): Use
12207         unsigned buffer.
12208         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12209         add zlib header.
12210         (zlib_compressed_suffix): Removed.
12211         (Output_compressed_section::set_final_data_size): Use unsigned
12212         buffers.
12213         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12214         Fix linker invocation.
12215         (flagstest_o_specialfile_and_compress_debug_sections):
12216         Likewise.
12217         * testsuite/Makefile.in: Regenerated.
12218
12219 2008-04-02  David S. Miller  <davem@davemloft.net>
12220
12221         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12222         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12223
12224 2008-04-02  Craig Silverstein  <csilvers@google.com>
12225
12226         * TODO: New file.
12227
12228 2008-04-02  Ian Lance Taylor  <iant@google.com>
12229
12230         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12231         parameters.  Update for new key type to views_.  Change all
12232         callers.
12233         (File_read::read): Adjust for byteshift in returned view.
12234         (File_read::add_view): New function, broken out of
12235         find_and_make_view.
12236         (File_read::make_view): New function, broken out of
12237         find_and_make_view.
12238         (File_read::find_or_make_view): Add offset and aligned
12239         parameters.  Rewrite accordingly.  Change all callers.
12240         (File_read::get_view): Add offset and aligned parameters.  Adjust
12241         for byteshift in return value.
12242         (File_read::get_lasting_view): Likewise.
12243         * fileread.h (class File_read): Update declarations.
12244         (class File_read::View): Add byteshift_ field.  Add byteshift to
12245         constructor.  Add byteshift method.
12246         * archive.h (Archive::clear_uncached_views): New function.
12247         (Archive::get_view): Add aligned parameter.  Change all callers.
12248         * object.h (Object::get_view): Add aligned parameter.  Change all
12249         callers.
12250         (Object::get_lasting_view): Likewise.
12251
12252         * fileread.cc (File_read::release): Don't call clear_views if
12253         there are multiple objects.
12254         * fileread.h (File_read::clear_uncached_views): New function.
12255         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12256         on the archive.
12257
12258 2008-03-31  Cary Coutant  <ccoutant@google.com>
12259
12260         Add thin archive support.
12261         * archive.cc (Archive::armagt): New const.
12262         (Archive::setup): Remove task parameter and calls to unlock.
12263         (Archive::unlock_nested_archives): New function.
12264         (Archive::read_header): Add nested_off parameter. Change
12265         all callers.
12266         (Archive::interpret_header): Likewise.
12267         (Archive::include_all_members): Change to handle thin
12268         archives.
12269         (Archive::include_member): Likewise.
12270         * archive.h (Archive::Archive): Add new parameters and
12271         initializers.
12272         (Archive::armagt): New const.
12273         (Archive::setup): Remove task parameter.
12274         (Archive::unlock_nested_archives): New function.
12275         (Archive::read_header): Add nested_off parameter.
12276         (Archive::interpret_header): Likewise.
12277         (Archive::Nested_archive_table): New typedef.
12278         (Archive::is_thin_archive_): New field.
12279         (Archive::nested_archives_): New field.
12280         (Archive::options_): New field.
12281         (Archive::dirpath_): New field.
12282         (Archive::task_): New field.
12283         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12284         for thin archives.  Pass additional parameters to
12285         Archive::Archive.  Unlock the archive file after calling
12286         Archive::setup.
12287
12288 2008-03-29  Ian Lance Taylor  <iant@google.com>
12289
12290         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12291         version symbol to be local.
12292         * testsuite/ver_test_4.sh: New file.
12293         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12294         (check_DATA): Add ver_test_4.syms.
12295         (ver_test_4.syms): New target.
12296         * testsuite/Makefile.in: Rebuild.
12297
12298         * output.cc
12299         (Output_section::Input_section_sort_entry::has_priority): New
12300         function.
12301         (Output_section::Input_section_sort_entry::match_file_name): New
12302         function.
12303         (Output_section::Input_section_sort_entry::match_section_name):
12304         Remove.
12305         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12306         Remove.
12307         (Output_section::Input_section_sort_entry::match_section_file):
12308         Remove.
12309         (Output_section::Input_section_sort_compare::operator()): Rewrite
12310         using new Input_section_sort_entry functions.  Sort crtbegin and
12311         crtend first.  Sort sections with no priority before sections with
12312         a priority.
12313         * testsuite/initpri1.c (d3): Check j != 4.
12314         (cd5): New constructor/destructor function.
12315         (main): Check j != 2.
12316
12317         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12318         new symbol when resolving, don't call set_is_default.
12319         * testsuite/ver_test_7.cc: New file.
12320         * testsuite/ver_test_7.sh: New file.
12321         * testsuite/Makefile.am (ver_test_7.so): New target.
12322         (ver_test_7.o): New target.
12323         (check_SCRIPTS): Add ver_test_7.sh.
12324         (check_DATA): Add ver_test_7.syms.
12325         (ver_test_7.syms): New target.
12326
12327 2008-03-28  Ian Lance Taylor  <iant@google.com>
12328
12329         * layout.cc (Layout::layout): If we see an input section with a
12330         name that needs sorting, set the must_sort flag for the output
12331         section.
12332         (Layout::make_output_section): If the name of the output section
12333         indicates that it might require sorting, set the may_sort flag.
12334         * output.h (Output_section::may_sort_attached_input_sections): New
12335         function.
12336         (Output_section::set_may_sort_attached_input_sections): New
12337         function.
12338         (Output_section::must_sort_attached_input_sections): New
12339         function.
12340         (Output_section::set_must_sort_attached_input_sections): New
12341         function.
12342         (class Output_section): Declare Input_section_sort_entry.  Define
12343         Input_section_sort_compare.  Declare
12344         sort_attached_input_sections.  Add new fields:
12345         may_sort_attached_input_sections_,
12346         must_sort_attached_input_sections_,
12347         attached_input_sections_are_sorted_.
12348         * output.cc (Output_section::Output_section): Initialize new
12349         fields.
12350         (Output_section::add_input_section): Add an entry to
12351         input_sections_ if may_sort or must_sort are true.
12352         (Output_section::set_final_data_size): Call
12353         sort_attached_input_sections if necessary.
12354         (Output_section::Input_section_sort_entry): Define new class.
12355         (Output_section::Input_section_sort_compare::operator()): New
12356         function.
12357         (Output_section::sort_attached_input_sections): New function.
12358         * configure.ac: Check whether the compiler supports constructor
12359         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12360         * testsuite/initpri1.c: New file.
12361         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12362         CONSTRUCTOR_PRIORITY.
12363         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12364         (initpri1_LDFLAGS): New variable.
12365         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12366
12367 2008-03-27  Ian Lance Taylor  <iant@google.com>
12368
12369         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12370         * testsuite/common_test_1.c: New file.
12371         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12372         (common_test_1_SOURCES): New variable.
12373         (common_test_1_DEPENDENCIES): New variable.
12374         (common_test_1_LDFLAGS): New variable.
12375
12376         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12377         and commons_ correctly when NAME/VERSION does not override
12378         NAME/NULL.
12379         * testsuite/ver_test_6.c: New file.
12380         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12381         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12382         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12383
12384 2008-03-26  Ian Lance Taylor  <iant@google.com>
12385
12386         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12387         of an undefined symbol from a version script.
12388         * testsuite/Makefile.am (ver_test_5.so): New target.
12389         (ver_test_5.o): New target.
12390         (check_SCRIPTS): Add ver_test_5.sh.
12391         (check_DATA): Add ver_test_5.syms.
12392         (ver_test_5.syms): New target.
12393         * testsuite/ver_test_5.cc: New file.
12394         * testsuite/ver_test_5.script: New file.
12395         * testsuite/ver_test_5.sh: New file.
12396         * Makefile.in, testsuite/Makefile.in: Rebuild.
12397
12398         PR gold/5986
12399         Fix problems building gold with gcc 4.3.0.
12400         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12401         (gold_error_at_location, gold_warning_at_location): Use it.
12402         * configure.ac: Check whether we can compile and use a template
12403         function with a printf attribute.
12404         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12405         when jumping over bytes.
12406         * object.cc: Instantiate Object::read_section_data.
12407         * debug.h: Include <cstring>
12408         * dwarf_reader.cc: Include <algorithm>
12409         * main.cc: Include <cstring>.
12410         * options.cc: Include <cstring>.
12411         * output.cc: Include <cstring>.
12412         * script.cc: Include <cstring>.
12413         * script.h: Include <string>.
12414         * symtab.cc: Include <cstring> and <algorithm>.
12415         * target-select.cc: Include <cstring>.
12416         * version.cc: Include <string>.
12417         * testsuite/testmain.cc: Include <cstdlib>.
12418         * configure, config.in: Rebuild.
12419
12420 2008-03-25  Ian Lance Taylor  <iant@google.com>
12421
12422         * options.cc: Include "../bfd/bfdver.h".
12423         (options::help): Print bug reporting address.
12424
12425         * version.cc (print_version): Adjust output for current value of
12426         BFD_VERSION_STRING.
12427
12428         * NEWS: New file.
12429
12430         * options.cc (options::help): Print list of supported targets.
12431         * target-select.h: Include <vector>.
12432         (class Target_selector): Make machine_, size_, and is_big_endian_
12433         fields const.  Add bfd_name_ and instantiated_target_ fields.
12434         (Target_selector::Target_selector): Add bfd_name parameter.
12435         (Target_selector::recognize): Make non-virtual, call
12436         do_recognize.
12437         (Target_selector::recognize_by_name): Make non-virtual, call
12438         do_recognize_by_name.
12439         (Target_selector::supported_names): New function.
12440         (Target_selector::bfd_name): New function.
12441         (Target_selector::do_instantiate_target): New pure virtual
12442         function.
12443         (Target_selector::do_recognize): New virtual function.
12444         (Target_selector::do_recognize_by_name): New virtual function.
12445         (Target_selector::instantiate_target): New private function.
12446         (supported_target_names): Declare.
12447         * target-select.cc (Target_selector::Target_selector): Update for
12448         new parameter and fields.
12449         (select_target_by_name): Check that the name matches before
12450         calling recognize_by_name.
12451         (supported_target_names): New function.
12452         * i386.cc (class Target_selector_i386): Update Target_selector
12453         constructor call.  Remove recognize and recognize_by_name.  Add
12454         do_instantiate_target.
12455         * x86_64.cc (class Target_selector_x86_64): Likewise.
12456         * testsuite/testfile.cc (class Target_selector_test): Update for
12457         changes to Target_selector.
12458
12459         * README: Rewrite, with some notes on unsupported features.
12460
12461 2008-03-24  Cary Coutant  <ccoutant@google.com>
12462
12463         * i386.cc (Target_i386::Got_type): New enum declaration.
12464         (Target_i386::Scan::local): Updated callers of Output_data_got
12465         member functions.
12466         (Target_i386::Scan::global): Likewise.
12467         (Target_i386::Relocate::relocate): Likewise.
12468         (Target_i386::Relocate::relocate_tls): Likewise.
12469         * object.h (Got_offset_list): New class.
12470         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12471         (Sized_relobj::local_got_offset): Likewise.
12472         (Sized_relobj::set_local_got_offset): Likewise.
12473         (Sized_relobj::local_has_tls_got_offset): Removed.
12474         (Sized_relobj::local_tls_got_offset): Removed.
12475         (Sized_relobj::set_local_tls_got_offset): Removed.
12476         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12477         * output.cc (Output_data_got::add_global): Added got_type parameter.
12478         (Output_data_got::add_global_with_rel): Likewise.
12479         (Output_data_got::add_global_with_rela): Likewise.
12480         (Output_data_got::add_global_pair_with_rel): New function.
12481         (Output_data_got::add_global_pair_with_rela): New function.
12482         (Output_data_got::add_local): Added got_type parameter.
12483         (Output_data_got::add_local_with_rel): Likewise.
12484         (Output_data_got::add_local_with_rela): Likewise.
12485         (Output_data_got::add_local_pair_with_rel): New function.
12486         (Output_data_got::add_local_pair_with_rela): New function.
12487         (Output_data_got::add_global_tls): Removed.
12488         (Output_data_got::add_global_tls_with_rel): Removed.
12489         (Output_data_got::add_global_tls_with_rela): Removed.
12490         (Output_data_got::add_local_tls): Removed.
12491         (Output_data_got::add_local_tls_with_rel): Removed.
12492         (Output_data_got::add_local_tls_with_rela): Removed.
12493         * output.h (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         * resolve.cc (Symbol::override_base_with_special): Removed
12510         reference to has_got_offset_ field.
12511         * symtab.cc (Symbol::init_fields): Replaced initialization
12512         of got_offset_ with got_offsets_.  Removed initialization
12513         of has_got_offset_
12514         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12515         (Symbol::got_offset): Likewise.
12516         (Symbol::set_got_offset): Likewise.
12517         (Symbol::has_tls_got_offset): Removed.
12518         (Symbol::tls_got_offset): Removed.
12519         (Symbol::set_tls_got_offset): Removed.
12520         (Symbol::got_offset_): Removed.
12521         (Symbol::tls_mod_got_offset_): Removed.
12522         (Symbol::tls_pair_got_offset_): Removed.
12523         (Symbol::got_offsets_): New field.
12524         (Symbol::has_got_offset): Removed.
12525         (Symbol::has_tls_mod_got_offset): Removed.
12526         (Symbol::has_tls_pair_got_offset): Removed.
12527         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12528         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12529         member functions.
12530         (Target_x86_64::Scan::global): Likewise.
12531         (Target_x86_64::Relocate::relocate): Likewise.
12532         (Target_x86_64::Relocate::relocate_tls): Likewise.
12533
12534 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12535
12536         * yyscript.y: Fix spelling error in comment.
12537
12538 2008-03-24  Ian Lance Taylor  <iant@google.com>
12539
12540         * options.h (class General_options): Define build_id option.
12541         * layout.h (class Layout): Declare write_build_id, create_note,
12542         create_build_id.  Add build_id_note_ member.
12543         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12544         "libiberty.h", "md5.h", "sha1.h".
12545         (Layout::Layout): Initialize eh_frame_data_,
12546         eh_frame_hdr_section_, and build_id_note_.
12547         (Layout::finalize): Call create_build_id.
12548         (Layout::create_note): New function, broken out of
12549         Layout::create_gold_note.
12550         (Layout::create_gold_note): Call create_note.
12551         (Layout::create_build_id): New function.
12552         (Layout::write_build_id): New function.
12553         (Close_task_runner::run): Call write_build_id.
12554
12555         * x86_64.cc: Correct license to GPLv3.
12556
12557 2008-03-23  Ian Lance Taylor  <iant@google.com>
12558
12559         * options.cc: Include "demangle.h".
12560         (parse_optional_string): New function.
12561         (parse_long_option): Handle takes_optional_argument.
12562         (parse_short_option): Update dash_z initializer.  Handle
12563         takes_optional_argument.
12564         (General_options::General_options): Initialize do_demangle_.
12565         (General_options::finalize): Set do_demangle_.  Handle demangling
12566         style.
12567         * options.h (parse_optional_string): Declare.
12568         (struct One_option): Add optional_arg field.  Update constructor.
12569         Update call constructor calls.  Add takes_optional_argument
12570         function.
12571         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12572         (DEFINE_optional_string): Define.
12573         (General_options::demangle): Change from DEFINE_bool to
12574         DEFINE_optional_string.
12575         (General_options::no_demangle): New function.
12576         (General_options::do_demangle): New function.
12577         (General_options::set_do_demangle): New function.
12578         (General_options::execstack_status_): Move definition to end of
12579         class definition.
12580         (General_options::static_): Likewise.
12581         (General_options::do_demangle_): New field.
12582         * object.cc (big_endian>::get_symbol_location_info): Call
12583         Options::do_demangle, not Options::demangle.
12584         * symtab.cc (demangle): Likewise.
12585
12586 2008-03-22  Ian Lance Taylor  <iant@google.com>
12587
12588         * gold.h: Include <cstddef> and <sys/types.h>
12589         * options.h: Include <cstring>.
12590
12591 2008-03-21  Ian Lance Taylor  <iant@google.com>
12592
12593         * Added source code to GNU binutils.