* output.h (Output_data_reloc_generic::add): Only call
[external/binutils.git] / gold / ChangeLog
1 2011-12-16  Ian Lance Taylor  <iant@google.com>
2
3         * output.h (Output_data_reloc_generic::add): Only call
4         add_dynamic_reloc if this is a dynamic reloc section.
5
6 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
7
8         PR gold/13505
9         * target-reloc.h (apply_relocation): Replace <64, false> with
10         <size, big_endian>.
11
12 2011-11-25  Nick Clifton  <nickc@redhat.com>
13
14         * po/it.po: New Italian translation.
15
16 2011-11-17  Sterling Augustine  <saugustine@google.com>
17
18         * script.cc (script_include_directive): Implement.
19         (read_script_file): New local variables name and search_path. Update
20         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
21         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
22         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
23
24 2011-11-11  Sterling Augustine  <saugustine@google.com>
25
26         * yyscript.y (section_cmd): Add support for INCLUDE directive.
27         (file_or_sections_cmd): Likewise.
28
29 2011-11-11  Doug Kwan  <dougkwan@google.com>
30
31         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
32         if --just-symbols is given.
33
34 2011-11-10  Doug Kwan  <dougkwan@google.com>
35
36         PR gold/13362
37         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
38         when processing data relocs.
39         * reloc.h (Relocate_functions::rel_unaligned): New method.
40         (Relocate_functions::pcrel_unaligned): Ditto.
41         (Relocate_functions::rel32_unaligned): Ditto.
42         (Relocate_functions::pcrel32_unaligned): Ditto.
43
44 2011-11-09  Doug Kwan  <dougkwan@google.com>
45
46         PR gold/13362
47         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
48         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
49         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
50         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
51         (Relocate_functions::rel_unaligned): New.
52         (Relocate_functions::rel32_unaligned): New.
53         * target-reloc.h (relocate_for_relocatable): Add code to handle
54         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
55         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
56         arm_unaligned_reloc_r): New targets.
57         * testsuite/Makefile.in: Regenerate.
58         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
59         linking.
60
61 2011-11-02  Ian Lance Taylor  <iant@google.com>
62
63         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
64         NATIVE_LINKER.
65         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
66         * options.cc (General_options::finalize): Use library search path
67         from configure script if specified.  If not native and no sysroot,
68         only search TOOLLIBDIR.
69         * options.h (Search_directory::Search_directory): Change name to
70         const std::string&.
71         (General_options::add_to_library_path_with_sysroot): Change arg to
72         const std::string&.
73         * configure, Makefile.in, config.in: Rebuild.
74
75 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
76
77         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
78         we are working around the ARM1176 Erratum.
79         * options.h (General_options::fix_arm1176): Add option.
80         * testsuite/Makefile.am: Add testcases, and keep current ones
81         working.
82         * testsuite/Makefile.in: Regenerate.
83         * testsuite/arm_fix_1176.s: New file.
84         * testsuite/arm_fix_1176.sh: Likewise.
85
86 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
87
88         * arm.cc (Target_arm::Target_arm): Remove initialisation of
89         may_use_blx_.
90         (Target_arm::may_use_blx): Remove method.
91         (Target_arm::set_may_use_blx): Likewise.
92         (Target_arm::may_use_v4t_interworking): New method.
93         (Target_arm::may_use_v5t_interworking): Likewise.
94         (Target_arm::may_use_blx_): Remove member variable.
95         (Arm_relocate_functions::arm_branch_common): Check for v5T
96         interworking.
97         (Arm_relocate_functions::thumb_branch_common): Likewise.
98         (Reloc_stub::stub_type_for_reloc): Likewise.
99         (Target_arm::do_finalize_sections): Correct interworking checks.
100         * testsuite/Makefile.am: Add new tests.
101         * testsuite/Makefile.in: Regenerate.
102         * testsuite/arm_farcall_arm_arm.s: New test.
103         * testsuite/arm_farcall_arm_arm.sh: Likewise.
104         * testsuite/arm_farcall_arm_thumb.s: Likewise.
105         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
106         * testsuite/arm_farcall_thumb_arm.s: Likewise.
107         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
108         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
109         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
110
111 2011-10-31  Cary Coutant  <ccoutant@google.com>
112
113         PR gold/13023
114         * expression.cc (Expression::eval_with_dot): Add
115         is_section_dot_assignment parameter.
116         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
117         absolute and assigning to dot within a section.
118         * script-sections.cc
119         (Output_section_element_assignment::set_section_addresses): Pass
120         dot_section to set_if_absolute.
121         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
122         as is_section_dot_assignment flag to eval_with_dot.
123         (Output_section_element_dot_assignment::set_section_addresses):
124         Likewise.
125         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
126         parameter.  Also set value if relative to dot_section; set the
127         symbol's output_section.
128         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
129         parameter.  Adjust all callers.
130         (Expression::eval_maybe_dot): Likewise.
131         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
132         Adjust all callers.
133         * testsuite/script_test_2.t: Test assignment of an absolute value
134         to dot within an output section element.
135
136 2011-10-31  Cary Coutant  <ccoutant@google.com>
137
138         * options.h (class General_options): Add --[no-]gnu-unique options.
139         * symtab.cc (Symbol_table::sized_write_globals): Convert
140         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
141
142 2011-10-31  Cary Coutant  <ccoutant@google.com>
143
144         PR gold/13359
145         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
146         unnecessary assertion.
147         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
148
149 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
150
151         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
152         gc_mark_symbol.
153         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
154         gc_mark_symbol.
155         Change to just keep the section associated with symbol.
156         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
157         they are externally visible and --export-dynamic is turned on.
158         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
159
160 2011-10-19  Ian Lance Taylor  <iant@google.com>
161
162         PR gold/13163
163         * script-sections.cc
164         (Output_section_element_dot_assignment::needs_output_section): New
165         function.
166
167 2011-10-19  Ian Lance Taylor  <iant@google.com>
168
169         PR gold/13204
170         * layout.cc (Layout::segment_precedes): Don't assert failure if a
171         --section-start option was seen.
172         * options.h (General_options::any_section_start): New function.
173
174 2011-10-18  David S. Miller  <davem@davemloft.net>
175
176         PR binutils/13301
177         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
178         member to track relocation locations that have moved during TLS
179         reloc optimizations.
180         (Target_sparc::Relocate::Relocate): Initialize to NULL.
181         (Target_sparc::Relocate::relocate): Adjust view down by 4
182         bytes if it matches reloc_adjust_addr_.
183         (Target_sparc::Relocate::relocate_tls): Always move the
184         __tls_get_addr call delay slot instruction forward 4 bytes when
185         performing relaxation.
186
187 2011-10-18  Cary Coutant  <ccoutant@google.com>
188
189         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
190         (Output_file::map_no_anonymous): Check for non-zero
191         return code from posix_fallocate.
192
193 2011-10-17  Cary Coutant  <ccoutant@google.com>
194
195         PR gold/13245
196         * plugin.cc (is_visible_from_outside): Check for symbols
197         referenced from dynamic objects.
198         * resolve.cc (Symbol_table::resolve): Don't count references
199         from dynamic objects as references from real ELF files.
200         * testsuite/plugin_test_2.sh: Adjust expected result.
201
202 2011-10-17  Cary Coutant  <ccoutant@google.com>
203
204         * gold.cc: Include timer.h.
205         (queue_middle_tasks): Stamp time.
206         (queue_final_tasks): Likewise.
207         * main.cc (main): Store timer in parameters.  Print timers
208         for each pass.
209         * parameters.cc (Parameters::Parameters): Initialize timer_.
210         (Parameters::set_timer): New function.
211         (set_parameters_timer): New function.
212         * parameters.h (Parameters::set_timer): New function.
213         (Parameters::timer): New function.
214         (Parameters::timer_): New data member.
215         (set_parameters_timer): New function.
216         * timer.cc (Timer::stamp): New function.
217         (Timer::get_pass_time): New function.
218         * timer.h (Timer::stamp): New function.
219         (Timer::get_pass_time): New function.
220         (Timer::pass_times_): New data member.
221
222 2011-10-17  Cary Coutant  <ccoutant@google.com>
223
224         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
225         task for members of lib groups.
226
227 2011-10-17  Cary Coutant  <ccoutant@google.com>
228
229         PR gold/13288
230         * fileread.cc (File_read::find_view): Add assert.
231         (File_read::make_view): Move bounds check (replace with assert)...
232         (File_read::find_or_make_view): ... to here.
233
234 2011-10-12  Cary Coutant  <ccoutant@google.com>
235
236         * output.cc (Output_file::open_base_file): Handle case where
237         ::read returns less than requested size.
238
239 2011-10-10  Cary Coutant  <ccoutant@google.com>
240
241         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
242         Initialize defined_count_.
243         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
244         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
245         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
246         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
247         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
248         * incremental.h (Sized_relobj_incr::defined_count_): New data
249         member.
250         (Sized_incr_dynobj::defined_count_): New data member.
251         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
252         Return zeroes instead of internal error.
253
254 2011-10-10  Cary Coutant  <ccoutant@google.com>
255
256         PR gold/13249
257         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
258         (Output_reloc::symbol_value): Return PLT offset if flag is set.
259         * output.h (class Output_reloc): Add use_plt_offset flag.
260         (Output_reloc::type_): Adjust size of bit field.
261         (Output_reloc::use_plt_offset_): New bit field.
262         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
263         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
264         flag.  Adjust all callers.
265         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
266         creating RELATIVE relocations.
267
268 2011-10-10  Nick Clifton  <nickc@redhat.com>
269
270         * po/es.po: Updated Spanish translation.
271         * po/fi.po: Updated Finnish translation.
272
273 2011-10-03   Diego Novillo  <dnovillo@google.com>
274
275         * options.cc (parse_uint): Fix dereference of RETVAL.
276
277 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
278
279         * layout.h (section_order_map_): New member.
280         (get_section_order_map): New member function.
281         * output.cc (Output_section::add_input_section): Check for patterns
282         only when --section-ordering-file is specified.
283         * gold.cc (queue_middle_tasks): Delay updating order of sections till
284         output_sections have been formed.
285         * layout.cc (Layout_Layout): Initialize section_order_map_.
286         * plugin.cc (update_section_order): Store order in order_map. Do not
287         update the order.
288         * testsuite/Makefile.am: Add test case for plugin_final_layout.
289         * testsuite/Makefile.in: Regenerate.
290         * testsuite/plugin_section_order.c: New file.
291         * testsuite/plugin_final_layout.cc: New file.
292         * testsuite/plugin_final_layout.sh: New file.
293
294 2011-09-29  Cary Coutant  <ccoutant@google.com>
295
296         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
297         Check for NULL.
298         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
299         symbols during incremental update.
300         (Symbol_table::add_from_dynobj): Likewise.
301
302 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
303             Ian Lance Taylor  <iant@google.com>
304
305         * symtab.cc (Symbol_table::define_special_symbol): Always
306         canonicalize version string.
307
308 2011-09-26  Cary Coutant  <ccoutant@google.com>
309
310         * gold.cc (queue_initial_tasks): Move option checks ...
311         * options.cc (General_options::finalize): ... to here. Disable
312         some options; make others fatal.
313
314 2011-09-26  Cary Coutant  <ccoutant@google.com>
315
316         gcc PR lto/47247
317         * plugin.cc (get_symbols_v2): New function.
318         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
319         (is_referenced_from_outside): New function.
320         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
321         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
322         (get_symbols): Pass version parameter.
323         (get_symbols_v2): New function.
324         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
325         parameter.
326         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
327         (onload): Add LDPT_GET_SYMBOLS_V2.
328         (all_symbols_read_hook): Use get_symbols_v2; check for
329         LDPR_PREVAILING_DEF_IRONLY_EXP.
330         * testsuite/plugin_test_3.sh: Update expected results.
331
332 2011-09-23  Simon Baldwin  <simonb@google.com>
333
334         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
335         configuration options.
336         * configure: Regenerate.
337         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
338         * Makefile.in: Regenerate.
339         * testsuite/Makefile.in: Regenerate.
340
341 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
342
343         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
344
345 2011-09-19  Cary Coutant  <ccoutant@google.com>
346
347         * incremental.cc (can_incremental_update): Fix typo in comment.
348         * incremental.h (can_incremental_update): Likewise.
349
350 2011-09-18  Cary Coutant  <ccoutant@google.com>
351
352         * incremental.cc (can_incremental_update): New function.
353         * incremental.h (can_incremental_update): New function.
354         * layout.cc (Layout::init_fixed_output_section): Call it.
355         (Layout::make_output_section): Don't allow patch space in .eh_frame.
356         * object.cc (Sized_relobj_file::do_layout): Call
357         can_incremental_update.
358
359 2011-09-13  Cary Coutant  <ccoutant@google.com>
360
361         * configure.ac: Check for glibc support for gnu_indirect_function
362         support with static linking, setting automake conditional
363         IFUNC_STATIC.
364         * Makefile.in: Regenerate.
365         * configure: Regenerate.
366
367         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
368         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
369         for IFUNC_STATIC.
370         * testsuite/Makefile.in: Regenerate.
371
372 2011-09-13  Cary Coutant  <ccoutant@google.com>
373
374         * incremental.cc (Sized_relobj_incr::do_layout): Call
375         report_comdat_group for kept comdat sections.
376         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
377         * testsuite/Makefile.in: Regenerate.
378         * testsuite/incr_comdat_test_1.cc: New source file.
379         * testsuite/incr_comdat_test_2_v1.cc: New source file.
380         * testsuite/incr_comdat_test_2_v2.cc: New source file.
381         * testsuite/incr_comdat_test_2_v3.cc: New source file.
382
383 2011-09-13  Ian Lance Taylor  <iant@google.com>
384
385         * object.cc (Sized_relobj_file::do_layout): Remove unused local
386         variable external_symbols_offset.
387
388 2011-09-12  Ian Lance Taylor  <iant@google.com>
389
390         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
391         triggered if object has no symbols.
392
393 2011-09-09  David S. Miller  <davem@davemloft.net>
394
395         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
396         (Output_fill_debug_line::do_write): Likewise.
397
398 2011-08-29  Cary Coutant  <ccoutant@google.com>
399
400         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
401         casts to match formatting specs.
402         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
403
404 2011-08-26  Cary Coutant  <ccoutant@google.com>
405
406         * layout.cc (Free_list::allocate): Provide guarantee of minimum
407         remaining hole size when allocating.
408         (Layout::make_output_section): Set fill methods for debug sections.
409         * layout.h (Free_list::Free_list_node): Move from private to
410         public.
411         (Free_list::set_min_hole_size): New function.
412         (Free_list::begin, Free_list::end): New functions.
413         (Free_list::min_hole_): New data member.
414         * output.cc: Include dwarf.h.
415         (Output_fill_debug_info::do_minimum_hole_size): New function.
416         (Output_fill_debug_info::do_write): New function.
417         (Output_fill_debug_line::do_minimum_hole_size): New function.
418         (Output_fill_debug_line::do_write): New function.
419         (Output_section::Output_section): Initialize new data member.
420         (Output_section::set_final_data_size): Ensure patch space is larger
421         than minimum hole size.
422         (Output_section::do_write): Fill holes in debug sections.
423         * output.h (Output_fill): New class.
424         (Output_fill_debug_info): New class.
425         (Output_fill_debug_line): New class.
426         (Output_section::set_free_space_fill): New function.
427         (Output_section::free_space_fill_): New data member.
428         * testsuite/Makefile.am (incremental_test_3): Add
429         --incremental-patch option.
430         (incremental_test_4): Likewise.
431         (incremental_test_5): Likewise.
432         (incremental_test_6): Likewise.
433         (incremental_copy_test): Likewise.
434         (incremental_common_test_1): Likewise.
435         * testsuite/Makefile.in: Regenerate.
436
437 2011-08-26  Nick Clifton  <nickc@redhat.com>
438
439         * po/es.po: Updated Spanish translation.
440
441 2011-08-01  Cary Coutant  <ccoutant@google.com>
442
443         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
444         * gold/testsuite/Makefile.in: Regenerate.
445         * gold/testsuite/justsyms_exec.c: New source file.
446         * gold/testsuite/justsyms_lib.c: New source file.
447
448 2011-08-01  Cary Coutant  <ccoutant@google.com>
449
450         * layout.cc (Layout::set_segment_offsets): Don't realign text
451         segment if -Ttext was specified.
452         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
453         file type.
454         * object.h (Sized_relobj_file::e_type): New function.
455         (Sized_relobj_file::e_type_): New data member.
456         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
457         base address for ET_EXEC files.
458         * target.cc (Target::do_make_elf_object_implementation): Allow
459         ET_EXEC files with --just-symbols option.
460
461 2011-07-28  Cary Coutant  <ccoutant@google.com>
462
463         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
464         Add thread_number parameter.
465         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
466         * workqueue-threads.cc
467         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
468         current thread if its thread number is greater than desired thread
469         count.
470         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
471         Add thread_number parameter.
472         (Workqueue::should_cancel_thread): Likewise.
473         (Workqueue::find_runnable_or_wait): Pass thread_number to
474         should_cancel_thread.
475         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
476         parameter.
477
478 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
479
480         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
481         only after checking if it cannot be forced local.
482         * symtab.h (is_externally_visible): Check if the symbol is not forced
483         local.
484
485 2011-07-15  Ian Lance Taylor  <iant@google.com>
486
487         * options.h (class General_options): Add --print-output-format.
488         Move -EL next to -EB, for  better --help output.
489         * target-select.cc: Include <cstdio>, "options.h", and
490         "parameters.h".
491         (Target_selector::do_target_bfd_name): New function.
492         (print_output_format): New function.
493         * target-select.h (class Target_selector): Update declarations.
494         (Target_selector::target_bfd_name): New function.
495         (print_output_format): Declare.
496         * main.cc: Include "target-select.h".
497         (main): Handle --print-output-format.
498         * gold.cc: Include "target-select.h".
499         (queue_initial_tasks): Handle --print-output-format when there are
500         no input files.
501         * parameters.cc (parameters_force_valid_target): Give a better
502         error message if -EB/-EL does not match target.
503         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
504         function.
505
506 2011-07-15  Ian Lance Taylor  <iant@google.com>
507
508         * i386.cc (class Output_data_plt_i386): Add layout_ field.
509         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
510         (Output_data_plt_i386::do_write): Write address of .dynamic
511         section to first entry in .got.plt section.
512         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
513         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
514         Initialize layout_.
515         (Output_data_plt_x86_64::do_write): Write address of .dynamic
516         section to first entry in .got.plt section.
517         * layout.h (Layout::dynamic_section): New function.
518
519 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
520
521         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
522         to claim_file call.
523         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
524         input_section_position_, and input_section_glob_.
525         (read_layout_from_file): Call function section_ordering_specified.
526         * layout.h (is_section_ordering_specified): New function.
527         (section_ordering_specified): New function.
528         (section_ordering_specified_): New boolean member.
529         * main.cc(main): Call load_plugins after layout object is defined.
530         * output.cc (Output_section::add_input_section): Use
531         function section_ordering_specified to check if section ordering is
532         needed.
533         * output.cc (Output_section::add_relaxed_input_section): Use
534         function section_ordering_specified to check if section ordering is
535         needed.
536         (Output_section::update_section_layout): New function.
537         (Output_section::sort_attached_input_sections): Check if input section
538         must be reordered.
539         * output.h (Output_section::update_section_layout): New function.
540         * plugin.cc (get_section_count): New function.
541         (get_section_type): New function.
542         (get_section_name): New function.
543         (get_section_contents): New function.
544         (update_section_order): New function.
545         (allow_section_ordering): New function. 
546         (Plugin::load): Add the new interfaces to the transfer vector.
547         (Plugin_manager::load_plugins): New parameter.
548         (Plugin_manager::all_symbols_read): New parameter.
549         (Plugin_manager::claim_file): New parameter. Save the elf object for
550         unclaimed objects.
551         (Plugin_manager::get_elf_object): New function.
552         (Plugin_manager::get_view): Change to directly use the bool to check
553         if get_view is called from claim_file_hook.
554         * plugin.h (input_objects): New function
555         (Plugin__manager::load_plugins): New parameter.
556         (Plugin_manager::claim_file): New parameter.
557         (Plugin_manager::get_elf_object): New function.
558         (Plugin_manager::in_claim_file_handler): New function.
559         (Plugin_manager::in_claim_file_handler_): New member.
560         (layout): New function.
561         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
562         handler with an extra parameter. Make the elf object before calling
563         claim_file handler.
564         * testsuite/plugin_test.c (get_section_count): New function pointer.
565         (get_section_type): New function pointer.
566         (get_section_name): New function pointer.
567         (get_section_contents): New function pointer.
568         (update_section_order): New function pointer.
569         (allow_section_ordering): New function pointer.
570         (onload): Check if the new interfaces exist.
571
572 2011-07-13  Ian Lance Taylor  <iant@google.com>
573
574         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
575         relro section.
576         * x86_64.cc (Target_x86_64::got_section): Likewise.
577         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
578         (relro_now_test_SOURCES): New variable.
579         (relro_now_test_DEPENDENCIES): New variable.
580         (relro_now_test_LDFLAGS): New variable.
581         (relro_now_test_LDADD): New variable.
582         (relro_now_test.so): New target.
583         * testsuite/Makefile.in: Rebuild.
584
585 2011-07-12  Ian Lance Taylor  <iant@google.com>
586
587         PR gold/12980
588         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
589         GLOB_DAT relocation rather than a RELATIVE relocation for a
590         protected symbol when creating a shared library.
591         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
592         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
593         * testsuite/protected_main_1.cc (main): Test that protected
594         function has same address.
595
596 2011-07-11  Ian Lance Taylor  <iant@google.com>
597
598         PR gold/12979
599         * options.h (class General_options): Add -Bgroup.
600         * options.cc (General_options::finalize): If -Bgroup is set,
601         default to --unresolved-symbols=report-all.
602         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
603         * target-reloc.h (issue_undefined_symbol_error): Handle
604         --unresolved-symbols=report-all.
605
606 2011-07-08  Ian Lance Taylor  <iant@google.com>
607
608         PR gold/11985
609         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
610         if linker script discards key sections.
611         (Layout::create_dynamic_symtab): Likewise.
612         (Layout::assign_local_dynsym_offsets): Likewise.
613         (Layout::sized_create_version_sections): Likewise.
614         (Layout::create_interp): Likewise.
615         (Layout::finish_dynamic_section): Likewise.
616         (Layout::set_dynamic_symbol_size): Likewise.
617
618 2011-07-08  Ian Lance Taylor  <iant@google.com>
619
620         PR gold/12386
621         * options.h (class General_options): Add --unresolved-symbols.
622         * target-reloc.h (issue_undefined_symbol_error): Check
623         --unresolved-symbols.  Add comments.
624
625 2011-07-08  Ian Lance Taylor  <iant@google.com>
626
627         * testsuite/odr_violation2.cc (Ordering::operator()): Make
628         expression more complex.
629
630 2011-07-08  Ian Lance Taylor  <iant@google.com>
631
632         PR gold/11317
633         * target-reloc.h (issue_undefined_symbol_error): New inline
634         function, broken out of relocate_section.
635         (relocate_section): Call issue_undefined_symbol_error.
636         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
637         there is no TLS segment if we are about to issue an undefined
638         symbol error.
639         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
640
641 2011-07-08  Ian Lance Taylor  <iant@google.com>
642
643         PR gold/12279
644         * resolve.cc (Symbol_table::should_override): Add fromtype
645         parameter.  Change all callers.  Give error when linking together
646         TLS and non-TLS symbol.
647         (Symbol_table::should_override_with_special): Add fromtype
648         parameter.  Change all callers.
649         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
650         there is no TLS segment if we have reported some errors.
651         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
652
653 2011-07-08  Ian Lance Taylor  <iant@google.com>
654
655         PR gold/12372
656         * target.h (Target::plt_address_for_global): New function.
657         (Target::plt_address_for_local): New function.
658         (Target::plt_section_for_global): Remove.
659         (Target::plt_section_for_local): Remove.
660         (Target::do_plt_address_for_global): New virtual function.
661         (Target::do_plt_address_for_local): New virtual function.
662         (Target::do_plt_section_for_global): Remove.
663         (Target::do_plt_section_for_local): Remove.
664         (Target::register_global_plt_entry): Add Symbol_table and Layout
665         parameters.
666         * output.cc (Output_data_got::Got_entry::write): Use
667         plt_address_for_global and plt_address_for_local.
668         * layout.cc (Layout::add_target_dynamic_tags): Use size and
669         address of output section.
670         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
671         got_irelative_, and irelative_count_ fields.  Update
672         declarations.
673         (Output_data_plt_i386::has_irelative_section): New function.
674         (Output_data_plt_i386::entry_count): Add irelative_count_.
675         (Output_data_plt_i386::set_final_data_size): Likewise.
676         (class Target_i386): Add got_irelative_ and rel_irelative_
677         fields.  Update declarations.
678         (Target_i386::Target_i386): Initialize new fields.
679         (Target_i386::do_plt_address_for_global): New function replacing
680         do_plt_section_for_global.
681         (Target_i386::do_plt_address_for_local): New function replacing
682         do_plt_section_for_local.
683         (Target_i386::got_section): Create got_irelative_.
684         (Target_i386::rel_irelative_section): New function.
685         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
686         fields.  Don't define __rel_iplt_{start,end}.
687         (Output_data_plt_i386::add_entry): Add symtab and layout
688         parameters.  Change all callers.  Use different PLT and GOT for
689         IFUNC symbols.
690         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
691         layout parameters.  Change all callers.  Use different PLT and
692         GOT.
693         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
694         (Output_data_plt_i386::rel_irelative): New function.
695         (Output_data_plt_i386::address_for_global): New function.
696         (Output_data_plt_i386::address_for_local): New function.
697         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
698         IRELATIVE GOT when changing IFUNC GOT entries.
699         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
700         reloc.
701         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
702         if we didn't create an IRELATIVE GOT.
703         (Target_i386::Relocate::relocate): Use plt_address_for_global and
704         plt_address_for_local.
705         (Target_i386::do_dynsym_value): Use plt_address_for_global.
706         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
707         got_irelative_, and irelative_count_ fields.  Update
708         declarations.
709         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
710         Initialize new fields.  Remove symtab parameter.  Change all
711         callers.
712         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
713         irelative_count_.
714         (Output_data_plt_x86_64::has_irelative_section): New function.
715         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
716         (class Target_x86_64): Add got_irelative_ and rel_irelative_
717         fields.  Update declarations.
718         (Target_x86_64::Target_x86_64): Initialize new fields.
719         (Target_x86_64::do_plt_address_for_global): New function replacing
720         do_plt_section_for_global.
721         (Target_x86_64::do_plt_address_for_local): New function replacing
722         do_plt_section_for_local.
723         (Target_x86_64::got_section): Create got_irelative_.
724         (Target_x86_64::rela_irelative_section): New function.
725         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
726         all callers.  Don't create __rel_iplt_{start,end}.
727         (Output_data_plt_x86_64::add_entry): Add symtab and layout
728         parameters.  Change all callers.  Use different PLT and GOT for
729         IFUNC symbols.
730         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
731         layout parameters.  Change all callers.  Use different PLT and
732         GOT.
733         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
734         parameters.  Change all callers.  Use different PLT and GOT for
735         IFUNC symbols.
736         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
737         (Output_data_plt_x86_64::rela_irelative): New function.
738         (Output_data_plt_x86_64::address_for_global): New function.
739         (Output_data_plt_x86_64::address_for_local): New function.
740         (Output_data_plt_x86_64::set_final_data_size): Likewise.
741         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
742         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
743         (Target_x86_64::register_global_plt_entry): Add symtab and layout
744         parameters.
745         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
746         reloc.
747         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
748         symbols if we didn't create an IRELATIVE GOT.
749         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
750         plt_address_for_local.
751         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
752         * testsuite/ifuncvar1.c: New test file.
753         * testsuite/ifuncvar2.c: New test file.
754         * testsuite/ifuncvar3.c: New test file.
755         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
756         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
757         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
758         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
759         * testsuite/Makefile.in: Rebuild.
760
761 2011-07-07  Cary Coutant  <ccoutant@google.com>
762
763         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
764         (two_file_test_1_ndebug.o): Likewise.
765         (two_file_test_1b_ndebug.o): Likewise.
766         (two_file_test_2_ndebug.o): Likewise.
767         (two_file_test_main_ndebug.o): Likewise.
768         (incremental_test_2): Link with no-debug versions.
769
770 2011-07-06  Cary Coutant  <ccoutant@google.com>
771
772         * gold/incremental.cc
773         (Output_section_incremental_inputs::write_info_blocks): Check for
774         hidden and internal symbols.
775
776 2011-07-06  Cary Coutant  <ccoutant@google.com>
777
778         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
779         Check disposition for startup file.
780         (Incremental_inputs::report_command_line): Ignore
781         --incremental-startup-unchanged option.
782         * options.cc (General_options::parse_incremental_startup_unchanged):
783         New function.
784         (General_options::General_options): Initialize new data member.
785         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
786         (General_options): Add --incremental-startup-unchanged option.
787         (General_options::incremental_startup_disposition): New function.
788         (General_options::incremental_startup_disposition_): New data member.
789
790 2011-07-06  Cary Coutant  <ccoutant@google.com>
791
792         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
793         input file index to Script_info ctor.
794         (Sized_incremental_binary::do_file_has_changed): Find the
795         command-line argument for files named in scripts.
796         * incremental.h (Script_info::Script_info): New ctor
797         with input file index.
798         (Script_info::input_file_index): New function.
799         (Script_info::input_file_index_): New data member.
800         (Incremental_binary::get_library): Add const.
801         (Incremental_binary::get_script_info): Add const.
802         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
803         * testsuite/Makefile.am (incremental_test_5): New test case.
804         (incremental_test_6): New test case.
805         * testsuite/Makefile.in: Regenerate.
806
807 2011-07-06  Cary Coutant  <ccoutant@google.com>
808
809         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
810         debug output when command lines differ.
811
812 2011-07-06  Cary Coutant  <ccoutant@google.com>
813
814         * incremental.cc (Incremental_inputs::report_command_line): Ignore
815         --incremental-patch option.
816         * layout.cc (Free_list::allocate): Extend allocation beyond original
817         end if enabled.
818         (Layout::make_output_section): Mark sections that should get
819         patch space.
820         * options.cc (parse_percent): New function.
821         * options.h (parse_percent): New function.
822         (DEFINE_percent): New macro.
823         (General_options): Add --incremental-patch option.
824         * output.cc (Output_section::Output_section): Initialize new data
825         members.
826         (Output_section::add_input_section): Print section name when out
827         of patch space.
828         (Output_section::add_output_section_data): Likewise.
829         (Output_section::set_final_data_size): Add patch space when
830         doing --incremental-full.
831         (Output_section::do_reset_address_and_file_offset): Remove patch
832         space.
833         (Output_segment::set_section_list_addresses): Print debug output
834         only if --incremental-update.
835         * output.h (Output_section::set_is_patch_space_allowed): New function.
836         (Output_section::is_patch_space_allowed_): New data member.
837         (Output_section::patch_space_): New data member.
838         * parameters.cc (Parameters::incremental_full): New function.
839         * parameters.h (Parameters::incremental_full): New function
840         * testsuite/Makefile.am (incremental_test_2): Add test for
841         --incremental-patch option.
842         * testsuite/Makefile.in: Regenerate.
843         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
844         (t18): Remove function body.
845
846 2011-07-05  Doug Kwan  <dougkwan@google.com>
847
848         PR gold/12771
849         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
850         Arm_Address type for relocation result.
851         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
852         overflow check.
853         (Arm_relocate_functions::abs32): Use unaligned access.
854         (Arm_relocate_functions::rel32): Ditto.
855         (Arm_relocate_functions::prel31): Ditto.
856         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
857         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
858         static data relocations.
859         * testsuite/Makefile.in: Regnerate.
860         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
861
862 2011-07-05  Ian Lance Taylor  <iant@google.com>
863
864         PR gold/12392
865         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
866         symbols if necessary.
867         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
868
869 2011-07-05  Ian Lance Taylor  <iant@google.com>
870
871         PR gold/12952
872         * resolve.cc (Symbol::override_base_with_special): Simply override
873         version with special symbol version, ignoring previous version.
874
875 2011-07-05  Ian Lance Taylor  <iant@google.com>
876
877         * object.cc (Sized_relobj_file::include_section_group): Add
878         information to comment about signature location.
879
880 2011-07-02  Ian Lance Taylor  <iant@google.com>
881
882         PR gold/12957
883         * options.h (class General_options): Add -f and -F.
884         * options.cc (General_options::finalize): Fatal error if -f/-F
885         are used without -shared.
886         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
887
888 2011-07-02  Ian Lance Taylor  <iant@google.com>
889
890         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
891
892 2011-07-01  Ian Lance Taylor  <iant@google.com>
893
894         PR gold/12525
895         PR gold/12952
896         * resolve.cc (Symbol::override_base_with_special): Don't override
897         the version if the overriding symbol has a different name.
898         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
899         all callers.  If we give an error about an undefined version,
900         define the base version if necessary.
901         * dynobj.h (class Versions): Update declaration.
902         * testsuite/weak_alias_test_5.cc: New file.
903         * testsuite/weak_alias_test.script: New file.
904         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
905         and versioned_alias have the right value, and call t2.
906         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
907         weak_alias_test_5.so.
908         (weak_alias_test_LDADD): Likewise.
909         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
910         * testsuite/Makefile.in: Rebuild.
911
912 2011-07-01  Ian Lance Taylor  <iant@google.com>
913
914         PR gold/12525
915         * options.h (class General_options): Support -z notext.
916         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
917         -Wl,-z,notext.
918         (two_file_shared_nonpic.so): Likewise.
919         (two_file_shared_mixed.so): Likewise.
920         (two_file_shared_mixed_1.so): Likewise.
921         (weak_undef_lib_nonpic.so): Likewise.
922         (alt/weak_undef_lib_nonpic.so): Likewise.
923         (tls_test_shared_nonpic.so): Likewise.
924         * testsuite/Makefile.in: Rebuild.
925
926 2011-07-01  Ian Lance Taylor  <iant@google.com>
927
928         PR gold/12525
929         * configure.ac: Test whether static linking works, setting
930         the automake conditional HAVE_STATIC.
931         * testsuite/Makefile.am: Disable tests using -static if
932         HAVE_STATIC is not true.
933         * configure, testsuite/Makefile.in: Rebuild.
934
935 2011-07-01  Ian Lance Taylor  <iant@google.com>
936
937         PR gold/12525
938         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
939         Assert if we see DW_EH_PE_indirect.
940         * target.h (Target::ehframe_datarel_base): New function.
941         (Target::do_ehframe_datarel_base): New target function.
942         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
943         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
944         function.
945
946 2011-07-01  Ian Lance Taylor  <iant@google.com>
947
948         PR gold/12571
949         * options.h (class General_options): Add
950         --ld-generated-unwind-info.
951         * ehframe.cc (Fde::write): Add address parameter.  Change all
952         callers.  If associated with PLT, fill in address and size.
953         (Cie::set_output_offset): Only add merge mapping if there is an
954         object.
955         (Cie::write): Add address parameter.  Change all callers.
956         (Eh_frame::add_ehframe_for_plt): New function.
957         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
958         input_offset_ fields into union u_, with new plt field.
959         (Fde::Fde): Adjust for new union field.
960         (Fde::Fde) [Output_data version]: New constructor.
961         (Fde::add_mapping): Only add merge mapping if there is an object.
962         (class Cie): Update declarations.
963         (class Eh_frame): Declare add_ehframe_for_plt.
964         * layout.cc (Layout::layout_eh_frame): Break out code into
965         make_eh_frame_section, and call it.
966         (Layout::make_eh_frame_section): New function.
967         (Layout::add_eh_frame_for_plt): New function.
968         * layout.h (class Layout): Update declarations.
969         * merge.cc (Merge_map::add_mapping): Add assertion.
970         * i386.cc: Include "dwarf.h".
971         (class Output_data_plt_i386): Make first_plt_entry,
972         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
973         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
974         and plt_eh_frame_fde.
975         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
976         boundary.  Call add_eh_frame_for_plt if appropriate.
977         * x86_64.cc: Include "dwarf.h".
978         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
979         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
980         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
981         and plt_eh_frame_fde.
982         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
983         appropriate.
984
985 2011-06-29  Ian Lance Taylor  <iant@google.com>
986
987         PR gold/12629
988         * object.cc (Sized_relobj_file::layout_section): Change shdr
989         parameter to be const.
990         (Sized_relobj_file::layout_eh_frame_section): New function, broken
991         out of do_layout.
992         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
993         appropriate.  Call layout_eh_frame_section.
994         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
995         sections.
996         * object.h (class Sized_relobj_file): Update declarations.
997
998 2011-06-29  Ian Lance Taylor  <iant@google.com>
999
1000         PR gold/12652
1001         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1002         modifier.
1003         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1004
1005 2011-06-29  Ian Lance Taylor  <iant@google.com>
1006
1007         PR gold/12675
1008         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1009         SHT_X86_64_UNWIND.
1010         * layout.cc (Layout::layout_eh_frame): Likewise.
1011
1012 2011-06-29  Ian Lance Taylor  <iant@google.com>
1013
1014         PR gold/12695
1015         * layout.cc (Layout::symtab_section_shndx): New function.
1016         * layout.h (class Layout): Declare symtab_section_shndx.
1017         * output.cc (Output_section::write_header): Call it.
1018
1019 2011-06-29  Ian Lance Taylor  <iant@google.com>
1020
1021         PR gold/12818
1022         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1023         symbols which are not used in a relocation.
1024
1025 2011-06-28  Ian Lance Taylor  <iant@google.com>
1026
1027         PR gold/12898
1028         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1029         script create indistinguishable segments.
1030         (Layout::set_segment_offsets): Use stable_sort when sorting
1031         segments.  Pass this to Compare_segments constructor.
1032         * layout.h (class Layout): Make segment_precedes non-static.
1033         (class Compare_segments): Change from struct to class.  Add
1034         layout_ field.  Add constructor.
1035         * script-sections.cc
1036         (Script_sections::attach_sections_using_phdrs_clause): Rename
1037         local orphan to is_orphan.  Don't report failure to put empty
1038         section in segment.  On attachment failure, report name of
1039         section, and attach to first PT_LOAD segment.
1040
1041 2011-06-28  Ian Lance Taylor  <iant@google.com>
1042
1043         PR gold/12934
1044         * target-select.cc (Target_selector::Target_selector): Add
1045         emulation parameter.  Change all callers.
1046         (select_target_by_bfd_name): Rename from select_target_by_name.
1047         Change all callers.
1048         (select_target_by_emulation): New function.
1049         (supported_emulation_names): New function.
1050         * target-select.h (class Target_selector): Add emulation_ field.
1051         Update declarations.
1052         (Target_selector::recognize_by_bfd_name): Rename from
1053         recognize_by_name.  Change all callers.
1054         (Target_selector::supported_bfd_names): Rename from
1055         supported_names.  Change all callers.
1056         (Target_selector::recognize_by_emulation): New function.
1057         (Target_selector::supported_emulations): New function.
1058         (Target_selector::emulation): New function.
1059         (Target_selector::do_recognize_by_bfd_name): Rename from
1060         do_recognize_by_name.  Change all callers.
1061         (Target_selector::do_supported_bfd_names): Rename from
1062         do_supported_names.  Change all callers.
1063         (Target_selector::do_recognize_by_emulation): New function.
1064         (Target_selector::do_supported_emulations): New function.
1065         (select_target_by_bfd_name): Change name in declaration.
1066         (select_target_by_emulation): Declare.
1067         (supported_emulation_names): Declare.
1068         * parameters.cc (parameters_force_valid_target): Try to find
1069         target based on emulation from -m option.
1070         * options.h (class General_options): Change doc string for -m.
1071         * options.cc (help): Print emulations.
1072         (General_options::parse_V): Likewise.
1073         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1074         Add emulation parameter.  Change all callers.
1075
1076 2011-06-28  Ian Lance Taylor  <iant@google.com>
1077
1078         * target.h (class Target): Add osabi_ field.
1079         (Target::osabi): New function.
1080         (Target::set_osabi): New function.
1081         (Target::Target): Initialize osabi_.
1082         (Target::do_adjust_elf_header): Make pure virtual.
1083         (Sized_target::do_adjust_elf_header): Declare.
1084         * target.cc (Sized_target::do_adjust_elf_header): New function.
1085         (class Sized_target): Instantiate all versions.
1086         * freebsd.h (class Target_freebsd): Remove.
1087         (Target_selector_freebsd::do_recognize): Call set_osabi on
1088         Target.
1089         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1090         (Target_selector_freebsd::set_osabi): Remove.
1091         * i386.cc (class Target_i386): Inherit from Sized_target rather
1092         than Target_freebsd.
1093         * x86_64.cc (class Target_x86_64): Likewise.
1094
1095 2011-06-28  Ian Lance Taylor  <iant@google.com>
1096
1097         * target.h (Target::can_check_for_function_pointers): Rewrite.
1098         Make non-virtual.
1099         (Target::can_icf_inline_merge_sections): Likewise.
1100         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1101         (Target::Target_info): Add can_icf_inline_merge_sections field.
1102         (Target::do_can_check_for_function_pointers): New virtual
1103         function.
1104         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1105         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1106         from can_check_for_function_pointers, move in file.
1107         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1108         section_may_have_icf_unsafe_poineters, move in file.
1109         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1110         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1111         Rename from can_check_for_function_pointers, move in file.
1112         (Target_i386::can_icf_inline_merge_sections): Remove.
1113         (Target_i386::i386_info): Initialize
1114         can_icf_inline_merge_sections.
1115         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1116         Initialize can_icf_inline_merge_sections.
1117         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1118         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1119         Rename from can_check_for_function_pointers, move in file.
1120         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1121         (Target_x86_64::x86_64_info): Initialize
1122         can_icf_inline_merge_sections.
1123         * testsuite/testfile.cc (Target_test::test_target_info):
1124         Likewise.
1125         * icf.cc (get_section_contents): Correct formatting.
1126
1127 2011-06-27  Ian Lance Taylor  <iant@google.com>
1128
1129         * symtab.cc (Symbol::versioned_name): New function.
1130         (Symbol_table::add_to_final_symtab): Use versioned_name when
1131         appropriate.
1132         (Symbol_table::sized_write_symbol): Likewise.
1133         * symtab.h (class Symbol): Declare versioned_name.
1134         * stringpool.h (class Stringpool_template): Add variant of add
1135         which takes a std::basic_string.
1136         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1137         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1138         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1139         (ver_test_12.o): New target.
1140         * testsuite/Makefile.in: Rebuild.
1141
1142 2011-06-27  Doug Kwan  <dougkwan@google.com>
1143
1144         * arm.cc (Arm_relocate_functions::thm_jump8,
1145         Arm_relocate_functions::thm_jump11): Use a wider signed
1146         type to compute offset.
1147         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1148         arm_thm_jump8.
1149         * testsuite/Makefile.in: Regenerate.
1150         * testsuite/arm_branch_in_range.sh: Check test results of
1151         arm_thm_jump11 and arm_thm_jump8.
1152         * testsuite/arm_thm_jump11.s: New test source file.
1153         * testsuite/arm_thm_jump11.t: New linker script.
1154         * testsuite/arm_thm_jump8.s: New test source file.
1155         * testsuite/arm_thm_jump8.t: New linker script.
1156
1157 2011-06-24  Ian Lance Taylor  <iant@google.com>
1158
1159         * layout.cc: Include "object.h".
1160         (ctors_sections_in_init_array): New static variable.
1161         (Layout::is_ctors_in_init_array): New function.
1162         (Layout::layout): Add entry to ctors_sections_in_init_array if
1163         appropriate.
1164         * layout.h (class Layout): Declare is_ctors_in_init_array.
1165         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1166         is_ctors_reverse_view is set.
1167         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1168         all callers.  Set is_ctors_reverse_view field of View_size.
1169         (Sized_relobj_file::reverse_words): New function.
1170         * object.h (Sized_relobj_file::View_size): Add
1171         is_ctors_reverse_view field.
1172         (class Sized_relobj_file): Update declarations.
1173         * testsuite/initpri3.c: New test.
1174         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1175         initpri3b.
1176         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1177         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1178         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1179         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1180         * testsuite/Makefile.in: Rebuild.
1181
1182 2011-06-24  Cary Coutant  <ccoutant@google.com>
1183
1184         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1185         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1186         (debug_msg_cdebug.err): New targets.
1187         * testsuite/Makefile.in: Regenerate.
1188         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1189         Fix checks for link with shared library.
1190
1191 2011-06-24  Doug Kwan  <dougkwan@google.com>
1192
1193         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1194         skip empty text sections.
1195         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1196
1197 2011-06-22  Ian Lance Taylor  <iant@google.com>
1198
1199         PR gold/12910
1200         * options.h (class General_options): Add --ctors-in-init-array.
1201         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1202         friends as SHT_PROGBITS for merging sections.
1203         (Layout::layout): Remove special handling of .init_array and
1204         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1205         and .dtors if ctors_in_init_array.
1206         (Layout::make_output_section): Force correct section types for
1207         .init_array and friends.  Don't sort if doing relocatable link,
1208         Don't sort .ctors and .dtors if ctors_in_init_array.
1209         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1210         (Layout::output_section_name): Add relobj parameter.  Change all
1211         callers.  Handle .ctors. and .dtors. in code rather than table.
1212         Handle .ctors and .dtors if ctors_in_init_array.
1213         (Layout::match_file_name): New function, moved from output.cc.
1214         * layout.h (class Layout): Update declarations.
1215         * output.cc: Include "layout.h".
1216         (Input_section_sort_entry::get_priority): New function.
1217         (Input_section_sort_entry::match_file_name): Just call
1218         Layout::match_file_name.
1219         (Output_section::Input_section_sort_init_fini_compare::operator()):
1220         Handle .ctors and .dtors.  Sort by explicit priority rather than
1221         by name.
1222         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1223         * testsuite/initpri2.c: New test.
1224         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1225         (check_PROGRAMS): Add initpri2.
1226         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1227         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1228         * configure, testsuite/Makefile.in: Rebuild.
1229
1230 2011-06-19  Ian Lance Taylor  <iant@google.com>
1231
1232         PR gold/12880
1233         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1234         .interp section to a PT_INTERP segment even if we have seen a
1235         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1236         clause in a linker script.
1237         (Layout::finalize): Don't create a .interp section if we've
1238         already create a PT_INTERP segment.
1239         (Layout::create_interp): Always call choose_output_section (revert
1240         patch of 2011-06-17).  Don't create PT_INTERP segment.
1241         * script-sections.cc
1242         (Script_sections::create_note_and_tls_segments): Add a .interp
1243         section to a PT_INTERP segment even if we have seen a
1244         --dynamic-linker option.
1245
1246 2011-06-18  Ian Lance Taylor  <iant@google.com>
1247
1248         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1249         merely because a non-PT_LOAD segment has a dynamic reloc.
1250
1251 2011-06-18  Ian Lance Taylor  <iant@google.com>
1252
1253         * layout.cc (Layout::finish_dynamic_section): Don't create
1254         DT_FLAGS entry if not needed.
1255
1256 2011-06-18  Ian Lance Taylor  <iant@google.com>
1257
1258         PR gold/12745
1259         * layout.cc (Layout::layout_eh_frame): Correct handling of
1260         writable .eh_frame section.
1261
1262 2011-06-17  Ian Lance Taylor  <iant@google.com>
1263
1264         PR gold/12893
1265         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1266         symbol is redefined with the exact same object and value.
1267
1268 2011-06-17  Ian Lance Taylor  <iant@google.com>
1269
1270         PR gold/12880
1271         * layout.h (class Layout): Add interp_segment_ field.
1272         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1273         (Layout::attach_allocated_section_to_segment): If making shared
1274         library, put .interp section in PT_INTERP segment.
1275         (Layout::finalize): Also call create_interp if -dynamic-linker
1276         option was used.
1277         (Layout::create_interp): Assert that there is no PT_INTERP
1278         segment.  If not using a SECTIONS clause, use make_output_section.
1279         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1280         * script-sections.cc
1281         (Script_sections::create_note_and_tls_segments): If making shared
1282         library, put .interp section in PT_INTERP segment.
1283
1284 2011-06-17  Ian Lance Taylor  <iant@google.com>
1285
1286         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1287         when making a shared library.
1288
1289 2011-06-17  Ian Lance Taylor  <iant@google.com>
1290
1291         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1292         parameter.  Change all callers.  Don't issue warning about PC32
1293         against locally defined symbol.
1294
1295 2011-06-16  Ian Lance Taylor  <iant@google.com>
1296
1297         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1298         occurs in same object.
1299
1300 2011-06-14  Alan Modra  <amodra@gmail.com>
1301
1302         * po/POTFILES.in: Regenerate.
1303
1304 2011-06-09  Ian Lance Taylor  <iant@google.com>
1305
1306         * script-sections.cc
1307         (Orphan_output_section::set_section_addresses): For a relocatable
1308         link set address to 0.
1309
1310 2011-06-09  Cary Coutant  <ccoutant@google.com>
1311
1312         PR gold/12804
1313         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1314         used with --compress-debug-sections.
1315         * gold/object.cc (Sized_relobj_file::do_layout): Report
1316         uncompressed size of compressed input sections.
1317
1318 2011-06-08  Cary Coutant  <ccoutant@google.com>
1319
1320         PR gold/12804
1321         * testsuite/two_file_test_2_v1.cc: Change initialization of
1322         v2 to keep it in .data.
1323
1324 2011-06-07  Cary Coutant  <ccoutant@google.com>
1325
1326         * common.cc (Symbol_table::do_allocate_commons_list): Call
1327         gold_fallback.
1328         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1329         (Errors::fallback): New function.
1330         (gold_fallback): New function.
1331         * errors.h (Errors::fallback): New function.
1332         * gold.cc (gold_exit): Change status parameter to enum; adjust
1333         all callers.
1334         (queue_initial_tasks): Call gold_fallback.
1335         * gold.h: Include cstdlib.
1336         (Exit_status): New enum type.
1337         (gold_exit): Change status parameter to enum.
1338         (gold_fallback): New function.
1339         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1340         (Layout::create_symtab_sections): Likewise.
1341         (Layout::create_shdrs): Likewise.
1342         * main.cc (main): Adjust call to gold_exit.
1343         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1344         (Output_data_got::add_got_entry_pair): Likewise.
1345         (Output_section::add_input_section): Likewise.
1346         (Output_section::add_output_section_data): Likewise.
1347         (Output_segment::set_section_list_addresses): Likewise.
1348         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1349
1350 2011-06-07  Cary Coutant  <ccoutant@google.com>
1351
1352         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1353         for incremental links.
1354         * output.cc (Output_segment::set_section_list_addresses): Remove
1355         FIXME and test for TLS or BSS.
1356
1357 2011-06-07  Cary Coutant  <ccoutant@google.com>
1358
1359         * testsuite/Makefile.am: Add incremental_copy_test,
1360         incremental_common_test_1.
1361         * testsuite/Makefile.in: Regenerate.
1362         * testsuite/common_test_1_v1.c: New source file.
1363         * testsuite/common_test_1_v2.c: New source file.
1364         * testsuite/copy_test_v1.cc: New source file.
1365
1366 2011-06-07  Cary Coutant  <ccoutant@google.com>
1367
1368         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1369         update, allocate common from bss section's free list.
1370         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1371         linker-defined symbols.
1372         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1373         Skip GOT and PLT entries that are no longer referenced.
1374         (Output_section_incremental_inputs::write_info_blocks): Mark
1375         linker-defined symbols.
1376         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1377         * output.cc (Output_section::allocate): New function.
1378         * output.h (Output_section::allocate): New function.
1379         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1380         linker-defined symbols.
1381         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1382         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1383         (Symbol::init_base_output_data): Likewise.
1384         (Symbol::init_base_output_segment): Likewise.
1385         (Symbol::init_base_constant): Likewise.
1386         (Sized_symbol::init_output_data): Likewise.
1387         (Sized_symbol::init_output_segment): Likewise.
1388         (Sized_symbol::init_constant): Likewise.
1389         (Symbol_table::do_define_in_output_data): Likewise.
1390         (Symbol_table::do_define_in_output_segment): Likewise.
1391         (Symbol_table::do_define_as_constant): Likewise.
1392         * symtab.h (Symbol::is_predefined): New function.
1393         (Symbol::init_base_output_data): Add is_predefined parameter.
1394         (Symbol::init_base_output_segment): Likewise.
1395         (Symbol::init_base_constant): Likewise.
1396         (Symbol::is_predefined_): New data member.
1397         (Sized_symbol::init_output_data): Add is_predefined parameter.
1398         (Sized_symbol::init_output_segment): Likewise.
1399         (Sized_symbol::init_constant): Likewise.
1400         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1401
1402 2011-06-07  Cary Coutant  <ccoutant@google.com>
1403
1404         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1405         instead of emit_copy_reloc.
1406         (Copy_relocs::emit_copy_reloc): Refactor.
1407         (Copy_relocs::make_copy_reloc): New function.
1408         (Copy_relocs::add_copy_reloc): Remove.
1409         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1410         section.
1411         (Copy_relocs::make_copy_reloc): New function.
1412         (Copy_relocs::add_copy_reloc): Remove.
1413         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1414         unchanged input files.
1415         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1416         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1417         Reserve BSS space for COPY relocations.
1418         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1419         (Output_section_incremental_inputs::write_info_blocks): Record
1420         whether a symbol is copied from a shared object.
1421         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1422         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1423         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1424         (Incremental_input_entry_reader::get_output_symbol_index): Add
1425         is_copy parameter.
1426         (Incremental_binary::emit_copy_relocs): New function.
1427         (Incremental_binary::do_emit_copy_relocs): New function.
1428         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1429         new data member.
1430         (Sized_incremental_binary::add_copy_reloc): New function.
1431         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1432         (Sized_incremental_binary::Copy_reloc): New struct.
1433         (Sized_incremental_binary::Copy_relocs): New typedef.
1434         (Sized_incremental_binary::copy_relocs_): New data member.
1435         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1436         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1437         * target.h (Sized_target::emit_copy_reloc): New function.
1438         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1439
1440 2011-06-02  Cary Coutant  <ccoutant@google.com>
1441
1442         PR gold/12163
1443         * gold/archive.cc (Archive::Archive): Initialize new data member.
1444         (Archive::include_all_members): Return if archive has already been
1445         included.
1446         * gold/archive.h (Archive::include_all_members_): New data member.
1447
1448 2011-06-02  Nick Clifton  <nickc@redhat.com>
1449
1450         * dynobj.h: Fix spelling mistake in comment.
1451         * output.cc: Likewise.
1452
1453 2011-05-31  Doug Kwan  <dougkwan@google.com>
1454             Asier Llano
1455
1456         PR gold/12826
1457         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1458         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1459         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1460         redundant arm_exidx_test.so.
1461         * testsuite/Makefile.in: Regenerate.
1462         (check_SCRIPTS): Add pr12826.sh
1463         (check_DATA): Add pr12826.stdout
1464         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1465         * testsuite/pr12826.sh: New file.
1466         * testsuite/pr12826_1.s: Ditto.
1467         * testsuite/pr12826_1.s: Ditto.
1468
1469 2011-05-30  Ian Lance Taylor  <iant@google.com>
1470
1471         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1472         sections.
1473
1474 2011-05-29  Ian Lance Taylor  <iant@google.com>
1475
1476         PR gold/12804
1477         * testsuite/Makefile.am: Use different file name for two_file_test
1478         temporary file for each incremental test.
1479         * testsuite/Makefile.in: Rebuild.
1480
1481 2011-05-29  Ian Lance Taylor  <iant@google.com>
1482
1483         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1484         binary input file is empty.
1485
1486 2011-05-27  Ian Lance Taylor  <iant@google.com>
1487
1488         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1489         (ver_test_9.so): Likewise.
1490         * testsuite/Makefile.in: Rebuild.
1491
1492 2011-05-26 Cary Coutant  <ccoutant@google.com>
1493
1494         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1495         * incremental.cc (Incremental_inputs::report_input_section): Fix
1496         comment, indentation.
1497         (Incremental_inputs::report_comdat_group): New function.
1498         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1499         of data for incremental input file entry.
1500         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1501         group count, COMDAT group signatures.
1502         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1503         an unchanged input file.
1504         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1505         Initialize new data member.
1506         (Incremental_object_entry::add_comdat_group): New function.
1507         (Incremental_object_entry::get_comdat_group_count): New function.
1508         (Incremental_object_entry::get_comdat_signature_key): New function.
1509         (Incremental_object_entry::groups_): New data member.
1510         (Incremental_inputs::report_comdat_group): New function.
1511         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1512         data for incremental input file entry.
1513         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1514         (Incremental_input_entry_reader::get_input_section): Adjust size of
1515         data for incremental input file entry.
1516         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1517         (Incremental_input_entry_reader::get_comdat_group_signature): New
1518         function.
1519         * object.cc (Sized_relobj::include_section_group): Report kept
1520         COMDAT groups for incremental links.
1521
1522 2011-05-24  David Meyer  <pdox@google.com>
1523
1524         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1525         with name parameter.  Add found_name parameter.
1526         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1527         * dirsearch.h (class Dirsearch): Update declaration.
1528
1529 2011-05-24  Ian Lance Taylor  <iant@google.com>
1530
1531         * archive.cc (Library_base::should_include_member): Pull in object
1532         from archive if it defines the entry symbol.
1533         * parameters.cc (Parameters::entry): New function.
1534         * parameters.h (class Parameters): Declare entry.
1535         * output.h (class Output_file_header): Remove entry_ field.
1536         * output.cc (Output_file_header::Output_file_header): Remove entry
1537         parameter.  Change all callers.
1538         (Output_file_header::entry): Use parameters->entry.
1539         * gold.cc (queue_middle_tasks): Likewise.
1540         * plugin.cc (Plugin_hook::run): Likewise.
1541
1542 2011-05-24 Cary Coutant  <ccoutant@google.com>
1543
1544         * gold.cc (queue_initial_tasks): Pass incremental base filename
1545         to Output_file::open_base_file; don't print error message.
1546         * incremental-dump.cc (main): Adjust call to
1547         Output_file::open_for_modification.
1548         * incremental-dump.cc (main): Likewise.
1549         * incremental.cc (Incremental_inputs::report_command_line):
1550         Ignore --incremental-base option when comparing command lines.
1551         Ignore parameter when given as separate argument.
1552         * options.h (class General_options): Add --incremental-base.
1553         * output.cc (Output_file::Output_file):
1554         (Output_file::open_base_file): Add base_name and writable parameters;
1555         read base file into new file; print error message here.
1556         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1557         callers.
1558         * output.h (Output_file::open_for_modification): Rename to...
1559         (Output_file::open_base_file): ...this; add base_name and
1560         writable parameters; adjust all callers.
1561         (Output_file::map_no_anonymous): Add writable parameter; adjust all
1562         callers.
1563         * testsuite/Makefile.am (incremental_test_4): Test
1564         --incremental-base.
1565         * testsuite/Makefile.in: Regenerate.
1566
1567 2011-05-24 Cary Coutant  <ccoutant@google.com>
1568
1569         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1570         incremental_test_4.
1571         * testsuite/Makefile.in: Regenerate.
1572         * testsuite/two_file_test_1_v1.cc: New test source file.
1573         * testsuite/two_file_test_1b_v1.cc: New test source file.
1574         * testsuite/two_file_test_2_v1.cc: New test source file.
1575
1576 2011-05-24 Cary Coutant  <ccoutant@google.com>
1577
1578         * dynobj.h (Dynobj::do_dynobj): New function.
1579         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1580         flag and soname for shared objects.
1581         * incremental.cc (Incremental_inputs::report_object): Make
1582         either Incremental_object_entry or Incremental_dynobj_entry; add
1583         soname to string table.
1584         (Incremental_inputs::report_input_section): Add assertion.
1585         (Output_section_incremental_inputs::set_final_data_size): Adjust
1586         type of input file entry for shared libraries; adjust size of
1587         shared library info entry.
1588         (Output_section_incremental_inputs::write_input_files): Write
1589         as_needed flag for shared libraries.
1590         (Output_section_incremental_inputs::write_info_blocks): Adjust type
1591         of input file entry for shared libraries; write soname.
1592         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1593         soname from incremental info.
1594         * incremental.h (enum Incremental_input_flags): Add
1595         INCREMENTAL_INPUT_AS_NEEDED.
1596         (Incremental_input_entry::Incremental_input_entry): Initialize new
1597         data member.
1598         (Incremental_input_entry::set_as_needed): New function.
1599         (Incremental_input_entry::as_needed): New function.
1600         (Incremental_input_entry::do_dynobj_entry): New function.
1601         (Incremental_input_entry::as_needed_): New data member.
1602         (Incremental_object_entry::Incremental_object_entry): Don't check
1603         for shared library.
1604         (Incremental_object_entry::do_type): Likewise.
1605         (class Incremental_dynobj_entry): New class.
1606         (Incremental_input_entry_reader::as_needed): New function.
1607         (Incremental_input_entry_reader::get_soname): New function.
1608         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1609         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1610         size of shared library info entry.
1611         * layout.cc (Layout::finish_dynamic_section): Don't test for 
1612         incremental link when adding DT_NEEDED entries.
1613         * object.h (Object::Object): Initialize new data member.
1614         (Object::dynobj): New function.
1615         (Object::set_as_needed): New function.
1616         (Object::as_needed): New function.
1617         (Object::do_dynobj): New function.
1618         (Object::as_needed_): New data member.
1619
1620 2011-05-24 Cary Coutant  <ccoutant@google.com>
1621
1622         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1623         info; adjust display of GOT entries.
1624         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1625         vector of input objects; remove file_status_.
1626         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1627         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1628         got_plt reader; call target hooks to reserve GOT entries.
1629         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1630         of input file info header and GOT info entry.
1631         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1632         relocation info.
1633         (Got_plt_view_info::got_descriptor): Remove.
1634         (Got_plt_view_info::sym_index): New data member.
1635         (Got_plt_view_info::input_index): New data member.
1636         (Local_got_offset_visitor::visit): Write input file index.
1637         (Global_got_offset_visitor::visit): Write 0 for input file index.
1638         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1639         with sym_index and input_index.
1640         (Output_section_incremental_inputs::write_got_plt): Adjust size of
1641         incremental info GOT entry; replace got_descriptor with input_index.
1642         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1643         map from input file index to object.
1644         (Sized_relobj_incr::do_layout): Replace direct data member reference
1645         with accessor function.
1646         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1647         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1648         Adjust size of input file info header.
1649         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1650         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1651         (Incremental_input_entry_reader::get_input_section): Adjust size of
1652         input file info header.
1653         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1654         of incremental info GOT entry.
1655         (Incremental_got_plt_reader::get_got_desc): Remove.
1656         (Incremental_got_plt_reader::get_got_symndx): New function.
1657         (Incremental_got_plt_reader::get_got_input_index): New function.
1658         (Sized_incremental_binary::Sized_incremental_binary): Remove
1659         file_status_; add input_objects_.
1660         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1661         (Sized_incremental_binary::set_file_is_unchanged): Remove.
1662         (Sized_incremental_binary::file_is_unchanged): Remove.
1663         (Sized_incremental_binary::set_input_object): New function.
1664         (Sized_incremental_binary::input_object): New function.
1665         (Sized_incremental_binary::file_status_): Remove.
1666         (Sized_incremental_binary::input_objects_): New data member.
1667         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1668         references.
1669         (Sized_relobj_incr::invalid_address): Move to base class.
1670         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1671         class.
1672         (Sized_relobj_incr::do_output_section_offset): Likewise.
1673         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1674         (Sized_relobj_incr::section_offsets_): Likewise.
1675         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1676         function.
1677         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1678         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1679         with accessor function.
1680         (Sized_relobj_file::do_layout): Likewise.
1681         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1682         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1683         (Sized_relobj_file::compute_final_local_value): Replace refs to
1684         section_offsets_ with accessor function.
1685         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1686         * object.h (Relobj::Relobj): Initialize new data members.
1687         (Relobj::add_dyn_reloc): New function.
1688         (Relobj::first_dyn_reloc): New function.
1689         (Relobj::dyn_reloc_count): New function.
1690         (Relobj::first_dyn_reloc_): New data member.
1691         (Relobj::dyn_reloc_count_): New data member.
1692         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1693         references.
1694         (Sized_relobj::Address): New typedef.
1695         (Sized_relobj::invalid_address): Move here from child class.
1696         (Sized_relobj::Sized_relobj): Initialize new data members.
1697         (Sized_relobj::sized_relobj): New function.
1698         (Sized_relobj::is_output_section_offset_invalid): Move here from
1699         child class.
1700         (Sized_relobj::get_output_section_offset): Likewise.
1701         (Sized_relobj::local_has_got_offset): Likewise.
1702         (Sized_relobj::local_got_offset): Likewise.
1703         (Sized_relobj::set_local_got_offset): Likewise.
1704         (Sized_relobj::do_for_all_local_got_entries): Likewise.
1705         (Sized_relobj::clear_got_offsets): New function.
1706         (Sized_relobj::section_offsets): Move here from child class.
1707         (Sized_relobj::do_output_section_offset): Likewise.
1708         (Sized_relobj::do_set_section_offset): Likewise.
1709         (Sized_relobj::Local_got_offsets): Likewise.
1710         (Sized_relobj::local_got_offsets_): Likewise.
1711         (Sized_relobj::section_offsets_): Likewise.
1712         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1713         references.
1714         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1715         class.
1716         (Sized_relobj_file::sized_relobj): New function
1717         (Sized_relobj_file::local_has_got_offset): Move to base class.
1718         (Sized_relobj_file::local_got_offset): Likewise.
1719         (Sized_relobj_file::set_local_got_offset): Likewise.
1720         (Sized_relobj_file::get_output_section_offset): Likewise.
1721         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1722         (Sized_relobj_file::do_output_section_offset): Likewise.
1723         (Sized_relobj_file::do_set_section_offset): Likewise.
1724         (Sized_relobj_file::Local_got_offsets): Likewise.
1725         (Sized_relobj_file::local_got_offsets_): Likewise.
1726         (Sized_relobj_file::section_offsets_): Likewise.
1727         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1728         (all constructors).
1729         (set_needs_dynsym_index): Convert relobj to derived class pointer.
1730         (Output_reloc::get_symbol_index): Likewise.
1731         (Output_reloc::local_section_offset): Likewise.
1732         (Output_reloc::get_address): Likewise.
1733         (Output_reloc::symbol_value): Likewise.
1734         (Output_data_got::reserve_slot): Move to class definition.
1735         (Output_data_got::reserve_local): New function.
1736         (Output_data_got::reserve_slot_for_global): Remove.
1737         (Output_data_got::reserve_global): New function.
1738         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1739         (all constructors, two instantiations).
1740         (Output_reloc::get_relobj): New function (two instantiations).
1741         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1742         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1743         (Output_data_reloc::add_global): Adjust type of relobj.
1744         (Output_data_reloc::add_global_relative): Likewise.
1745         (Output_data_reloc::add_symbolless_global_addend): Likewise.
1746         (Output_data_reloc::add_local): Likewise.
1747         (Output_data_reloc::add_local_relative): Likewise.
1748         (Output_data_reloc::add_symbolless_local_addend): Likewise.
1749         (Output_data_reloc::add_local_section): Likewise.
1750         (Output_data_reloc::add_output_section): Likewise.
1751         (Output_data_reloc::add_absolute): Likewise.
1752         (Output_data_reloc::add_target_specific): Likewise.
1753         (Output_data_got::reserve_slot): Move definition here.
1754         (Output_data_got::reserve_local): New function.
1755         (Output_data_got::reserve_global): New function.
1756         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1757         section_offsets_ with accessor function.
1758         (Sized_relobj_file::write_sections): Likewise.
1759         (Sized_relobj_file::do_relocate_sections): Likewise.
1760         * target.h (Sized_target::reserve_local_got_entry): New function.
1761         (Sized_target::reserve_global_got_entry): New function.
1762         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1763         (Target_x86_64::reserve_global_got_entry): New function.
1764         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1765
1766 2011-05-23 Cary Coutant  <ccoutant@google.com>
1767
1768         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1769         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1770         bit when checking got_type.
1771         * incremental.cc (Sized_incremental_binary::setup_readers):
1772         Store symbol table and string table locations; initialize bit vector
1773         of file status flags.
1774         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1775         unchanged files.
1776         (Sized_incremental_binary::do_process_got_plt): New function.
1777         (Sized_incremental_binary::get_symtab_view): Use stored locations.
1778         (Output_section_incremental_inputs::set_final_data_size): Record
1779         file index for each input file.
1780         (Output_section_incremental_inputs::write_got_plt): Store file index
1781         instead of input entry offset for each GOT entry.
1782         * incremental.h
1783         (Incremental_input_entry::Incremental_input_entry): Initialize new
1784         data member.
1785         (Incremental_input_entry::set_offset): Store file index.
1786         (Incremental_input_entry::get_file_index): New function.
1787         (Incremental_input_entry::file_index_): New data member.
1788         (Incremental_binary::process_got_plt): New function.
1789         (Incremental_binary::do_process_got_plt): New function.
1790         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1791         data members.
1792         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1793         (Sized_incremental_binary::set_file_is_unchanged): New function.
1794         (Sized_incremental_binary::file_is_unchanged): New function.
1795         (Sized_incremental_binary::do_process_got_plt): New function.
1796         (Sized_incremental_binary::file_status_): New data member.
1797         (Sized_incremental_binary::main_symtab_loc_): New data member.
1798         (Sized_incremental_binary::main_strtab_loc_): New data member.
1799         * output.cc (Output_data_got::Got_entry::write): Add case
1800         RESERVED_CODE.
1801         (Output_data_got::add_global): Call add_got_entry.
1802         (Output_data_got::add_global_plt): Likewise.
1803         (Output_data_got::add_global_with_rel): Likewise.
1804         (Output_data_got::add_global_with_rela): Likewise.
1805         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1806         (Output_data_got::add_global_pair_with_rela): Likewise.
1807         (Output_data_got::add_local): Call add_got_entry.
1808         (Output_data_got::add_local_plt): Likewise.
1809         (Output_data_got::add_local_with_rel): Likewise.
1810         (Output_data_got::add_local_with_rela): Likewise.
1811         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1812         (Output_data_got::add_local_pair_with_rela): Likewise.
1813         (Output_data_got::reserve_slot): New function.
1814         (Output_data_got::reserve_slot_for_global): New function.
1815         (Output_data_got::add_got_entry): New function.
1816         (Output_data_got::add_got_entry_pair): New function.
1817         (Output_section::add_output_section_data): Edit FIXME.
1818         * output.h
1819         (Output_section_data_build::Output_section_data_build): New
1820         constructor with size parameter.
1821         (Output_data_space::Output_data_space): Likewise.
1822         (Output_data_got::Output_data_got): Initialize new data member; new
1823         constructor with size parameter.
1824         (Output_data_got::add_constant): Call add_got_entry.
1825         (Output_data_got::reserve_slot): New function.
1826         (Output_data_got::reserve_slot_for_global): New function.
1827         (class Output_data_got::Got_entry): Add RESERVED_CODE.
1828         (Output_data_got::add_got_entry): New function.
1829         (Output_data_got::add_got_entry_pair): New function.
1830         (Output_data_got::free_list_): New data member.
1831         * target.h (Sized_target::init_got_plt_for_update): New function.
1832         (Sized_target::register_global_plt_entry): New function.
1833         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1834         Initialize new data member; call init; add constructor with PLT count.
1835         (Output_data_plt_x86_64::init): New function.
1836         (Output_data_plt_x86_64::add_relocation): New function.
1837         (Output_data_plt_x86_64::reserve_slot): New function.
1838         (Output_data_plt_x86_64::free_list_): New data member.
1839         (Target_x86_64::init_got_plt_for_update): New function.
1840         (Target_x86_64::register_global_plt_entry): New function.
1841         (Output_data_plt_x86_64::add_entry): Allocate from free list for
1842         incremental updates.
1843         (Output_data_plt_x86_64::add_relocation): New function.
1844         * testsuite/object_unittest.cc (Object_test): Set default options.
1845
1846 2011-05-16  Ian Lance Taylor  <iant@google.com>
1847
1848         * options.h (class General_options): Make -i a synonym for -r.
1849
1850 2011-05-16  Ian Lance Taylor  <iant@google.com>
1851
1852         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1853
1854 2011-05-10 Cary Coutant  <ccoutant@google.com>
1855
1856         * object.cc (Sized_relobj::do_count_local_symbols): Check for
1857         strip_all (-s).
1858
1859 2011-05-06  Ian Lance Taylor  <iant@google.com>
1860
1861         * layout.cc (Layout::layout): If the output section flags change,
1862         update the ordering.
1863
1864 2011-04-25 Cary Coutant  <ccoutant@google.com>
1865
1866         * incremental-dump.cc (dump_incremental_inputs): Print local
1867         symbol info for each input file.
1868         * incremental.cc
1869         (Output_section_incremental_inputs::set_final_data_size): Add local
1870         symbol info to input file entries in incremental info.
1871         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1872         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1873         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1874         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1875         implementation.
1876         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1877         (Sized_incr_relobj::do_relocate): Write the local symbols.
1878         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1879         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1880         Adjust size of input file header.
1881         (Incremental_inputs_reader::get_local_symbol_offset): New function.
1882         (Incremental_inputs_reader::get_local_symbol_count): New function.
1883         (Incremental_inputs_reader::get_input_section): Adjust size of input
1884         file header.
1885         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1886         (Sized_incr_relobj::This): New typedef.
1887         (Sized_incr_relobj::sym_size): New const data member.
1888         (Sized_incr_relobj::Local_symbol): New struct.
1889         (Sized_incr_relobj::do_output_local_symbol_count): New function.
1890         (Sized_incr_relobj::do_local_symbol_offset): New function.
1891         (Sized_incr_relobj::local_symbol_count_): New data member.
1892         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1893         (Sized_incr_relobj::local_symbol_index_): New data member.
1894         (Sized_incr_relobj::local_symbol_offset_): New data member.
1895         (Sized_incr_relobj::local_dynsym_offset_): New data member.
1896         (Sized_incr_relobj::local_symbols_): New data member.
1897         * object.h (Relobj::output_local_symbol_count): New function.
1898         (Relobj::local_symbol_offset): New function.
1899         (Relobj::do_output_local_symbol_count): New function.
1900         (Relobj::do_local_symbol_offset): New function.
1901         (Sized_relobj::do_output_local_symbol_count): New function.
1902         (Sized_relobj::do_local_symbol_offset): New function.
1903
1904 2011-04-22  Vladimir Simonov  <sv@sw.ru>
1905
1906         * descriptors.cc (set_close_on_exec): New function.
1907         (Descriptors::open): Use set_close_on_exec.
1908         * output.cc (S_ISLNK): Define if not defined.
1909
1910 2011-04-22 Cary Coutant  <ccoutant@google.com>
1911
1912         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1913         global symbol map.
1914         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1915         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1916         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1917         relocations.
1918         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1919         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1920         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1921         * incremental.h
1922         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1923         function.
1924         (Incremental_binary::apply_incremental_relocs): New function.
1925         (Incremental_binary::do_apply_incremental_relocs): New function.
1926         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1927         data member.
1928         (Sized_incremental_binary::add_global_symbol): New function.
1929         (Sized_incremental_binary::global_symbol): New function.
1930         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1931         (Sized_incremental_binary::symbol_map_): New data member.
1932         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1933         * target.h (Sized_target::apply_relocation): New function.
1934         * target-reloc.h (apply_relocation): New function.
1935         * x86_64.cc (Target_x86_64::apply_relocation): New function.
1936
1937 2011-04-22  Doug Kwan  <dougkwan@google.com>
1938
1939         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1940         flag of a SHT_ARM_EXIDX section.
1941         * testsuite/Makefile.am (arm_exidx_test): New test rules.
1942         * testsuite/Makefile.in: Regenerate.
1943         * testsuite/arm_exidx_test.s: New file.
1944         * testsuite/arm_exidx_test.sh: Same.
1945
1946 2011-04-20 Cary Coutant  <ccoutant@google.com>
1947
1948         PR gold/12689
1949         * archive.h (Incremental_archive_entry::Archive_member):
1950         Initialize arg_serial_ (second constructor).
1951
1952 2011-04-17  Ian Lance Taylor  <iant@google.com>
1953
1954         * object.cc (Relocate_info::location): Simplify location string.
1955         * errors.cc (Errors::error_at_location): Don't print program
1956         name.
1957         (Errors::warning_at_location): Likewise.
1958         (Errors::undefined_symbol): Likewise.
1959         * testsuite/debug_msg.sh: Update accordingly.
1960
1961 2011-04-14 Cary Coutant  <ccoutant@google.com>
1962
1963         * gold/layout.cc (Layout::symtab_section_offset): New function.
1964         * gold/layout.h (Layout::symtab_section_offset): New function.
1965         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1966
1967 2011-04-12  Ian Lance Taylor  <iant@google.com>
1968
1969         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
1970         with MREMAP_MAYMOVE.
1971         * output.h (class Output_file): Add map_is_allocated_ field.
1972         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
1973         not available, provide stubs.  If mremap is not available, #define
1974         it to gold_mremap.
1975         (MREMAP_MAYMOVE): Define if not defined.
1976         (Output_file::Output_file): Initialize map_is_allocated_.
1977         (Output_file::resize): Check map_is_allocated_.
1978         (Output_file::map_anonymous): If mmap fails, use malloc.
1979         (Output_file::unmap): Don't do anything for an anonymous map.
1980         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
1981         is not available, provide stubs.
1982         (File_read::View::~View): Use free rather than delete[].
1983         (File_read::make_view): Use malloc rather than new[].  If mmap
1984         fails, use malloc.
1985         (File_read::find_or_make_view): Use malloc rather than new[].
1986         * gold.h: Remove HAVE_REMAP code.
1987         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
1988         exists.  Rename mremap to gold_mremap.  If mmap is not available
1989         don't do anything.
1990         * configure, config.in: Rebuild.
1991
1992 2011-04-11  Ian Lance Taylor  <iant@google.com>
1993
1994         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1995         initialize local variable v.
1996
1997 2011-04-11  Cary Coutant  <ccoutant@google.com>
1998
1999         * archive.cc (Archive::include_member): Adjust call to
2000         report_object.
2001         (Add_archive_symbols::run): Track argument serial numbers.
2002         (Lib_group::include_member): Likewise.
2003         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2004         * archive.h (Incremental_archive_entry::Archive_member):
2005         Initialize arg_serial_.
2006         (Archive_member::arg_serial_): New data member.
2007         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2008         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2009         incremental link.
2010         (Sized_dynobj::do_for_all_local_got_entries): New function.
2011         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2012         function.
2013         * fileread.cc (get_mtime): New function.
2014         * fileread.h (get_mtime): New function.
2015         * gold.cc (queue_initial_tasks): Check for incremental update.
2016         (process_incremental_input): New function.
2017         (queue_middle_tasks): Don't force valid target for incremental
2018         update.
2019         * incremental-dump.cc (find_input_containing_global): Adjust
2020         size of symbol info entry.
2021         (dump_incremental_inputs): Dump argument serial number and
2022         in_system_directory flag; bias shndx by 1; print symbol names
2023         when dumping per-file symbol lists; use new symbol info readers.
2024         * incremental.cc
2025         (Output_section_incremental_inputs:update_data_size): New function.
2026         (Sized_incremental_binary::setup_readers): Setup input readers
2027         for each input file; build maps for files added from libraries
2028         and scripts.
2029         (Sized_incremental_binary::check_input_args): New function.
2030         (Sized_incremental_binary::do_check_inputs): Build map of argument
2031         serial numbers to input arguments.
2032         (Sized_incremental_binary::do_file_has_changed): Rename
2033         do_file_is_unchanged to this; compare file modification times.
2034         (Sized_incremental_binary::do_init_layout): New function.
2035         (Sized_incremental_binary::do_reserve_layout): New function.
2036         (Sized_incremental_binary::do_get_input_reader): Remove.
2037         (Sized_incremental_binary::get_symtab_view): New function.
2038         (Incremental_checker::can_incrementally_link_output_file): Remove.
2039         (Incremental_inputs::report_command_line): Exclude --debug options.
2040         (Incremental_inputs::report_archive_begin): Add parameter; track
2041         argument serial numbers; don't put input file entry for archive
2042         before archive members.
2043         (Incremental_inputs::report_archive_end): Put input file entry
2044         for archive after archive members.
2045         (Incremental_inputs::report_object): Add parameter; track argument
2046         serial numbers and in_system_directory flag.
2047         (Incremental_inputs::report_script): Add parameter; track argument
2048         serial numbers.
2049         (Output_section_incremental_inputs::set_final_data_size): Adjust
2050         size of symbol info entry; check for forwarding symbols.
2051         (Output_section_incremental_inputs::write_input_files): Write
2052         in_system_directory flag and argument serial number.
2053         (Output_section_incremental_inputs::write_info_blocks): Map section
2054         indices between incremental info and original input file; store
2055         input section index for each symbol.
2056         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2057         change operator() to visit().
2058         (class Global_got_offset_visitor): Likewise.
2059         (class Global_symbol_visitor_got_plt):
2060         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2061         classes.
2062         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2063         (Sized_incr_relobj::do_read_symbols): New function.
2064         (Sized_incr_relobj::do_layout): New function.
2065         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2066         (Sized_incr_relobj::do_add_symbols): New function.
2067         (Sized_incr_relobj::do_should_include_member): New function.
2068         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2069         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2070         (Sized_incr_relobj::do_section_size): New function.
2071         (Sized_incr_relobj::do_section_name): New function.
2072         (Sized_incr_relobj::do_section_contents): New function.
2073         (Sized_incr_relobj::do_section_flags): New function.
2074         (Sized_incr_relobj::do_section_entsize): New function.
2075         (Sized_incr_relobj::do_section_address): New function.
2076         (Sized_incr_relobj::do_section_type): New function.
2077         (Sized_incr_relobj::do_section_link): New function.
2078         (Sized_incr_relobj::do_section_info): New function.
2079         (Sized_incr_relobj::do_section_addralign): New function.
2080         (Sized_incr_relobj::do_initialize_xindex): New function.
2081         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2082         (Sized_incr_relobj::do_read_relocs): New function.
2083         (Sized_incr_relobj::do_gc_process_relocs): New function.
2084         (Sized_incr_relobj::do_scan_relocs): New function.
2085         (Sized_incr_relobj::do_count_local_symbols): New function.
2086         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2087         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2088         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2089         (Sized_incr_relobj::do_relocate): New function.
2090         (Sized_incr_relobj::do_set_section_offset): New function.
2091         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2092         (Sized_incr_dynobj::do_read_symbols): New function.
2093         (Sized_incr_dynobj::do_layout): New function.
2094         (Sized_incr_dynobj::do_add_symbols): New function.
2095         (Sized_incr_dynobj::do_should_include_member): New function.
2096         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2097         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2098         (Sized_incr_dynobj::do_section_size): New function.
2099         (Sized_incr_dynobj::do_section_name): New function.
2100         (Sized_incr_dynobj::do_section_contents): New function.
2101         (Sized_incr_dynobj::do_section_flags): New function.
2102         (Sized_incr_dynobj::do_section_entsize): New function.
2103         (Sized_incr_dynobj::do_section_address): New function.
2104         (Sized_incr_dynobj::do_section_type): New function.
2105         (Sized_incr_dynobj::do_section_link): New function.
2106         (Sized_incr_dynobj::do_section_info): New function.
2107         (Sized_incr_dynobj::do_section_addralign): New function.
2108         (Sized_incr_dynobj::do_initialize_xindex): New function.
2109         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2110         (make_sized_incremental_object): New function.
2111         (Incremental_library::copy_unused_symbols): New function.
2112         (Incremental_library::do_for_all_unused_symbols): New function.
2113         * incremental.h (enum Incremental_input_flags): New type.
2114         (class Incremental_checker): Remove.
2115         (Incremental_input_entry::Incremental_input_entry): Add argument
2116         serial number.
2117         (Incremental_input_entry::arg_serial): New function.
2118         (Incremental_input_entry::set_is_in_system_directory): New function.
2119         (Incremental_input_entry::is_in_system_directory): New function.
2120         (Incremental_input_entry::arg_serial_): New data member.
2121         (Incremental_input_entry::is_in_system_directory_): New data member.
2122         (class Script_info): Move here from script.h.
2123         (Script_info::Script_info): Add filename parameter.
2124         (Script_info::filename): New function.
2125         (Script_info::filename_): New data member.
2126         (Incremental_script_entry::Incremental_script_entry): Add argument
2127         serial number.
2128         (Incremental_object_entry::Incremental_object_entry): Likewise.
2129         (Incremental_object_entry::add_input_section): Build list of input
2130         sections with map to original shndx.
2131         (Incremental_object_entry::get_input_section_index): New function.
2132         (Incremental_object_entry::shndx_): New data member.
2133         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2134         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2135         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2136         serial number.
2137         (Incremental_inputs::report_archive_begin): Likewise.
2138         (Incremental_inputs::report_object): Likewise.
2139         (Incremental_inputs::report_script): Likewise.
2140         (class Incremental_global_symbol_reader): New class.
2141         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2142         and store flags and input file type.
2143         (Incremental_input_entry_reader::arg_serial): New function.
2144         (Incremental_input_entry_reader::type): Extract type from flags.
2145         (Incremental_input_entry_reader::is_in_system_directory): New function.
2146         (Incremental_input_entry_reader::get_input_section_count): Call
2147         accessor function for type.
2148         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2149         function for type; adjust size of global symbol entry.
2150         (Incremental_input_entry_reader::get_global_symbol_count): Call
2151         accessor function for type.
2152         (Incremental_input_entry_reader::get_object_count): Likewise.
2153         (Incremental_input_entry_reader::get_object_offset): Likewise.
2154         (Incremental_input_entry_reader::get_member_count): Likewise.
2155         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2156         (Incremental_input_entry_reader::get_member_offset): Likewise.
2157         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2158         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2159         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2160         (Incremental_input_entry_reader::get_global_symbol_reader): New
2161         function.
2162         (Incremental_input_entry_reader::get_output_symbol_index): New
2163         function.
2164         (Incremental_input_entry_reader::type_): Remove.
2165         (Incremental_input_entry_reader::flags_): New data member.
2166         (Incremental_inputs_reader::input_file_offset): New function.
2167         (Incremental_inputs_reader::input_file_index): New function.
2168         (Incremental_inputs_reader::input_file): Call input_file_offset.
2169         (Incremental_inputs_reader::input_file_at_offset): New function.
2170         (Incremental_relocs_reader::get_r_type): Reformat.
2171         (Incremental_relocs_reader::get_r_shndx): Reformat.
2172         (Incremental_relocs_reader::get_r_offset): Reformat.
2173         (Incremental_relocs_reader::data): New function.
2174         (Incremental_binary::Incremental_binary): Initialize new data members.
2175         (Incremental_binary::check_inputs): Add cmdline parameter.
2176         (Incremental_binary::file_is_unchanged): Remove.
2177         (Input_reader::arg_serial): New function.
2178         (Input_reader::get_unused_symbol_count): New function.
2179         (Input_reader::get_unused_symbol): New function.
2180         (Input_reader::do_arg_serial): New function.
2181         (Input_reader::do_get_unused_symbol_count): New function.
2182         (Input_reader::do_get_unused_symbol): New function.
2183         (Incremental_binary::input_file_count): New function.
2184         (Incremental_binary::get_input_reader): Change signature to use
2185         index instead of filename.
2186         (Incremental_binary::file_has_changed): New function.
2187         (Incremental_binary::get_input_argument): New function.
2188         (Incremental_binary::get_library): New function.
2189         (Incremental_binary::get_script_info): New function.
2190         (Incremental_binary::init_layout): New function.
2191         (Incremental_binary::reserve_layout): New function.
2192         (Incremental_binary::output_file): New function.
2193         (Incremental_binary::do_check_inputs): New function.
2194         (Incremental_binary::do_file_is_unchanged): Remove.
2195         (Incremental_binary::do_file_has_changed): New function.
2196         (Incremental_binary::do_init_layout): New function.
2197         (Incremental_binary::do_reserve_layout): New function.
2198         (Incremental_binary::do_input_file_count): New function.
2199         (Incremental_binary::do_get_input_reader): Change signature.
2200         (Incremental_binary::input_args_map_): New data member.
2201         (Incremental_binary::library_map_): New data member.
2202         (Incremental_binary::script_map_): New data member.
2203         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2204         new data members.
2205         (Sized_incremental_binary::output_section): New function.
2206         (Sized_incremental_binary::inputs_reader): Add const.
2207         (Sized_incremental_binary::symtab_reader): Add const.
2208         (Sized_incremental_binary::relocs_reader): Add const.
2209         (Sized_incremental_binary::got_plt_reader): Add const.
2210         (Sized_incremental_binary::get_symtab_view): New function.
2211         (Sized_incremental_binary::Inputs_reader): New typedef.
2212         (Sized_incremental_binary::Input_entry_reader): New typedef.
2213         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2214         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2215         (Sized_incremental_binary::do_file_has_changed): New function.
2216         (Sized_incremental_binary::do_init_layout): New function.
2217         (Sized_incremental_binary::do_reserve_layout): New function.
2218         (Sized_input_reader::Inputs_reader): Remove.
2219         (Sized_input_reader::Input_entry_reader): Remove.
2220         (Sized_input_reader::do_arg_serial): New function.
2221         (Sized_input_reader::do_get_unused_symbol_count): New function.
2222         (Sized_input_reader::do_get_unused_symbol): New function.
2223         (Sized_incremental_binary::do_input_file_count): New function.
2224         (Sized_incremental_binary::do_get_input_reader): Change signature;
2225         use index instead of filename.
2226         (Sized_incremental_binary::section_map_): New data member.
2227         (Sized_incremental_binary::input_entry_readers_): New data member.
2228         (class Sized_incr_relobj): New class.
2229         (class Sized_incr_dynobj): New class.
2230         (make_sized_incremental_object): New function.
2231         (class Incremental_library): New class.
2232         * layout.cc (Free_list::num_lists): New static data member.
2233         (Free_list::num_nodes): New static data member.
2234         (Free_list::num_removes): New static data member.
2235         (Free_list::num_remove_visits): New static data member.
2236         (Free_list::num_allocates): New static data member.
2237         (Free_list::num_allocate_visits): New static data member.
2238         (Free_list::init): New function.
2239         (Free_list::remove): New function.
2240         (Free_list::allocate): New function.
2241         (Free_list::dump): New function.
2242         (Free_list::print_stats): New function.
2243         (Layout_task_runner::run): Resize output file for incremental updates.
2244         (Layout::Layout): Initialize new data members.
2245         (Layout::set_incremental_base): New function.
2246         (Layout::init_fixed_output_section): New function.
2247         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2248         incremental updates.
2249         (Layout::create_gold_note): Do not create gold note section for
2250         incremental updates.
2251         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2252         for incremental updates.
2253         (Layout::set_section_offsets): For incremental updates, allocate space
2254         from free list.
2255         (Layout::create_symtab_sections): Layout with offsets relative to
2256         start of section; for incremental updates, allocate space from free
2257         list.
2258         (Layout::create_shdrs): For incremental updates, allocate space from
2259         free list.
2260         (Layout::finish_dynamic_section): For incremental updates, do not
2261         check --as-needed (fixed in subsequent patch).
2262         * layout.h (class Free_list): New class.
2263         (Layout::set_incremental_base): New function.
2264         (Layout::incremental_base): New function.
2265         (Layout::init_fixed_output_section): New function.
2266         (Layout::allocate): New function.
2267         (Layout::incremental_base_): New data member.
2268         (Layout::free_list_): New data member.
2269         * main.cc (main): Print Free_list statistics.
2270         * object.cc (Relobj::finalize_incremental_relocs): Add
2271         clear_counts parameter; clear counts only when clear_counts is set.
2272         (Sized_relobj::Sized_relobj): Initialize new base class.
2273         (Sized_relobj::do_layout): Don't report special sections.
2274         (Sized_relobj::do_for_all_local_got_entries): New function.
2275         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2276         symtab_off to all symbol table offsets.
2277         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2278         * object.h (class Got_offset_list): Move to top of file.
2279         (Object::Object): Allow case where input_file == NULL.
2280         (Object::~Object): Likewise.
2281         (Object::input_file): Assert that input_file != NULL.
2282         (Object::lock): Allow case where input_file == NULL.
2283         (Object::unlock): Likewise.
2284         (Object::is_locked): Likewise.
2285         (Object::token): Likewise.
2286         (Object::release): Likewise.
2287         (Object::is_incremental): New function.
2288         (Object::get_mtime): New function.
2289         (Object::for_all_local_got_entries): New function.
2290         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2291         (Object::set_is_in_system_directory): New function.
2292         (Object::is_in_system_directory): New function.
2293         (Object::do_is_incremental): New function.
2294         (Object::do_get_mtime): New function.
2295         (Object::do_for_all_local_got_entries): New function.
2296         (Object::is_in_system_directory_): New data member.
2297         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2298         (class Sized_relobj_base): New class.
2299         (class Sized_relobj): Derive from Sized_relobj_base.
2300         (class Sized_relobj::Symbols): Redeclare from base class.
2301         (class Sized_relobj::local_got_offset_list): Remove.
2302         (class Sized_relobj::Output_sections): Redeclare from base class.
2303         (class Sized_relobj::do_for_all_local_got_entries): New function.
2304         (class Sized_relobj::write_local_symbols): Add offset parameter.
2305         (class Sized_relobj::local_symbol_offset_): Update comment.
2306         (class Sized_relobj::local_dynsym_offset_): Update comment.
2307         * options.cc (Input_arguments::add_file): Remove const.
2308         * options.h (Input_file_argument::Input_file_argument):
2309         Initialize arg_serial_ (all constructors).
2310         (Input_file_argument::set_arg_serial): New function.
2311         (Input_file_argument::arg_serial): New function.
2312         (Input_file_argument::arg_serial_): New data member.
2313         (Input_arguments::Input_arguments): Initialize file_count_.
2314         (Input_arguments::add_file): Remove const.
2315         (Input_arguments::number_of_input_files): New function.
2316         (Input_arguments::file_count_): New data member.
2317         (Command_line::number_of_input_files): Call
2318         Input_arguments::number_of_input_files.
2319         * output.cc (Output_segment_headers::Output_segment_headers):
2320         Set current size.
2321         (Output_section::Input_section::current_data_size): New function.
2322         (Output_section::Output_section): Initialize new data members.
2323         (Output_section::add_input_section): Don't do merge sections for
2324         an incremental link; allocate space from free list for an
2325         incremental update.
2326         (Output_section::add_output_section_data): Allocate space from
2327         free list for an incremental update.
2328         (Output_section::update_data_size): New function.
2329         (Output_section::set_fixed_layout): New function.
2330         (Output_section::reserve): New function.
2331         (Output_segment::set_section_addresses): Remove const.
2332         (Output_segment::set_section_list_addresses): Remove const; allocate
2333         space from free list for an incremental update.
2334         (Output_segment::set_offset): Adjust size of RELRO segment for an
2335         incremental update.
2336         * output.h (Output_data::current_data_size): Move here from
2337         child classes.
2338         (Output_data::pre_finalize_data_size): New function.
2339         (Output_data::update_data_size): New function.
2340         (Output_section_headers::update_data_size): new function.
2341         (Output_section_data_build::current_data_size): Move to Output_data.
2342         (Output_data_strtab::update_data_size): New function.
2343         (Output_section::current_data_size): Move to Output_data.
2344         (Output_section::set_fixed_layout): New function.
2345         (Output_section::has_fixed_layout): New function.
2346         (Output_section::reserve): New function.
2347         (Output_section::update_data_size): New function.
2348         (Output_section::has_fixed_layout_): New data member.
2349         (Output_section::free_list_): New data member.
2350         (Output_segment::set_section_addresses): Remove const.
2351         (Output_segment::set_section_list_addresses): Remove const.
2352         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2353         New function.
2354         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2355         New function.
2356         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2357         parameter when calling Add_symbols constructor; store argument
2358         serial number for members of a lib group.
2359         (Add_symbols::locks): Allow case where token == NULL.
2360         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2361         (Read_member::~Read_member): New function.
2362         (Read_member::is_runnable): New function.
2363         (Read_member::locks): New function.
2364         (Read_member::run): New function.
2365         (Check_script::~Check_script): New function.
2366         (Check_script::is_runnable): New function.
2367         (Check_script::locks): New function.
2368         (Check_script::run): New function.
2369         (Check_library::~Check_library): New function.
2370         (Check_library::is_runnable): New function.
2371         (Check_library::locks): New function.
2372         (Check_library::run): New function.
2373         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2374         (Add_symbols::library_): New data member.
2375         (class Read_member): New class.
2376         (class Check_script): New class.
2377         (class Check_library): New class.
2378         * reloc.cc (Read_relocs::is_runnable): Allow case where
2379         token == NULL.
2380         (Read_relocs::locks): Likewise.
2381         (Scan_relocs::locks): Likewise.
2382         (Relocate_task::locks): Likewise.
2383         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2384         to clear counters.
2385         (Sized_relobj::incremental_relocs_scan): Fix comment.
2386         (Sized_relobj::do_relocate): Pass output file offset to
2387         write_local_symbols.
2388         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2389         from class declaration.
2390         * script.cc (read_input_script): Allocate Script_info; pass
2391         argument serial number to report_script.
2392         * script.h (class Script_info): Move to incremental.h.
2393         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2394         * symtab.h (Symbol_table::add_from_incrobj): New function.
2395         (Symbol_table::set_file_offset): New function.
2396
2397 2011-04-05  Cary Coutant  <ccoutant@google.com>
2398
2399         * incremental-dump.cc (dump_incremental_inputs): Change signature
2400         to take a Sized_incremental_binary; change caller.  Use readers
2401         in Sized_incremental_binary.
2402         * incremental.cc
2403         (Sized_incremental_binary::find_incremental_inputs_sections):
2404         Rename do_find_incremental_inputs_sections to this.
2405         (Sized_incremental_binary::setup_readers): New function.
2406         (Sized_incremental_binary::do_check_inputs): Check
2407         has_incremental_info_ flag; move setup code to setup_readers;
2408         use input readers.
2409         (Sized_incremental_binary::do_file_is_unchanged): New function.
2410         (Sized_incremental_binary::do_get_input_reader): New function.
2411         * incremental.h (class Incremental_binary): Move to end of file.
2412         (Incremental_binary::file_is_unchanged): New function.
2413         (Incremental_binary::do_file_is_unchanged): New function.
2414         (Incremental_binary::Input_reader): New class.
2415         (Incremental_binary::get_input_reader): New function.
2416         (class Sized_incremental_binary): Move to end of file.
2417         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2418         input section reader classes.
2419         (Sized_incremental_binary::has_incremental_info): New function.
2420         (Sized_incremental_binary::inputs_reader): New function.
2421         (Sized_incremental_binary::symtab_reader): New function.
2422         (Sized_incremental_binary::relocs_reader): New function.
2423         (Sized_incremental_binary::got_plt_reader): New function.
2424         (Sized_incremental_binary::do_file_is_unchanged): New function.
2425         (Sized_incremental_binary::Sized_input_reader): New class.
2426         (Sized_incremental_binary::get_input_reader): New function.
2427         (Sized_incremental_binary::find_incremental_inputs_sections):
2428         Rename do_find_incremental_inputs_sections to this.
2429         (Sized_incremental_binary::setup_readers): New function.
2430         (Sized_incremental_binary::has_incremental_info_): New data member.
2431         (Sized_incremental_binary::inputs_reader_): New data member.
2432         (Sized_incremental_binary::symtab_reader_): New data member.
2433         (Sized_incremental_binary::relocs_reader_): New data member.
2434         (Sized_incremental_binary::got_plt_reader_): New data member.
2435         (Sized_incremental_binary::current_input_file_): New data member.
2436
2437 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2438
2439         PR gold/12640
2440         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2441         violation.
2442
2443 2011-03-30  Cary Coutant  <ccoutant@google.com>
2444
2445         * archive.cc (Archive::include_member): Adjust call to report_object.
2446         (Add_archive_symbols::run): Add script_info to call to
2447         report_archive_begin.
2448         (Lib_group::include_member): Adjust call to report_object.
2449         (Add_lib_group_symbols::run): Adjust call to report_object.
2450         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2451         blocks.  Add object count for script input files.
2452         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2453         script_info parameter; change all callers.
2454         (Incremental_inputs::report_object): Add script_info parameter;
2455         change all callers.
2456         (Incremental_inputs::report_script): Store backpointer to
2457         incremental info entry.
2458         (Output_section_incremental_inputs::set_final_data_size): Record
2459         additional information for scripts.
2460         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2461         * incremental.h (Incremental_script_entry::add_object): New function.
2462         (Incremental_script_entry::get_object_count): New function.
2463         (Incremental_script_entry::get_object): New function.
2464         (Incremental_script_entry::objects_): New data member; adjust
2465         constructor.
2466         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2467         (Incremental_inputs::report_object): Add script_info parameter.
2468         (Incremental_inputs_reader::get_object_count): New function.
2469         (Incremental_inputs_reader::get_object_offset): New function.
2470         * options.cc (Input_arguments::add_file): Return reference to
2471         new input argument.
2472         * options.h (Input_argument::set_script_info): New function.
2473         (Input_argument::script_info): New function.
2474         (Input_argument::script_info_): New data member; adjust all
2475         constructors.
2476         (Input_file_group::add_file): Return reference to new input argument.
2477         (Input_file_lib::add_file): Likewise.
2478         (Input_arguments::add_file): Likewise.
2479         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2480         * script.cc (Parser_closure::Parser_closure): Add script_info
2481         parameter; adjust all callers.
2482         (Parser_closure::script_info): New function.
2483         (Parser_closure::script_info_): New data member.
2484         (read_input_script): Report scripts earlier to incremental info.
2485         (script_add_file): Set script_info in Input_argument.
2486         (script_add_library): Likewise.
2487         * script.h (Script_options::Script_info): Rewrite class.
2488
2489 2011-03-29  Cary Coutant  <ccoutant@google.com>
2490
2491         * archive.cc (Library_base::should_include_member): Move
2492         method here from class Archive.
2493         (Archive::Archive): Initialize base class.
2494         (Archive::should_include_member): Move to base class.
2495         (Archive::do_for_all_unused_symbols): New function.
2496         (Add_archive_symbols::run): Remove redundant access to
2497         incremental_inputs.
2498         (Lib_group::Lib_group): Initialize base class.
2499         (Lib_group::do_filename): New function.
2500         (Lib_group::include_member): Pass pointer to Lib_group to
2501         report_object.
2502         (Lib_group::do_for_all_unused_symbols): New function.
2503         (Add_lib_group_symbols::run): Report archive information for
2504         incremental links.
2505         * archive.h (class Library_base): New base class.
2506         (class Archive): Derive from Library_base.
2507         (Archive::filename): Move to base class.
2508         (Archive::set_incremental_info): Likewise.
2509         (Archive::incremental_info): Likewise.
2510         (Archive::Should_include): Likewise.
2511         (Archive::should_include_member): Likewise.
2512         (Archive::Armap_entry): Remove.
2513         (Archive::Unused_symbol_iterator): Remove.
2514         (Archive::unused_symbols_begin): Remove.
2515         (Archive::unused_symbols_end): Remove.
2516         (Archive::do_filename): New function.
2517         (Archive::do_get_mtime): New function.
2518         (Archive::do_for_all_unused_symbols): New function.
2519         (Archive::task_): Move to base class.
2520         (Archive::incremental_info_): Likewise.
2521         (class Lib_group): Derive from Library_base.
2522         (Lib_group::do_filename): New function.
2523         (Lib_group::do_get_mtime): New function.
2524         (Lib_group::do_for_all_unused_symbols): New function.
2525         (Lib_group::task_): Move to base class.
2526         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2527         function.
2528         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2529         function.
2530         * incremental.cc (Incremental_inputs::report_archive_begin):
2531         Use Library_base; call library's get_mtime; add incremental inputs
2532         entry before members.
2533         (class Unused_symbol_visitor): New class.
2534         (Incremental_inputs::report_archive_end): Use Library_base; use
2535         visitor class to record unused symbols; don't add incremental inputs
2536         entry after members.
2537         (Incremental_inputs::report_object): Use Library_base.
2538         * incremental.h
2539         (Incremental_archive_entry::Incremental_archive_entry): Remove
2540         unused Archive parameter.
2541         (Incremental_inputs::report_archive_begin): Use Library_base.
2542         (Incremental_inputs::report_archive_end): Likewise.
2543         (Incremental_inputs::report_object): Likewise.
2544         * object.cc (Sized_relobj::do_for_all_global_symbols): New
2545         function.
2546         * object.h (Object::for_all_global_symbols): New function.
2547         (Object::do_for_all_global_symbols): New function.
2548         (Sized_relobj::do_for_all_global_symbols): New function.
2549         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
2550         function.
2551         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
2552         function.
2553
2554 2011-03-27  Ian Lance Taylor  <iant@google.com>
2555
2556         * archive.cc (Archive::interpret_header): Return -1 if something
2557         goes wrong.  Change callers accordingly.
2558
2559 2011-03-25  Cary Coutant  <ccoutant@google.com>
2560
2561         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2562         * testsuite/Makefile.in: Regenerate.
2563
2564 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
2565
2566         * plugin.cc (get_view): New.
2567         (Plugin::load): Pass get_view to the plugin.
2568         (Plugin_manager::get_view): New.
2569
2570 2011-03-21  Ian Lance Taylor  <iant@google.com>
2571
2572         * testsuite/final_layout.sh: Rewrite to not use dc.
2573         * testsuite/relro_test.sh: Fail if dc is not present.
2574
2575 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
2576
2577         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2578         Change == to -eq.
2579         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2580         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2581         Change == to -eq.
2582         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2583         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2584
2585 2011-03-14  Ian Lance Taylor  <iant@google.com>
2586
2587         * script-sections.cc (Sort_output_sections::script_compare):
2588         Rename from is_before, change return type.
2589         (Sort_output_sections::operator()): Adjust accordingly.
2590
2591 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
2592
2593         PR gold/12572
2594         * testsuite/odr_violation2.cc: Add comment to make all error line
2595         numbers double digits.
2596         * testsuite/debug_msg.sh: Adjust expected errors.
2597
2598 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
2599
2600         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2601         but mark earlier ones as non-canonical
2602         (offset_to_iterator): Update search target and example
2603         (do_addr2line): Return extra lines in a vector*
2604         (format_file_lineno): Extract from do_addr2line
2605         (one_addr2line): Add vector* out-param
2606         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2607         when a lineno entry appeared last for its instruction
2608         (Dwarf_line_info): Add vector* out-param
2609         * object.cc (Relocate_info): Pass NULL for the vector* out-param
2610         * symtab.cc (Odr_violation_compare): Include the lineno in the
2611         comparison again.
2612         (linenos_from_loc): New. Combine the canonical line for an
2613         address with its other lines.
2614         (True_if_intersect): New. Helper functor to make
2615         std::set_intersection a query.
2616         (detect_odr_violations): Compare sets of lines instead of just
2617         one line for each function. This became less deterministic, but
2618         has fewer false positives.
2619         * symtab.h: Declarations.
2620         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2621         mix an optimized and non-optimized object in the same binary
2622         (odr_violation2.so): Same.
2623         * testsuite/Makefile.in: Regenerate from Makefile.am.
2624         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2625         * testsuite/debug_msg.sh: Update line numbers and add
2626         assertions.
2627         * testsuite/odr_violation1.cc: Use OdrDerived, in a
2628         non-optimized context.
2629         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2630         isn't inlined, and use OdrDerived in an optimized context.
2631         * testsuite/odr_header1.h: Defines OdrDerived, where
2632         optimization will change the
2633         first-instruction-in-the-destructor's file and line number.
2634         * testsuite/odr_header2.h: Defines OdrBase.
2635
2636 2011-03-09  Ian Lance Taylor  <iant@google.com>
2637
2638         * fileread.cc (File_read::clear_views): Don't delete the whole
2639         file view.
2640
2641 2011-03-08  Ian Lance Taylor  <iant@google.com>
2642
2643         PR gold/12525
2644         * fileread.cc: #include <climits>.
2645         (GOLD_IOV_MAX): Define.
2646         (File_read::read_multiple): Limit number of entries by iov_max.
2647         * fileread.h (class File_read): Always set max_readv_entries to
2648         128.
2649
2650 2011-03-07  Ian Lance Taylor  <iant@google.com>
2651
2652         PR gold/12525
2653         * options.h (class General_options): Add -dy and -dn.
2654
2655 2011-03-02  Cary Coutant  <ccoutant@google.com>
2656
2657         * testsuite/script_test_9.t: Add TLS segment.
2658
2659 2011-03-02  Simon Baldwin  <simonb@google.com>
2660
2661         * configure.ac: Add check for gnu_indirect_function support in
2662         the toolchain building binutils.
2663         * configure: Rebuild.
2664
2665 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
2666
2667         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2668         plugin only symbols.
2669         (Symbol_table::sized_finalize_symbol) Mark symbol only present
2670         in plugin files as not needed in the symbol table.
2671
2672 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
2673
2674         * output.cc (Output_section::add_input_section): Delay fill
2675         generation for section ordering.
2676
2677 2011-02-09  Ian Lance Taylor  <iant@google.com>
2678
2679         PR gold/12316
2680         * object.h (class Sized_relobj): Remove clear_local_symbols.
2681         * reloc.cc (Sized_relobj::do_relocate): Don't call
2682         clear_local_symbols.
2683
2684 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
2685
2686         * plugin.cc (is_visible_from_outside): Return true for symbols
2687         in the -u option.
2688
2689 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
2690
2691         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2692         filename.
2693
2694 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
2695
2696         * icf.h (is_section_foldable_candidate): Change type of parameter
2697         to std::string.
2698         * icf.cc (Icf::find_identical_sections): Change type of local variable
2699         section_name to be std::string.
2700         (is_function_ctor_or_dtor): Change type of parameter to std::string.
2701
2702 2011-01-25  Ian Lance Taylor  <iant@google.com>
2703
2704         * script.cc (script_add_extern): Rewrite to use
2705         add_symbol_reference.
2706
2707 2011-01-25  Doug Kwan  <dougkwan@google.com>
2708
2709         * icf.cc (get_section_contents): Always lock section's object.
2710
2711 2011-01-24  Ian Lance Taylor  <iant@google.com>
2712
2713         * options.h (class General_options): Accept
2714         --no-detect-odr-violations.
2715
2716 2011-01-24  Ian Lance Taylor  <iant@google.com>
2717
2718         * version.cc (version_string): Bump to 1.11.
2719
2720 2011-01-24  Ian Lance Taylor  <iant@google.com>
2721
2722         * plugin.cc (class Plugin_rescan): Define new class.
2723         (Plugin_manager::claim_file): Set any_claimed_.
2724         (Plugin_manager::save_archive): New function.
2725         (Plugin_manager::save_input_group): New function.
2726         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2727         necessary.
2728         (Plugin_manager::new_undefined_symbol): New function.
2729         (Plugin_manager::rescan): New function.
2730         (Plugin_manager::rescannable_defines): New function.
2731         (Plugin_manager::add_input_file): Set any_added_.
2732         * plugin.h (class Plugin_manager): define new fields rescannable_,
2733         undefined_symbols_, any_claimed_, and any_added_.  Declare
2734         Plugin_rescan as friend.  Declare new functions.
2735         (Plugin_manager::Rescannable): Define type.
2736         (Plugin_manager::Rescannable_list): Define type.
2737         (Plugin_manager::Undefined_symbol_list): Define type.
2738         (Plugin_manager::Plugin_manager): Initialize new fields.
2739         * archive.cc (Archive::defines_symbol): New function.
2740         (Add_archive_symbols::run): Pass archive to plugins if any.
2741         * archive.h (class Archive): Declare defines_symbol.
2742         * readsyms.cc (Input_group::~Input_group): New function.
2743         (Finish_group::run): Pass input_group to plugins if any.
2744         * readsyms.h (class Input_group): Declare destructor.
2745         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2746         any.
2747
2748 2011-01-10  Ian Lance Taylor  <iant@google.com>
2749
2750         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2751         section as relro.
2752         (Layout::set_segment_offsets): Reset increase_relro before calling
2753         set_section_addresses a second time.
2754
2755 2011-01-04  Cary Coutant  <ccoutant@google.com>
2756
2757         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2758         sections before NOBITS sections.
2759
2760 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
2761
2762         * version.cc (print_version): Update copyright to 2011.
2763
2764 2010-12-23  Cary Coutant  <ccoutant@google.com>
2765
2766         * output.h (Output_data_reloc::add_output_section): Pass OD instead
2767         of OS to this->add.  Add OD parameter to second form of the function.
2768
2769 2010-12-20  Ian Lance Taylor  <iant@google.com>
2770
2771         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2772         second of two consecutive entries with same offset.
2773
2774 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2775
2776         * testsuite/Makefile.am (ifuncmain2static_LDADD)
2777         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2778         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2779         to avoid unneeded links against $(LDADD).
2780         * testsuite/Makefile.in: Regenerate.
2781
2782 2010-12-15  Ian Lance Taylor  <iant@google.com>
2783
2784         PR gold/12324
2785         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2786         for R_X86_64_32 and R_X86_64_PC32.
2787         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2788         ver_matching_def_pic.o.
2789         (ver_matching_def_pic.o): New target.
2790
2791 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2792
2793         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2794         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2795         Move definition before File_read::View member definitions.
2796         (File_read::View::~View): Initialize and hold lock before
2797         updating current_mapped_bytes.
2798
2799 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2800
2801         * dwarf_reader.cc: Remove outdated comment.
2802         * gold-threads.cc: Fix typo in error message.
2803         * archive.cc: Fix typos in comments.
2804         * archive.h: Likewise.
2805         * arm-reloc-property.cc: Likewise.
2806         * arm-reloc-property.h: Likewise.
2807         * arm-reloc.def: Likewise.
2808         * arm.cc: Likewise.
2809         * attributes.h: Likewise.
2810         * cref.cc: Likewise.
2811         * ehframe.cc: Likewise.
2812         * fileread.h: Likewise.
2813         * gold.h: Likewise.
2814         * i386.cc: Likewise.
2815         * icf.cc: Likewise.
2816         * incremental.h: Likewise.
2817         * int_encoding.cc: Likewise.
2818         * layout.h: Likewise.
2819         * main.cc: Likewise.
2820         * merge.h: Likewise.
2821         * object.cc: Likewise.
2822         * object.h: Likewise.
2823         * options.cc: Likewise.
2824         * readsyms.cc: Likewise.
2825         * reduced_debug_output.cc: Likewise.
2826         * reloc.cc: Likewise.
2827         * script-sections.cc: Likewise.
2828         * sparc.cc: Likewise.
2829         * symtab.h: Likewise.
2830         * target-reloc.h: Likewise.
2831         * target.cc: Likewise.
2832         * target.h: Likewise.
2833         * timer.cc: Likewise.
2834         * timer.h: Likewise.
2835         * x86_64.cc: Likewise.
2836
2837 2010-12-09  Cary Coutant  <ccoutant@google.com>
2838
2839         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2840         stack.
2841         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2842         parameter; change all callers.
2843         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2844         * options.h (warn_execstack): New option.
2845
2846 2010-12-07  Doug Kwan  <dougkwan@google.com>
2847
2848         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2849         like function call relocations.
2850
2851 2010-12-07  Ian Lance Taylor  <iant@google.com>
2852
2853         * archive.cc (Archive::get_elf_object_for_member): Permit
2854         punconfigured to be NULL.
2855         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2856         (Archive::include_member): Pass NULL to get_elf_object_for_member
2857         if we searched for the archive and this is the first included
2858         object.
2859
2860 2010-12-01  Ian Lance Taylor  <iant@google.com>
2861
2862         * dwarf_reader.h (class Sized_dwarf_line_info): Add
2863         track_relocs_type_ field.
2864         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2865         Set track_relocs_type_.
2866         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2867         contents when using RELA relocs.
2868         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2869         reloc_map_.
2870         * reloc.cc (Track_relocs::next_addend): New function.
2871         * reloc.h (class Track_relocs): Declare next_addend.
2872
2873 2010-12-01  Ian Lance Taylor  <iant@google.com>
2874
2875         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2876         virtual destructor.
2877
2878 2010-12-01  Ian Lance Taylor  <iant@google.com>
2879
2880         * README: Update compilers known to work and fail.
2881
2882 2010-11-23  Matthias Klose  <doko@ubuntu.com>
2883
2884         * configure.in: For --enable-gold, handle value `default' instead of
2885         `both*'.  Always install ld as ld.bfd, install as ld if gold is
2886         not the default.
2887         * configure: Regenerate.
2888
2889 2010-11-18  Doug Kwan  <dougkwan@google.com>
2890
2891         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2892         and right_alignment to be zero.  Store result alignment only if it is
2893         greater than existing alignment.
2894
2895 2010-11-16  Cary Coutant  <ccoutant@google.com>
2896
2897         PR gold/12220
2898         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2899         Check for ".zdebug_line".
2900
2901 2010-11-16  Doug Kwan  <dougkwan@google.com>
2902             Cary Coutant  <ccoutant@google.com>
2903
2904         * output.h (Output_segment::set_section_addresses): Pass increase_relro
2905         by reference; adjust all callers.
2906         * output.cc (Output_segment::set_section_addresses): Adjust references
2907         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2908         list is empty.
2909         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2910         end at page boundary.
2911
2912 2010-11-16  Cary Coutant  <ccoutant@google.com>
2913
2914         PR gold/12220
2915         * layout.cc (Layout::choose_output_section): Transform names of
2916         compressed sections even when using a script with a SECTIONS clause.
2917         (Layout::output_section_name): Remove code to transform
2918         compressed debug section names.
2919         * output.cc (Output_section::add_input_section): Use uncompressed
2920         section size when tracking input sections.
2921
2922 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
2923
2924         * symtab.h (Symbol::NON_PIC_REF): Remove.
2925         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2926         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
2927         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2928         (Symbol::use_plt_offset): Take a flags argument and pass it
2929         directly to needs_dynamic_reloc.  Restrict check for undefined
2930         weak symbols to function calls.
2931         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2932         (Target_arm::Scan::global): Use it.
2933         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2934         (Target_arm::Relocate::relocate): Likewise.
2935         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2936         parameter with an r_type parameter.  Use get_reference_flags
2937         to get the flags.
2938         (Target_arm::Relocate::relocate): Update accordingly.
2939         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2940         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2941         (Target_i386::Scan::global): Likewise.
2942         (Target_i386::Relocate::relocate): Likewise.
2943         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2944         parameter with an r_type parameter.  Use get_reference_flags
2945         to get the flags.
2946         (Target_i386::Relocate::relocate): Update accordingly.
2947         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2948         (Target_powerpc::Scan::global): Use it.
2949         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2950         (Target_powerpc::Relocate::relocate): Likewise.
2951         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2952         (Target_sparc::Scan::global): Use it.
2953         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2954         (Target_sparc::Relocate::relocate): Likewise.
2955         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2956         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2957         (Target_x86_64::Scan::global): Likewise.
2958         (Target_x86_64::Relocate::relocate): Likewise.
2959
2960 2010-11-08  Doug Kwan  <dougkwan@google.com>
2961             Cary Coutant  <ccoutant@google.com>
2962
2963         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2964         (Arm_exidx_merge_section::section_contents_): New data member.
2965         (Arm_input_section::Arm_input_section): Initialize original_contents_.
2966         (Arm_input_section::~Arm_input_section): De-allocate memory.
2967         (Arm_input_section::original_contents_): New data member.       
2968         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2969         in parameters instead of calling Object::section_contents without
2970         locking.
2971         (Arm_output_section::group_section): New parameter TASK.  Pass it
2972         to callees that need locking objects.
2973         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
2974         to lock EXIDX input sections.  Fix a formatting issue.  Call
2975         Arm_exidx_merged_section::build_contents to create merged section
2976         contents.
2977         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
2978         to lock object of stub table owner.
2979         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2980         TEXT_SIZE to initialize data member TEXT_SIZE_.
2981         (Arm_exidx_input_section::addralign): Fix typo in comment.
2982         (Arm_exidx_input_section::text_size): New method.
2983         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
2984         that require locking objects.  Lock objects before scanning for stubs
2985         and updating local symbols.
2986         (Arm_input_section<big_endian>::init): Copy contents of original
2987         input section.
2988         (Arm_input_section<big_endian>::do_write): Use saved contents of
2989         original input section instead of calling Object::section_contents
2990         without locking.
2991         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2992         size without calling Object::section_size().
2993         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2994         for size.  Allocate a buffer for merged EXIDX entries.
2995         (Arm_exidx_merged_section::build_contents): New method.
2996         (Arm_exidx_merged_section::do_write): Move merge section contents
2997         building code to Arm_exidx_merged_section::build_contetns.  Write
2998         out contetns in buffer instead of building it on the fly.
2999         (Arm_relobj::make_exidx_input_section): Also pass text section size
3000         to Arm_exidx_input_section constructor.
3001         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3002         (Arm_dynobj::do_read_symbols): Fix memory leak.
3003         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3004         * target.h: (class Task): Add forward declaration.
3005         (Target::relax): Add new parameter TASK and pass it to
3006         Target::do_relax().
3007         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3008
3009 2010-11-05  Cary Coutant  <ccoutant@google.com>
3010
3011         PR gold/10708
3012         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3013         object when reading from the file.
3014         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3015         second layout pass.
3016         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3017         when reading section contents.
3018         (get_section_contents): Likewise.
3019         (icf::find_identical_sections): Likewise.
3020         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3021         object when reading from the file.
3022         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3023         the object when doing deferred section layout.
3024
3025 2010-11-03  Nick Clifton  <nickc@redhat.com>
3026
3027         PR gold/12001
3028         * script.h (class Symbol_assignment: name): New member.  Returns
3029         the name of the symbol.
3030         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3031         Returns true if the given symbol name is on the list of
3032         assignments wating to be processed.
3033         * archive.cc (should_incldue_member): If the symbol is undefined,
3034         check to see if it is on the list of symbols pending assignment.
3035
3036 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3037
3038         * script-sections.cc (Script_sections::find_memory_region): Check
3039         for a NULL output section pointer.
3040
3041 2010-10-29  Doug Kwan  <dougkwan@google.com>
3042
3043         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3044         Output_section::add_relaxed_input_section.
3045         * output.cc (Output_section::add_relaxed_input_section): Add new
3046         arguments LAYOUT and NAME.  Set section order index.
3047         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3048         Copy section order index.
3049         * output.h (Output_section::add_relaxed_input_section): Add new
3050         arguments LAYOUT and NAME.
3051
3052 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3053
3054         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3055         NATIVE_OR_CROSS_LINKER.
3056         * testsuite/Makefile.in: Regenerate.
3057
3058 2010-10-20  Doug Kwan  <dougkwan@google.com>
3059
3060         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3061         without SHF_LINK_ORDER flags.
3062         * layout.cc (Layout::choose_output_section): Do not filter
3063         SHF_LINK_ORDER flag in a relocatable link.
3064
3065 2010-10-17  Cary Coutant  <ccoutant@google.com>
3066
3067         * output.h (Output_segment::set_section_addresses): Change function
3068         signature.  Update all callers.
3069         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3070         sections.
3071         (Output_segment::set_section_addresses): Align after last TLS
3072         section.  Add padding before last relro section instead of after.
3073
3074 2010-10-17  Doug Kwan  <dougkwan@google.com>
3075
3076         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3077         GOT output section to be writable.
3078
3079 2010-10-14  Cary Coutant  <ccoutant@google.com>
3080
3081         * debug.h (DEBUG_INCREMENTAL): New flag.
3082         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3083         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3084         mode.
3085         * incremental.cc (report_command_line): Ignore all forms of
3086         --incremental.
3087         * layout.cc (Layout::Layout): Check parameters for incremental link
3088         mode.
3089         * options.cc (General_options::parse_incremental): New function.
3090         (General_options::parse_no_incremental): New function.
3091         (General_options::parse_incremental_full): New function.
3092         (General_options::parse_incremental_update): New function.
3093         (General_options::incremental_mode_): New data member.
3094         (General_options::finalize): Check incremental_mode_.
3095         * options.h (General_options): Update help text for --incremental.
3096         Add --no-incremental, --incremental-full, --incremental-update.
3097         (General_options::Incremental_mode): New enum type.
3098         (General_options::incremental_mode): New function.
3099         (General_options::incremental_mode_): New data member.
3100         * parameters.cc (Parameters::incremental_mode_): New data member.
3101         (Parameters::set_options): Set incremental_mode_.
3102         (Parameters::set_incremental_full): New function.
3103         (Parameters::incremental): New function.
3104         (Parameters::incremental_update): New function.
3105         (set_parameters_incremental_full): New function.
3106         * parameters.h (Parameters::set_incremental_full): New function.
3107         (Parameters::incremental): New function.
3108         (Parameters::incremental_update): New function.
3109         (Parameters::incremental_mode_): New data member.
3110         (set_parameters_incremental_full): New function.
3111         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3112         incremental link mode.
3113         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3114         (Sized_relobj::do_relocate_sections): Likewise.
3115         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3116         option.
3117         * testsuite/Makefile.in: Regenerate.
3118         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3119
3120 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3121
3122         * script-sections.h (class Script_sections): Make
3123         Sections_elements typedef public.
3124         * script-sections.cc (class Sort_output_sections): Add elements_
3125         field.  Add constructor which sets it; change all callers.
3126         (Sort_output_sections::is_before): New function.
3127         (Sort_output_sections::operator()): Call is_before.
3128         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3129         conditional.
3130         * testsuite/script_test_10.sh: New test. Test script section
3131         order.
3132         * testsuite/script_test_10.t: Likewise.
3133         * testsuite/script_test_10.s: Likewise.
3134         * testsuite/Makefile.am: Wrap the cross linker tests and the
3135         common tests into NATIVE_OR_CROSS_LINKER.
3136         (check_SCRIPTS): Add script_test_10.sh.
3137         (check_DATA): Add script_test_10.stdout.
3138         (script_test_10.o, script_test_10): New targets.
3139         (script_test_10.stdout): New target.
3140         * configure, testsuite/Makefile.in: Regenerate.
3141
3142 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3143
3144         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3145         error for the deprecated relocations.
3146         (Target_arm::Scan::global): Likewise.
3147         (Target_arm::Relocate::relocate): Likewise.
3148
3149 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3150
3151         * fileread.cc (Input_file::find_file): Initialize *found_name
3152         and *namep when using the fallback search for case 4.
3153
3154 2010-10-11  Cary Coutant  <ccoutant@google.com>
3155
3156         * options.h (class General_options): Redefine -z lazy as an alias for
3157         the negation of -z now.
3158
3159 2010-10-11  Ian Lance Taylor  <iant@google.com>
3160
3161         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3162         binding.
3163
3164 2010-10-06  Nick Clifton  <nickc@redhat.com>
3165
3166         * script-sections.cc(class Memory_region): Remove
3167         current_lma_offset_ field.  Rename current_vma_offset_ to
3168         current_offset_.  Add last_section_ field.
3169         (Memory_region::get_current_vma_address): Rename to
3170         get_current_address.
3171         (Memory_region::get_current_lma_address): Delete.
3172         (Memory_region::increment_vma_offset): Rename to
3173         increment_offset.
3174         (Memory_region::increment_lma_offset): Delete.
3175         (Memory_region::attributes_compatible): New method.  Returns
3176         true if the provided section is compatible with the region.
3177         (Memory_region::get_last_section): New method.  Returns the last
3178         section to use the region.
3179         (Memory_region::set_last_section): New method.  Stores the last
3180         section to use the region.
3181         (Script_sections::block_in_region): New method.  Returns true if
3182         a block of memory is contained within a region.
3183         (Script_sections::find_memory_region): New method.  Locates a
3184         memory region to be used to set a VMA or LMA address.
3185         (Output_section_definition::set_section_addresses): Add code to
3186         check for addresses set by memory regions.
3187         (Output_segment::set_section_addresses): Remove memory region
3188         walking code.
3189         (Script_sections::create_segment): Add a warning if a header
3190         segment is created outside of any region.
3191         * script-sections.h (class Script_sections): Add prototypes for
3192         find_memory_region and block_in_region methods.
3193         * testsuite/memory_test.s: Use .long instead of .word.
3194         * testsuite/memory_test.t: Add some more output sections.
3195         * testsuite/memory_test.sh: Update expected output.
3196
3197 2010-10-02  Doug Kwan  <dougkwan@google.com>
3198
3199         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3200         defintion to symtab.h
3201         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3202         declaration to defintion.
3203
3204 2010-10-01  Nick Clifton  <nickc@redhat.com>
3205
3206         * expression.cc (eval): Replace dummy argument with NULL.
3207         (eval_maybe_dot): Check for a NULL result section pointer.
3208         (Symbol_expression::value): Likewise.
3209         (Dot_expression::value): Likewise.
3210         (BINARY_EXPRESSION): Likewise.
3211         (Max_expression::value): Likewise.
3212         (Min_expression::value): Likewise.
3213         (Absolute_expression::value): Likewise.
3214         (Addr_expression::value_from_output_section): Likewise.
3215         (Loaddddr_expression::value_from_output_section): Likewise.
3216         (Segment_start_expression::value): Likewise.
3217         * script-sections.cc
3218         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3219         argument with NULL.
3220         (Sections_elememt_dot_assignment::set_section_addresses):
3221         Likewise.
3222         (Output_data_expression::do_write_to_buffer): Likewise.
3223         (Output_section_definition::finalize_symbols): Likewise.
3224         (Output_section_definition::set_section_addresses): Likewise.
3225
3226 2010-09-30  Doug Kwan  <dougkwan@google.com>
3227
3228         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3229
3230 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3231
3232         * target.h (Target::can_icf_inline_merge_sections): New virtual
3233         function.
3234         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3235         virtual function.
3236         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3237         virtual function.
3238         * icf.cc (get_section_contents): Inline merge sections only when
3239         target allows it.
3240
3241 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3242
3243         * configure: Regenerate.
3244
3245 2010-09-17  Ian Lance Taylor  <iant@google.com>
3246
3247         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3248         * testsuite/Makefile.am (memory_test.o): New target.
3249         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3250         memory_test.t.
3251         * testsuite/Makefile.in: Rebuild.
3252
3253 2010-09-17  Doug Kwan  <dougkwan@google.com>
3254
3255         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3256         defintion if relocation uses GOT entries of the symbol.
3257         * testsuite/icf_safe_test.sh: Fix test.
3258         * testsuite/icf_safe_so_test.sh: Fix test.
3259
3260 2010-09-16  Cary Coutant  <ccoutant@google.com>
3261
3262         * script_sections.cc (class Memory_region): Remove "NULL" from
3263         vector initializations.
3264
3265 2010-09-15  Cary Coutant  <ccoutant@google.com>
3266
3267         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3268         Resolve forwarding symbols.
3269
3270 2010-09-15  Doug Kwan  <dougkwan@google.com>
3271
3272         * gold/testsuite/script_test_3.t: Add ARM special sections.
3273         * gold/testsuite/script_test_4.t: Same.
3274         * gold/testsuite/script_test_5.t: Same.
3275         * gold/testsuite/script_test_6.t: Same.
3276         * gold/testsuite/script_test_7.t: Same.
3277         * gold/testsuite/script_test_7.t: Same.
3278         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3279
3280 2010-09-14  Cary Coutant  <ccoutant@google.com>
3281
3282         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3283         (Target_x86_64::Relocate::relocate_tls): Replace check for
3284         saw_tls_block_reloc_ with test for executable section.
3285
3286 2010-09-12  Cary Coutant  <ccoutant@google.com>
3287
3288         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3289         position-independent executables to shared libraries need dynamic
3290         relocations.
3291         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3292         position-independent executables.
3293         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3294         * testsuite/Makefile.in: Regenerate.
3295
3296 2010-09-10  Nick Clifton  <nickc@redhat.com>
3297
3298         PR gold/11997
3299         * testsuite/memory_test.t: Discard any sections that are not
3300         needed.
3301
3302 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3303
3304         PR gold/11996
3305         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3306         "This::" to work around a bug in gcc 4.2.
3307
3308         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3309
3310 2010-09-09  Rafael Espindola  <espindola@google.com>
3311
3312         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3313         sections with different PF_X flags in the same segment.
3314         (Layout::find_first_load_seg): Search all segments to find the first
3315         one.
3316         * options.h (rosegment): New.
3317
3318 2010-09-08  Rafael Espindola  <espindola@google.com>
3319
3320         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3321
3322 2010-09-08  Doug Kwan  <dougkwan@google.com>
3323
3324         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3325         (Arm_relobj::do_relocate_sections): Add new parameter for output
3326         file to match the parent.
3327         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3328         of local symbols instead of input values.  Update code to track
3329         changes in gold::relocate_section.
3330         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3331         (Sized_relobj::compute_final_local_value_internal): New methods.
3332         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3333         body into private version of Sized_relobj::compute_final_local_value.
3334         Call the inline method.
3335         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3336         merged symbol value if there is one.
3337         (Symbol_value::has_output_value): New method defintiion.
3338         (Sized_relobj::Compute_final_local_value_status): New enum type.
3339         (Sized_relobj::compute_final_local_value): New methods.
3340         (Sized_relobj::compute_final_local_value_internal): New methods.
3341         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3342         and arm_cortex_a8.sh.
3343         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3344         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3345         New tests.
3346         * Makefile.in: Regenerate.
3347         * testsuite/arm_bl_out_of_range.s: Update test.
3348         * testsuite/thumb_bl_out_of_range.s: Ditto.
3349         * testsuite/thumb_blx_out_of_range.s: Ditto.
3350         * testsuite/arm_branch_out_of_range.sh: New file.
3351         * testsuite/arm_cortex_a8.sh: Ditto.
3352         * testsuite/arm_cortex_a8_b.s: Ditto.
3353         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3354         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3355         * testsuite/arm_cortex_a8_bl.s: Ditto.
3356         * testsuite/arm_cortex_a8_blx.s: Ditto.
3357         * testsuite/arm_cortex_a8_local.s: Ditto.
3358         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3359         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3360
3361 2010-09-08  Rafael Espindola  <espindola@google.com>
3362
3363         * Makefile.am (memory_test.stdout): Run readelf with -W.
3364         * Makefile.in: Regenerate.
3365         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3366         64 bit output.
3367
3368 2010-09-08  Rafael Espindola  <espindola@google.com>
3369
3370         * script-sections.cc (Script_sections::add_memory_region): Convert
3371         field precision to int.
3372         * script.cc (script_set_section_region, script_set_section_region):
3373         Convert field precision to int.
3374
3375 2010-09-08  Rafael Espindola  <espindola@google.com>
3376
3377         * arm.cc (do_finalize_sections): Create the __exidx_start and
3378         __exdix_end symbols even when the section is missing.
3379
3380 2010-09-08  Nick Clifton  <nickc@redhat.com>
3381
3382         * README: Remove claim that MEMORY is not supported.
3383         * expression.cc (script_exp_function_origin)
3384         (script_exp_function_length): Move from here to ...
3385         * script.cc: ... here.
3386         (script_set_section_region, script_add_memory)
3387         (script_parse_memory_attr, script_include_directive): New
3388         functions.
3389         * script-sections.cc
3390         (class Memory_region): New class.
3391         (class Output_section_definition): Add set_memory_region,
3392         set_section_vma, set_section_lma and get_section_name methods.
3393         (class Script_Sections): Add add_memory_region,
3394         find_memory_region, find_memory_region_origin,
3395         find_memory_region_length and set_memory_region methods.
3396         Have set_section_addresses method walk the list of set memory
3397         regions.
3398         Extend the print methos to display memory regions.
3399         * script-sections.h: Add prototypes for new methods.
3400         Add enum for MEMORY region attributes.
3401         * yyscript.y: Add support for parsing MEMORY regions.
3402         * script-c.h: Add prototypes for new functions.
3403         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3404         * testsuite/Makefile.in: Regenerate.
3405         * testsuite/memory_test.sh: New script.
3406         * testsuite/memory_test.s: New assembler source file.
3407         * testsuite/memory_test.t: New linker script.
3408
3409 2010-08-27  Doug Kwan  <dougkwan@google.com>
3410
3411         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3412         reference override an existing dynamic weak reference.
3413         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3414         * testsuite/Makefile.in: Regenerate.
3415         * testsuite/dyn_weak_ref.sh: New file.
3416         * testsuite/dyn_weak_ref_1.c: Ditto.
3417         * testsuite/dyn_weak_ref_2.c: Ditto.
3418
3419 2010-08-27  Ian Lance Taylor  <iant@google.com>
3420
3421         * incremental.h (class Incremental_input_entry): Add virtual
3422         destructor.
3423
3424 2010-08-27  Ian Lance Taylor  <iant@google.com>
3425
3426         * testsuite/start_lib_test_3.c: Mark t3 as used.
3427
3428 2010-08-27  Nick Clifton  <nickc@redhat.com>
3429
3430         * options.cc (version_script): Fix small typo in previous
3431         whitespace tidyup.
3432
3433 2010-08-25  Nick Clifton  <nickc@redhat.com>
3434
3435         * archive.cc: Formatting fixes: Remove whitespace between
3436         typename and following asterisk.  Remove whitespace between
3437         function name and opening parenthesis.
3438         * archive.h: Likewise.
3439         * arm.cc: Likewise.
3440         * attributes.cc: Likewise.
3441         * attributes.h: Likewise.
3442         * common.cc: Likewise.
3443         * copy-relocs.cc: Likewise.
3444         * dirsearch.h: Likewise.
3445         * dynobj.cc: Likewise.
3446         * ehframe.cc: Likewise.
3447         * ehframe.h: Likewise.
3448         * expression.cc: Likewise.
3449         * fileread.cc: Likewise.
3450         * fileread.h: Likewise.
3451         * gc.h: Likewise.
3452         * gold-threads.cc: Likewise.
3453         * gold.cc: Likewise.
3454         * i386.cc: Likewise.
3455         * icf.h: Likewise.
3456         * incremental-dump.cc: Likewise.
3457         * incremental.cc: Likewise.
3458         * layout.cc: Likewise.
3459         * layout.h: Likewise.
3460         * main.cc: Likewise.
3461         * merge.cc: Likewise.
3462         * merge.h: Likewise.
3463         * object.cc: Likewise.
3464         * object.h: Likewise.
3465         * options.cc: Likewise.
3466         * options.h: Likewise.
3467         * output.cc: Likewise.
3468         * output.h: Likewise.
3469         * plugin.cc: Likewise.
3470         * plugin.h: Likewise.
3471         * powerpc.cc: Likewise.
3472         * reloc.cc: Likewise.
3473         * script-c.h: Likewise.
3474         * script-sections.cc: Likewise.
3475         * script.cc: Likewise.
3476         * stringpool.cc: Likewise.
3477         * symtab.cc: Likewise.
3478         * symtab.h: Likewise.
3479         * target.cc: Likewise.
3480         * timer.cc: Likewise.
3481         * timer.h: Likewise.
3482         * version.cc: Likewise.
3483         * x86_64.cc: Likewise.
3484
3485 2010-08-24  Nick Clifton  <nickc@redhat.com>
3486
3487         PR 11899
3488         * layout.cc (segment_precedes): Sort segments by their physical
3489         addresses, if they have been set.
3490
3491 2010-08-23  Cary Coutant  <ccoutant@google.com>
3492
3493         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3494         symbols data.
3495         (Lib_group::include_member): Unlock object after deleting its
3496         symbols data.
3497         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3498         the bug fixed here.
3499
3500 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3501             Cary Coutant  <ccoutant@google.com>
3502
3503         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3504         constructor, and set_blocker.
3505         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3506         readsyms_blocker_.
3507         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3508         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3509         * testsuite/Makefile.am (start_lib_test): New test case.
3510         * testsuite/Makefile.in: Regenerate.
3511         * testsuite/start_lib_test_main.c: New file.
3512         * testsuite/start_lib_test_1.c: New file.
3513         * testsuite/start_lib_test_2.c: New file.
3514         * testsuite/start_lib_test_3.c: New file.
3515
3516 2010-08-19  Ian Lance Taylor  <iant@google.com>
3517
3518         * Makefile.in: Rebuild with automake 1.11.1.
3519         * aclocal.m4: Likewise.
3520         * testsuite/Makefile.in: Likewise.
3521
3522 2010-08-19  Ian Lance Taylor  <iant@google.com>
3523
3524         PR 10893
3525         * i386.cc (class Output_data_plt_i386): Update declarations.
3526         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3527         local_ifuncs_ fields.
3528         (Target_i386::do_plt_section_for_global): New function.
3529         (Target_i386::do_plt_section_for_local): New function.
3530         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3531         parameter; change all callers.  Initialize global_ifuncs_ and
3532         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3533         __rel_iplt_end.
3534         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3535         (Output_data_plt_i386::add_local_ifunc_entry): New function.
3536         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3537         symbols.
3538         (Target_i386::make_plt_section): New function, broken out of
3539         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
3540         (Target_i386::make_plt_entry): Call make_plt_section.
3541         (Target_i386::make_local_ifunc_plt_entry): New function.
3542         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3543         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
3544         R_386_IRELATIVE to switch.
3545         (Target_i386::Scan::global): Likewise.
3546         (Target_i386::Relocate::relocate): Likewise.
3547         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3548         switch.
3549         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3550         (Target_x86_64::do_plt_section_for_global): New function.
3551         (Target_x86_64::do_plt_section_for_local): New function.
3552         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3553         parameter; change all callers.  If doing a static link define
3554         __rela_iplt_start and __rela_iplt_end.
3555         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3556         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3557         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3558         to point to .plt.
3559         (Target_x86_64::make_local_ifunc_plt_entry): New function.
3560         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3561         switch.
3562         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3563         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
3564         R_X86_64_IRELATIVE to switch.
3565         (Target_x86_64::Scan::global): Likewise.
3566         (Target_x86_64::Relocate::relocate): Likewise.
3567         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3568         switch.
3569         * target.h (class Target): Add plt_section_for_global and
3570         plt_section_for_local functions.  Add do_plt_section_for_global
3571         and do_plt_section_for_local virtual functions.
3572         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
3573         clarifying comments.
3574         (Symbol::use_plt_offset): Handle IFUNC symbol.
3575         * object.cc (Sized_relobj::Sized_relobj): Initialize
3576         local_plt_offsets_.
3577         (Sized_relobj::local_has_plt_offset): New function.
3578         (Sized_relobj::local_plt_offset): New function.
3579         (Sized_relobj::set_local_plt_offset): New function.
3580         (Sized_relobj::do_count): Handle IFUNC symbol.
3581         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
3582         a bit away from input_shndx_ field.  Add set_is_func_symbol and
3583         is_ifunc_symbol functions.
3584         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
3585         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
3586         local_plt_offsets_ field.
3587         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3588         * output.h (class Output_section_data): Add non-const
3589         output_section function.
3590         (class Output_data_got): Update declarations.
3591         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3592         Add use_plt_offset parameter to global and local constructors.
3593         Change all callers.  Change local_sym_index_ field to 31 bits.
3594         Change GSYM_CODE and CONSTANT_CODE accordingly.
3595         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3596         doing a static link don't set sh_link field.
3597         (Output_data_got::Got_entry::write): Use PLT offset if
3598         appropriate.
3599         (Output_data_got::add_global_plt): New function.
3600         (Output_data_got::add_local_plt): New function.
3601         * target-reloc.h (relocate_section): Handle IFUNC symbol.
3602         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3603         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3604         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3605         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3606         IFUNC conditional.
3607         * testsuite/ifunc-sel.h: New file.
3608         * testsuite/ifuncmain1.c: New file.
3609         * testsuite/ifuncmain1vis.c: New file.
3610         * testsuite/ifuncmod1.c: New file.
3611         * testsuite/ifuncdep2.c: New file.
3612         * testsuite/ifuncmain2.c: New file.
3613         * testsuite/ifuncmain3.c: New file.
3614         * testsuite/ifuncmod3.c: New file.
3615         * testsuite/ifuncmain4.c: New file.
3616         * testsuite/ifuncmain5.c: New file.
3617         * testsuite/ifuncmod5.c: New file.
3618         * testsuite/ifuncmain6pie.c: New file.
3619         * testsuite/ifuncmod6.c: New file.
3620         * testsuite/ifuncmain7.c: New file.
3621         * configure, testsuite/Makefile.in: Rebuild.
3622
3623 2010-08-18  Ian Lance Taylor  <iant@google.com>
3624
3625         * incremental.cc
3626         (Output_section_incremental_inputs::write_input_files): Add cast
3627         to avoid signed/unsigned comparison warning.
3628         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3629
3630 2010-08-12  Cary Coutant  <ccoutant@google.com>
3631
3632         * common.cc (Sort_commons::operator()): Remove unnecessary code.
3633
3634 2010-08-13  Ian Lance Taylor  <iant@google.com>
3635
3636         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3637
3638 2010-08-12  Cary Coutant  <ccoutant@google.com>
3639             Doug Kwan  <dougkwan@google.com>
3640
3641         * resolve.cc (Symbol_table::should_override): When a weak dynamic
3642         defintion overrides non-weak undef, remember that the original undef
3643         is not weak.
3644         * symtab.cc (Symbol_table::sized_write_global): For undef without
3645         an original weak binding, set binding to global in output.
3646         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3647         * testsuite/Makefile.in: Regenerate.
3648         * testsuite/strong_ref_weak_def.sh: New file.
3649         * testsuite/strong_ref_weak_def_1.c: Ditto.
3650         * testsuite/strong_ref_weak_def_2.c: Ditto.
3651
3652 2010-08-12  Cary Coutant  <ccoutant@google.com>
3653
3654         * testsuite/incremental_test.sh: Rewrite.
3655         * testsuite/incremental_test_1.c: Rewrite.
3656         * testsuite/incremental_test_2.c: Rewrite.
3657
3658 2010-08-12  Cary Coutant  <ccoutant@google.com>
3659
3660         * arm.cc (Target_arm::got_size): Add const.
3661         (Target_arm::got_entry_count): New function.
3662         (Target_arm::plt_entry_count): New function.
3663         (Target_arm::first_plt_entry_offset): New function.
3664         (Target_arm::plt_entry_size): New function.
3665         (Output_data_plt_arm::entry_count): New function.
3666         (Output_data_plt_arm::first_plt_entry_offset): New function.
3667         (Output_data_plt_arm::get_plt_entry_size): New function.
3668         * i386.cc (Target_i386::got_size): Add const.
3669         (Target_i386::got_entry_count): New function.
3670         (Target_i386::plt_entry_count): New function.
3671         (Target_i386::first_plt_entry_offset): New function.
3672         (Target_i386::plt_entry_size): New function.
3673         (Output_data_plt_i386::entry_count): New function.
3674         (Output_data_plt_i386::first_plt_entry_offset): New function.
3675         (Output_data_plt_i386::get_plt_entry_size): New function.
3676         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3677         find_incremental_inputs_sections.  Dump incremental_got_plt section.
3678         * incremental.cc: Include target.h.
3679         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3680         parameter.  Adjust all callers.  Find incremental_got_plt section.
3681         (Incremental_inputs::create_data_sections): Create incremental_got_plt
3682         section.
3683         (Output_section_incremental_inputs::set_final_data_size): Calculate
3684         size of incremental_got_plt section.
3685         (Output_section_incremental_inputs::do_write): Write the
3686         incremental_got_plt section.
3687         (Got_plt_view_info): New struct.
3688         (Local_got_offset_visitor): New class.
3689         (Global_got_offset_visitor): New class.
3690         (Global_symbol_visitor_got_plt): New class.
3691         (Output_section_incremental_inputs::write_got_plt): New function.
3692         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3693         Add parameter.  Adjust all callers.
3694         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3695         (Incremental_inputs::got_plt_section): New function.
3696         (Incremental_inputs::got_plt_section_): New data member.
3697         (Incremental_got_plt_reader): New class.
3698         * layout.cc (Layout::create_incremental_info_sections): Add the
3699         incremental_got_plt section.
3700         * object.h (Got_offset_list::get_list): New function.
3701         (Got offset_list::for_all_got_offsets): New function.
3702         (Sized_relobj::local_got_offset_list): New function.
3703         * powerpc.cc (Target_powerpc::got_size): Add const.
3704         (Target_powerpc::got_entry_count): New function.
3705         (Target_powerpc::plt_entry_count): New function.
3706         (Target_powerpc::first_plt_entry_offset): New function.
3707         (Target_powerpc::plt_entry_size): New function.
3708         (Output_data_plt_powerpc::entry_count): New function.
3709         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3710         (Output_data_plt_powerpc::get_plt_entry_size): New function.
3711         * sparc.cc (Target_sparc::got_size): Add const.
3712         (Target_sparc::got_entry_count): New function.
3713         (Target_sparc::plt_entry_count): New function.
3714         (Target_sparc::first_plt_entry_offset): New function.
3715         (Target_sparc::plt_entry_size): New function.
3716         (Output_data_plt_sparc::entry_count): New function.
3717         (Output_data_plt_sparc::first_plt_entry_offset): New function.
3718         (Output_data_plt_sparc::get_plt_entry_size): New function.
3719         * symtab.h (Symbol::got_offset_list): New function.
3720         (Symbol_table::for_all_symbols): New function.
3721         * target.h (Sized_target::got_entry_count): New function.
3722         (Sized_target::plt_entry_count): New function.
3723         (Sized_target::plt_entry_size): New function.
3724         * x86_64.cc (Target_x86_64::got_size): Add const.
3725         (Target_x86_64::got_entry_count): New function.
3726         (Target_x86_64::plt_entry_count): New function.
3727         (Target_x86_64::first_plt_entry_offset): New function.
3728         (Target_x86_64::plt_entry_size): New function.
3729         (Output_data_plt_x86_64::entry_count): New function.
3730         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3731         (Output_data_plt_x86_64::get_plt_entry_size): New function.
3732
3733 2010-08-12  Cary Coutant  <ccoutant@google.com>
3734
3735         * archive.cc: Include incremental.h.
3736         (Archive::Archive): Initialize incremental_info_.
3737         (Archive::include_member): Record archive members in incremental info.
3738         (Add_archive_symbols::run): Record begin and end of an archive in
3739         incremental info.
3740         (Lib_group::include_member): Record objects in incremental info.
3741         * archive.h (Incremental_archive_entry): Forward declaration.
3742         (Archive::set_incremental_info): New member function.
3743         (Archive::incremental_info): New member function.
3744         (Archive::Unused_symbol_iterator): New class.
3745         (Archive::unused_symbols_begin): New member function.
3746         (Archive::unused_symbols_end): New member function.
3747         (Archive::incremental_info_): New data member.
3748         * incremental-dump.cc (find_input_containing_global): New function.
3749         (dump_incremental_inputs): Dump new incremental info sections.
3750         * incremental.cc: Include symtab.h.
3751         (Output_section_incremental_inputs): New class.
3752         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3753         new incremental info sections.
3754         (Sized_incremental_binary::do_check_inputs): Likewise.
3755         (Incremental_inputs::report_archive): Remove.
3756         (Incremental_inputs::report_archive_begin): New function.
3757         (Incremental_inputs::report_archive_end): New function.
3758         (Incremental_inputs::report_object): New function.
3759         (Incremental_inputs::finalize_inputs): Remove.
3760         (Incremental_inputs::report_input_section): New function.
3761         (Incremental_inputs::report_script): Rewrite.
3762         (Incremental_inputs::finalize): Do nothing but finalize string table.
3763         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3764         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3765         (Incremental_inputs::create_data_sections): New function.
3766         (Incremental_inputs::relocs_entsize): New function.
3767         (Output_section_incremental_inputs::set_final_data_size): New function.
3768         (Output_section_incremental_inputs::do_write): New function.
3769         (Output_section_incremental_inputs::write_header): New function.
3770         (Output_section_incremental_inputs::write_input_files): New function.
3771         (Output_section_incremental_inputs::write_info_blocks): New function.
3772         (Output_section_incremental_inputs::write_symtab): New function.
3773         * incremental.h (Incremental_script_entry): Forward declaration.
3774         (Incremental_object_entry): Forward declaration.
3775         (Incremental_archive_entry): Forward declaration.
3776         (Incremental_inputs): Forward declaration.
3777         (Incremental_inputs_header_data): Remove.
3778         (Incremental_inputs_header): Remove.
3779         (Incremental_inputs_header_write): Remove.
3780         (Incremental_inputs_entry_data): Remove.
3781         (Incremental_inputs_entry): Remove.
3782         (Incremental_inputs_entry_write): Remove.
3783         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3784         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3785         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3786         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3787         Likewise.
3788         (Incremental_input_entry): New class.
3789         (Incremental_script_entry): New class.
3790         (Incremental_object_entry): New class.
3791         (Incremental_archive_entry): New class.
3792         (Incremental_inputs::Incremental_inputs): Initialize new data members.
3793         (Incremental_inputs::report_inputs): Remove.
3794         (Incremental_inputs::report_archive): Remove.
3795         (Incremental_inputs::report_archive_begin): New function.
3796         (Incremental_inputs::report_archive_end): New function.
3797         (Incremental_inputs::report_object): Change prototype.
3798         (Incremental_inputs::report_input_section): New function.
3799         (Incremental_inputs::report_script): Change prototype.
3800         (Incremental_inputs::get_reloc_count): New function.
3801         (Incremental_inputs::set_reloc_count): New function.
3802         (Incremental_inputs::create_data_sections): New function.
3803         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3804         (Incremental_inputs::inputs_section): New function.
3805         (Incremental_inputs::symtab_section): New function.
3806         (Incremental_inputs::relocs_section): New function.
3807         (Incremental_inputs::get_stringpool): Add const.
3808         (Incremental_inputs::command_line): Add const.
3809         (Incremental_inputs::inputs): Remove.
3810         (Incremental_inputs::command_line_key): New function.
3811         (Incremental_inputs::input_file_count): New function.
3812         (Incremental_inputs::input_files): New function.
3813         (Incremental_inputs::relocs_entsize): New function.
3814         (Incremental_inputs::sized_create_inputs_section_data): Remove.
3815         (Incremental_inputs::finalize_inputs): Remove.
3816         (Incremental_inputs::Input_info): Remove.
3817         (Incremental_inputs::lock_): Remove.
3818         (Incremental_inputs::inputs_): Change type.
3819         (Incremental_inputs::inputs_map_): Remove.
3820         (Incremental_inputs::current_object_entry_): New data member.
3821         (Incremental_inputs::inputs_section_): New data member.
3822         (Incremental_inputs::symtab_section_): New data member.
3823         (Incremental_inputs::relocs_section_): New data member.
3824         (Incremental_inputs::reloc_count_): New data member.
3825         (Incremental_inputs_reader): New class.
3826         (Incremental_symtab_reader): New class.
3827         (Incremental_relocs_reader): New class.
3828         * layout.cc (Layout::finalize): Move finalization of incremental info
3829         and creation of incremental info sections to follow finalization of
3830         symbol table.  Set offsets for postprocessing sections.
3831         (Layout::create_incremental_info_sections): Call
3832         Incremental_inputs::create_data_sections.  Add incremental symtab
3833         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
3834         sections to layout after input sections.
3835         * layout.h (struct Timespec): Forward declaration.
3836         (Layout::incremental_inputs): Add const.
3837         (Layout::create_incremental_info_sections): Add parameter.
3838         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3839         * object.cc: Include incremental.h.
3840         (Relobj::finalize_incremental_relocs): New function.
3841         (Sized_relobj::do_layout): Record input sections in incremental info.
3842         * object.h (Object::output_section): New function.
3843         (Object::output_section_offset): Moved from Relobj.
3844         (Object::get_incremental_reloc_base): New function.
3845         (Object::get_incremental_reloc_count): New function.
3846         (Object::do_output_section): New function.
3847         (Object::do_output_section_offset): Moved from Relobj.
3848         (Object::do_get_incremental_reloc_base): New function.
3849         (Object::do_get_incremental_reloc_count): New function.
3850         (Object::Object): Initialize new data members.
3851         (Relobj::output_section): Renamed do_output_section and moved to
3852         protected.
3853         (Relobj::output_section_offset): Moved to Object.
3854         (Relobj::do_get_incremental_reloc_base): New function.
3855         (Relobj::do_get_incremental_reloc_count): New function.
3856         (Relobj::allocate_incremental_reloc_counts): New function.
3857         (Relobj::count_incremental_reloc): New function.
3858         (Relobj::finalize_incremental_relocs): New function.
3859         (Relobj::next_incremental_reloc_index): New function.
3860         (Relobj::reloc_counts_): New data member.
3861         (Relobj::reloc_bases_): New data member.
3862         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
3863         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
3864         (Sized_relobj::incremental_relocs_scan): New function.
3865         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3866         (Sized_relobj::incremental_relocs_write): New function.
3867         (Sized_relobj::incremental_relocs_write_reltype): New function.
3868         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3869         incremental link.
3870         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3871         archives and object files elsewhere.
3872         (Add_symbols::run): Report object files here.
3873         (Finish_group::run): Report end of archive at end of group.
3874         * reloc.cc: Include layout.h, incremental.h.
3875         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3876         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3877         (Sized_relobj::incremental_relocs_scan): New function.
3878         (Sized_relobj::incremental_relocs_scan_reltype): New function.
3879         (Sized_relobj::do_relocate_sections): Write incremental relocations.
3880         (Sized_relobj::incremental_relocs_write): New function.
3881         (Sized_relobj::incremental_relocs_write_reltype): New function.
3882         * script.cc (read_input_script): Rewrite test for incremental link.
3883         Change call to Incremental_inputs::report_script.
3884         * symtab.h (Symbol_table::first_global_index): New function.
3885         (Symbol_table::output_count): New function.
3886
3887 2010-08-12  Doug Kwan  <dougkwan@google.com>
3888
3889         * arm.cc (Target_arm::merge_object_attributes): Check command line
3890         options --no-wchar-size-warning and --no-enum-size-warning.
3891         * options.h (General_options): Add ld-compatible options
3892         --no-enum-size-warning and --no-wchar-size-warning.
3893
3894 2010-08-04  Ian Lance Taylor  <iant@google.com>
3895
3896         * x86_64.cc (Target_x86_64::Scan::local): Use
3897         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3898         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3899         (Target_x86_64::Scan::global): Likewise.
3900         (Target_x86_64::Relocate::relocate): Likewise.
3901         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3902         Likewise.
3903
3904 2010-08-03  Cary Coutant  <ccoutant@google.com>
3905
3906         * merge.cc (Output_merge_string::do_add_input_section): Count strings
3907         to reserve space in merged_strings vector. Keep total input size
3908         for stats.
3909         (Output_merge_string::do_print_merge_stats): Print total input size.
3910         * merge.h (Output_merge_string): Add input_size_ field.
3911         * stringpool.cc (Stringpool_template::string_length): Move
3912         implementations out of Stringpool_template class and place in
3913         stringpool.h.
3914         * stringpool.h (string_length): Move out of Stringpool_template.
3915
3916 2010-08-03  Ian Lance Taylor  <iant@google.com>
3917
3918         PR 11712
3919         * layout.cc (relaxation_loop_body): If address of load segment is
3920         set, adjust address to include headers if possible.
3921
3922 2010-08-03  Ian Lance Taylor  <iant@google.com>
3923
3924         * version.cc (version_string): Bump to 1.10.
3925
3926 2010-08-03  Ian Lance Taylor  <iant@google.com>
3927
3928         PR 11805
3929         * layout.h (enum Output_section_order): Define.
3930         (class Layout): Update declarations.
3931         * layout.cc (Layout::get_output_section): Add order parameter.
3932         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3933         is_first_non_relro parameters.  Change all callers.
3934         (Layout::choose_output_section): Likewise.
3935         (Layout::add_output_section_data): Likewise.
3936         (Layout::make_output_section): Likewise.  Set order.
3937         (Layout::default_section_order): New function.
3938         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3939         * output.cc (Output_section::Output_section): Initialize order_.
3940         Don't initialize deleted fields.
3941         (Output_segment::Output_segment): Don't initialize deleted
3942         fields.
3943         (Output_segment::add_output_section_to_load): New function
3944         replacing add_output_section.  Change all callers to call this or
3945         add_output_section_to_nonload.
3946         (Output_segment::add_output_section_to_nonload): New function.
3947         (Output_segment::remove_output_section): Rewrite.
3948         (Output_segment::add_initial_output_data): Likewise.
3949         (Output_segment::has_any_data_sections): Likewise.
3950         (Output_segment::is_first_section_relro): Likewise.
3951         (Output_segment::maximum_alignment): Likewise.
3952         (Output_segment::has_dynamic_reloc): New function replacing
3953         dynamic_reloc_count.  Change all callers.
3954         (Output_segment::has_dynamic_reloc_list): New function replacing
3955         dynamic_reloc_count_list.  Change all callers.
3956         (Output_segment::set_section_addresses): Rewrite.
3957         (Output_segment::set_offset): Rewrite.
3958         (Output_segment::find_first_and_last_list): Remove.
3959         (Output_segment::set_tls_offsets): Rewrite.
3960         (Output_segment::first_section_load_address): Likewise.
3961         (Output_segment::output_section_count): Likewise.
3962         (Output_segment::section_with_lowest_load_address): Likewise.
3963         (Output_segment::write_section_headers): Likewise.
3964         (Output_segment::print_sections_to_map): Likewise.
3965         * output.h (class Output_data): Remove dynamic_reloc_count_
3966         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
3967         (Output_data::add_dynamic_reloc): Rewrite.
3968         (Output_data::has_dynamic_reloc): New function.
3969         (Output_data::dynamic_reloc_count): Remove.
3970         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
3971         is_last_relro_, is_first_non_relro_, is_interp_,
3972         is_dynamic_linker_section_ fields.  Add order and set_order
3973         functions.  Remove is_relro_local, set_is_relro_local,
3974         is_last_relro, set_is_last_relro, is_first_non_relro,
3975         set_is_first_non_relro functions, is_interp, set_is_interp,
3976         is_dynamic_linker_section, and set_is_dynamic_linker_section
3977         functions.
3978         (class Output_segment): Change Output_data_list from std::list to
3979         std:;vector.  Add output_lists_ field.  Remove output_data_ and
3980         output_bss_ fields.  Update declarations.
3981
3982 2010-08-02  Ian Lance Taylor  <iant@google.com>
3983
3984         * arm.cc (Target_arm::gc_process_relocs): Use typename.
3985         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3986         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3987
3988 2010-08-02  Ian Lance Taylor  <iant@google.com>
3989
3990         PR 11855
3991         * script.cc (Script_options::Script_options): Initialize
3992         symbol_definitions_ and symbol_references_.
3993         (Script_options::add_symbol_assignment): Update
3994         symbol_definitions_ and symbol_references_.
3995         (Script_options::add_symbol_reference): New function.
3996         (script_symbol): New function.
3997         * script.h (class Script_options): Add symbol_definitions_ and
3998         symbol_references_ fields.
3999         (Script_options::referenced_const_iterator): New type.
4000         (Script_options::referenced_begin): New function.
4001         (Script_options::referenced_end): New function.
4002         (Script_options::is_referenced): New function.
4003         (Script_options::any_unreferenced): New function.
4004         * script-c.h (script_symbol): Declare.
4005         * yyscript.y (exp): Call script_symbol.
4006         * symtab.cc: Include "script.h".
4007         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4008         Change all callers.  Check symbols referenced by scripts.
4009         (Symbol_table::add_undefined_symbols_from_command_line): Add
4010         layout parameter.  Change all callers.
4011         (Symbol_table::do_add_undefined_symbols_from_command_line):
4012         Likewise.  Break out loop body.  Check symbols referenced by
4013         scripts.
4014         (Symbol_table::add_undefined_symbol_from_command_line): New
4015         function broken out of
4016         do_add_undefined_symbols_from_command_line.
4017         * symtab.h (class Symbol_table): Update declarations.
4018         * archive.cc: Include "layout.h".
4019         (Archive::should_include_member): Add layout parameter.  Change
4020         all callers.  Check for symbol mentioned in expression.
4021         * archive.h (class Archive): Update declaration.
4022         * object.cc (Sized_relobj::do_should_include_member): Add layout
4023         parameter.
4024         * object.h (Object::should_include_member): Add layout parameter.
4025         Change all callers.
4026         (Object::do_should_include_member): Add layout parameter.
4027         (class Sized_relobj): Update declaration.
4028         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4029         parameter.
4030         * dynobj.h (class Sized_dynobj): Update declaration.
4031         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4032         layout parameter.
4033         * plugin.h (class Sized_pluginobj): Update declaration.
4034
4035 2010-08-02  Ian Lance Taylor  <iant@google.com>
4036
4037         PR 11866
4038         * output.cc (Output_segment::set_offset): Search for the first and
4039         last sections rather than assuming that the list is in order.
4040         (Output_segment::find_first_and_last_list): New function.
4041         * output.h (class Output_segment): Update declarations.
4042         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4043         (relro_strip_test_SOURCES): New variable.
4044         (relro_strip_test_DEPENDENCIES): New variable.
4045         (relro_strip_test_LDFLAGS): New variable.
4046         (relro_strip_test_LDADD): New variable.
4047         (relro_strip_test.so): New target.
4048
4049 2010-08-02  Ian Lance Taylor  <iant@google.com>
4050
4051         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4052         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4053         (Target_i386::got_tlsdesc_section): New function.
4054         (Target_i386::got_section): Create space for GOT entries for
4055         TLSDESC relocations.
4056         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4057         R_386_TLS_GOTDESC.
4058         (Target_i386::Scan::global): Likewise.
4059         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4060         using TLSDESC GOT.
4061         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4062         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4063         (Target_x86_64::got_tlsdesc_section): New function.
4064         (Target_x86_64::got_section): Create space for GOT entries for
4065         TLSDESC relocations.
4066         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4067         R_386_TLS_GOTDESC.
4068         (Target_x86_64::Scan::global): Likewise.
4069         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4070         using TLSDESC GOT.
4071
4072 2010-08-02  Ian Lance Taylor  <iant@google.com>
4073
4074         * testsuite/final_layout.sh: Use dc to convert from hex to
4075         decimal.
4076
4077 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4078
4079         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4080         paramter to the call to gold::gc_process_relocs.
4081         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4082         paramter to the call to gold::gc_process_relocs.
4083         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4084         parameter to the call to gold::gc_process_relocs.
4085         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4086         template parameter to the call to gold::gc_process_relocs.
4087         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4088         paramter to the call to gold::gc_process_relocs.
4089         * gc.h (get_embedded_addend_size): New function.
4090         (gc_process_relocs): Save the size of the reloc for use by ICF.
4091         * icf.cc (get_section_contents): Get the addend from the text section
4092         for SHT_REL relocation sections.
4093         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4094         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4095         * int_encoding.h (read_from_pointer): New overloaded function.
4096         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4097         * testsuite/icf_sht_rel_addend_test.sh: New file.
4098         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4099         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4100
4101 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4102
4103         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4104         * Makefile.in: Regenerate.
4105         * testsuite/Makefile.in: Regenerate.
4106
4107 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4108
4109         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4110         * gold/testsuite/debug_msg.cc: Likewise.
4111         * gold/testsuite/odr_violation1.cc
4112         * gold/testsuite/odr_violation2.cc
4113
4114 2010-07-21  Cary Coutant  <ccoutant@google.com>
4115
4116         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4117         string, and length fields.
4118         (Output_merge_string::Merged_strings_list): New type.
4119         (Output_merge_string::Merged_strings_lists): New typedef.
4120         (Output_merge_string): Replace merged_strings_ with
4121         merged_strings_lists_.
4122         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4123         Merged_strings_list per input object and section.  Don't store pointer
4124         to the string.  Don't store length with each merged string entry.
4125         (Output_merge_string::finalize_merged_data): Loop over list of merged
4126         strings lists.  Recompute length of each merged string.
4127
4128 2010-07-15  Cary Coutant  <ccoutant@google.com>
4129
4130         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4131         here.
4132
4133 2010-07-14  Ian Lance Taylor  <iant@google.com>
4134
4135         * descriptors.cc (Descriptors::open): Report correct name in error
4136         message.
4137
4138 2010-07-13  Doug Kwan  <dougkwan@google.com>
4139
4140         * arm.cc (Arm_input_section::Arm_input_section): For a
4141         SHT_ARM_EXIDX section, always keeps the input sections.
4142         (Arm_input_section::set_exidx_section_link): New method.
4143         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4144         has_errors_ to false.
4145         (Arm_exidx_input_section::has_errors,
4146         Arm_exidx_input_section::set_has_errors): New methods.
4147         (Arm_exidx_input_section::has_errors_): New data member.
4148         (Arm_relobj::get_exidx_shndx_list): New method.
4149         (Arm_output_section::append_text_sections_to_list): Do not skip
4150         section without SHF_EXECINSTR.
4151         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4152         errors.
4153         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4154         section header.  Make error messages more verbose.  Check for
4155         a non-executable section linked to an EXIDX section.
4156         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4157         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4158         check that there is no deferred EXIDX section if we exit early.
4159         Instead of not making an EXIDX section in case of an error, make one
4160         and set the has_errors flag of it.
4161         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4162         in a relocatable link.
4163         (Target_arm::do_relax): Look for the EXIDX output section instead of
4164         assuming that it is called .ARM.exidx.
4165         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4166         section list.  Do not check for SHF_EXECINSTR section flags but
4167         skip any input section with errors.
4168         * output.cc (Output_section::Output_section): Initialize
4169         always_keeps_input_sections_ to false.
4170         (Output_section::add_input_section): Check for
4171         always_keeps_input_sections_.
4172         *  output.h (Output_section::always_keeps_input_sections,
4173         Output_section::set_always_keeps_input_sections): New methods.
4174         (Output_section::always_keeps_input_sections): New data member.
4175
4176 2010-07-13  Rafael Espindola  <espindola@google.com>
4177
4178         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4179         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4180
4181 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4182             Ian Lance Taylor  <iant@google.com>
4183
4184         * output.h (Output_section_lookup_maps::add_merge_section):
4185         Correct check of whether value was inserted.
4186         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4187         (Output_section_lookup_maps::add_relaxed_input_section):
4188         Likewise.
4189         * arm.cc (Target_arm::got_section): Remove used local os.
4190         * i386.cc (Target_i386::got_section): Likewise.
4191         * x86_64.cc (Target_x86_64::got_section): Likewise.
4192         * sparc.cc (Target_sparc::got_section): Likewise.
4193         (Target_sparc::relocate): Remove unused local have_got_offset.
4194         * powerpc.cc (Target_powerpc::relocate): Likewise.
4195
4196 2010-07-13  Ian Lance Taylor  <iant@google.com>
4197
4198         * compressed_output.cc (zlib_decompress): Fix signature in
4199         !HAVE_ZLIB_H case.
4200
4201         * archive.cc (Archive::include_member): Unlock an external member
4202         of a thin archive.  Don't bother to delete an object we know is
4203         NULL.
4204
4205 2010-07-12  Cary Coutant  <ccoutant@google.com>
4206
4207         * compressed_output.cc (zlib_decompress): New function.
4208         (get_uncompressed_size): New function.
4209         (decompress_input_section): New function.
4210         * compressed_output.h (get_uncompressed_size): New function.
4211         (decompress_input_section): New function.
4212         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4213         Handle compressed debug sections.
4214         * layout.cc (is_compressed_debug_section): New function.
4215         (Layout::output_section_name): Map compressed section names to
4216         canonical names.
4217         * layout.h (is_compressed_debug_section): New function.
4218         (is_debug_info_section): Recognize compressed debug sections.
4219         * merge.cc: Include compressed_output.h.
4220         (Output_merge_data::do_add_input_section): Handle compressed
4221         debug sections.
4222         (Output_merge_string::do_add_input_section): Handle compressed
4223         debug sections.
4224         * object.cc: Include compressed_output.h.
4225         (Sized_relobj::Sized_relobj): Initialize new data members.
4226         (build_compressed_section_map): New function.
4227         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4228         * object.h (Object::section_is_compressed): New method.
4229         (Object::do_section_is_compressed): New method.
4230         (Sized_relobj::Compressed_section_map): New type.
4231         (Sized_relobj::do_section_is_compressed): New method.
4232         (Sized_relobj::compressed_sections_): New data member.
4233         * output.cc (Output_section::add_input_section): Handle compressed
4234         debug sections.
4235         * reloc.cc: Include compressed_output.h.
4236         (Sized_relobj::write_sections): Handle compressed debug sections.
4237
4238 2010-07-08  Cary Coutant  <ccoutant@google.com>
4239
4240         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4241         weak when resolving to a dynamic def.
4242         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4243         for weak undef/dynamic def cases. Adjust callers.
4244         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4245         undef_binding_weak_.
4246         (Symbol_table::sized_write_globals): Adjust symbol binding.
4247         (Symbol_table::sized_write_symbol): Add binding parameter.
4248         * symtab.h (Symbol::set_undef_binding): New method.
4249         (Symbol::is_undef_binding_weak): New method.
4250         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4251         (Symbol_table::should_override): Add new parameter.
4252         (Symbol_table::sized_write_symbol): Add new parameter.
4253
4254         * testsuite/weak_undef_file1.cc: Add new test case.
4255         * testsuite/weak_undef_file2.cc: Fix header comment.
4256         * testsuite/weak_undef_test.cc: Add new test case.
4257
4258 2010-06-29  Doug Kwan  <dougkwan@google.com>
4259
4260         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4261         Initialize USE_SYMBOL_.
4262         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4263         definition.
4264         (Arm_reloc_property::uses_symbol_): New data member declaration.
4265         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4266         uses symbol value and symbol is undefined but not weakly undefined.
4267
4268 2010-06-28  Rafael Espindola  <espindola@google.com>
4269
4270         * plugin.cc (Plugin::load): Use dlerror.
4271
4272 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4273
4274         * symtab.cc (detect_odr_violations): When reporting an ODR
4275         violation, report an object where the symbol is defined.
4276
4277 2010-06-25  Doug Kwan  <dougkwan@google.com>
4278
4279         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4280         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4281         definition.
4282         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4283         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4284         target hook to detect function points.
4285         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4286         * icf.h (Icf::check_section_for_function_pointers): Change type of
4287         parameter SECTION_NAME to const reference to std::string.  Use
4288         target hook to determine if section may have unsafe pointers.
4289         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4290         method definition.
4291
4292 2010-06-21  Rafael Espindola  <espindola@google.com>
4293
4294         * fileread.cc (Input_file::find_fie): New
4295         (Input_file::open): Use Input_file::find_fie.
4296         * fileread.h (Input_file::find_fie): New
4297         * plugin.cc (set_extra_library_path): New.
4298         (Plugin::load): Add set_extra_library_path to the transfer vector.
4299         (Plugin_manager::set_extra_library_path): New.
4300         (Plugin_manager::add_input_file): Use the extra search path if set.
4301         (set_extra_library_path(): New.
4302         * plugin.h (Plugin_manager): Add set_extra_library_path and
4303         extra_search_path_.
4304
4305 2010-06-19  Cary Coutant  <ccoutant@google.com>
4306
4307         * layout.cc (gdb_sections): Add .debug_types.
4308         (lines_only_debug_sections): Likewise.
4309
4310 2010-06-18  Rafael Espindola  <espindola@google.com>
4311
4312         * plugin.cc (add_input_file,add_input_library)
4313         (Plugin_manager::add_input_file): Make filename arguments const.
4314         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4315         const.
4316
4317 2010-06-16  Doug Kwan  <dougkwan@google.com>
4318
4319         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4320         .ARM.attributes section if we have not merged any input
4321         attributes sections.
4322
4323 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4324
4325         * arm.cc: Allow combining objects with no EABI version
4326         information.
4327
4328 2010-06-15  Rafael Espindola  <espindola@google.com>
4329
4330         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4331
4332 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4333
4334         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4335         (struct iovec): Correct !HAVE_READV definition.
4336
4337 2010-06-10  Cary Coutant  <ccoutant@google.com>
4338
4339         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4340         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4341         reloc sections.
4342         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4343
4344         PR 11683
4345         * symtab.h (Symbol::is_placeholder): New member function.
4346         * target-reloc.h (relocate_section): Check for placeholder symbols.
4347
4348         * testsuite/Makefile.am (plugin_test_8): New test.
4349         (plugin_test_9): New test.
4350         * testsuite/Makefile.in: Regenerate.
4351
4352 2010-06-09  Nick Clifton  <nickc@redhat.com>
4353
4354         * yyscript.y (input_list_element): Allow strings prefixed with
4355         the '-' character.  Treat these as libraries.
4356         * script.cc (script_add_library): New function.  Adds a library
4357         specified by "-l<name>" found in an input script.
4358         * script-c.h: Add prototype for script_add_library.
4359
4360 2010-06-07  Doug Kwan  <dougkwan@google.com>
4361
4362         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4363         Restrict stub-group size to be within long conditional branch
4364         range when working around cortex-A8 erratum.
4365
4366 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4367
4368         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4369         #ifdef typo.
4370
4371 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4372
4373         PR gold/11658
4374         * output.cc
4375         (Output_section::Input_section_sort_entry::compare_section_ordering):
4376         Change to return non-zero correctly.
4377         (Output_section::Input_section_sort_section_order_index_compare
4378         ::operator()): Change to fix ambiguity in comparisons.
4379
4380 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4381
4382         * gold.h (is_wildcard_string): New function.
4383         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4384         (Layout::layout_eh_frame): Ditto.
4385         (Layout::find_section_order_index): New method.
4386         (Layout::read_layout_from_file): New method.
4387         * layout.h (Layout::find_section_order_index): New method.
4388         (Layout::read_layout_from_file): New method.
4389         (Layout::input_section_position_): New private member.
4390         (Layout::input_section_glob_): New private member.
4391         * main.cc (main): Call read_layout_from_file here.
4392         * options.h (--section-ordering-file): New option.
4393         * output.cc (Output_section::input_section_order_specified_): New
4394         member.
4395         (Output_section::Output_section): Initialize new member.
4396         (Output_section::add_input_section): Add new parameter.
4397         Keep input sections when --section-ordering-file is used.
4398         (Output_section::set_final_data_size): Sort input sections when
4399         section ordering file is specified.
4400         (Output_section::Input_section_sort_entry): Add new parameter.
4401         Check sorting type.
4402         (Output_section::Input_section_sort_entry::compare_section_ordering):
4403         New method.
4404         (Output_section::Input_section_sort_compare::operator()): Change to
4405         consider section_order_index.
4406         (Output_section::Input_section_sort_init_fini_compare::operator()):
4407         Change to consider section_order_index.
4408         (Output_section::Input_section_sort_section_order_index_compare
4409         ::operator()): New method.
4410         (Output_section::sort_attached_input_sections): Change to sort
4411         according to section order when specified.
4412         (Output_section::add_input_section<32, true>): Add new parameter.
4413         (Output_section::add_input_section<64, true>): Add new parameter.
4414         (Output_section::add_input_section<32, false>): Add new parameter.
4415         (Output_section::add_input_section<64, false>): Add new parameter.
4416         * output.h (Output_section::add_input_section): Add new parameter.
4417         (Output_section::input_section_order_specified): New
4418         method.
4419         (Output_section::set_input_section_order_specified): New method.
4420         (Input_section::Input_section): Initialize section_order_index_.
4421         (Input_section::section_order_index): New method.
4422         (Input_section::set_section_order_index): New method.
4423         (Input_section::section_order_index_): New member.
4424         (Input_section::Input_section_sort_section_order_index_compare): New
4425         struct.
4426         (Output_section::input_section_order_specified_): New member.
4427         * script-sections.cc (is_wildcard_string): Delete and move modified
4428         method to gold.h.
4429         (Output_section_element_input::Output_section_element_input): Modify
4430         call to is_wildcard_string.
4431         (Output_section_element_input::Input_section_pattern
4432         ::Input_section_pattern): Ditto.
4433         (Output_section_element_input::Output_section_element_input): Ditto.
4434         * testsuite/Makefile.am (final_layout): New test case.
4435         * testsuite/Makefile.in: Regenerate.
4436         * testsuite/final_layout.cc: New file.
4437         * testsuite/final_layout.sh: New file.
4438
4439 2010-06-01  Rafael Espindola  <espindola@google.com>
4440
4441         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4442
4443 2010-06-01  Rafael Espindola  <espindola@google.com>
4444
4445         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4446         visibility of symbols.
4447
4448 2010-05-27  Doug Kwan  <dougkwan@google.com>
4449
4450         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4451         from start of output section instead of address for a local symbol
4452         in a merged or relaxed section when doing a relocatable link.
4453
4454 2010-05-26  Rafael Espindola  <espindola@google.com>
4455
4456        PR 11604
4457         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4458         adding sections the garbage collector removed.
4459         * gold/testsuite/Makefile.am: Add test.
4460         * gold/testsuite/Makefile.in: Regenerate.
4461         * gold/testsuite/plugin_test_7.sh: New.
4462         * gold/testsuite/plugin_test_7_1.c: New.
4463         * gold/testsuite/plugin_test_7_2.c: New.
4464
4465 2010-05-26  Rafael Espindola  <espindola@google.com>
4466
4467         * script-sections.cc (Output_section_definition::set_section_addresses):
4468         Check for --section-start.
4469
4470 2010-05-26  Doug Kwan  <dougkwan@google.com>
4471
4472         * arm.cc (Arm_scan_relocatable_relocs): New class.
4473         (Target_arm::relocate_special_relocatable): New method.
4474         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4475         (Arm_relocate_functions::thumb_branch_common): Same.
4476         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4477         instead of Default_scan_relocatable_relocs.
4478         * target-reloc.h (relocate_for_relocatable): Let target handle
4479         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4480         * target.h (Sized_target::relocate_special_relocatable): New method.
4481
4482 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4483
4484         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4485
4486 2010-05-23  Doug Kwan  <dougkwan@google.com>
4487
4488         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4489         instead of a cast.
4490         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4491         with a direct branch, not a conditional branch, to a stub.
4492         * merge.cc (Output_merge_base::record_input_section): New method
4493         defintion.
4494         (Output_merge_data::do_add_input_section): Record input section if
4495         keeps-input-sections flag is set.
4496         (Output_merge_string::do_add_input_section): Ditto.
4497         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4498         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4499         INPUT_SECTIONS_.
4500         (Output_merge_base::keeps_input_sections,
4501         Output_merge_base::set_keeps_input_sections,
4502         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4503         method definitions.
4504         (Output_merge_base::Input_sections): New type declaration.
4505         (Output_merge_base::input_sections_begin,
4506         Output_merge_base::input_sections_end,
4507         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4508         (Output_merge_base::bool keeps_input_sections_,
4509         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4510         Output_merge_base::input_sections_): New data members.
4511         (Output_merge_data::do_set_keeps_input_sections): New method
4512         defintion.
4513         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4514         * output.cc (Output_section::Input_section::relobj): Move method
4515         defintion from class declaration to here and handle merge sections.
4516         (Output_section::Input_section::shndx): Ditto.
4517         (Output_section::Output_section): Remove initializations of removed
4518         data members and initialize new data member LOOKUP_MAPS_.
4519         (Output_section::add_input_section): Set keeps-input-sections flag
4520         for a newly created merge output section as appropriate.  Adjust code
4521         to use Output_section_lookup_maps class.
4522         (Output_section::add_relaxed_input_section): Adjst code for lookup
4523         maps code refactoring.
4524         (Output_section::add_merge_input_section): Add a new parameter
4525         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4526         class.  If adding input section to a newly created merge output
4527         section fails, remove the new merge section.
4528         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4529         Adjust code for use of the Output_section_lookup_maps class.
4530         (Output_section::find_merge_section): Ditto.
4531         (Output_section::build_lookup_maps): New method defintion.
4532         (Output_section::find_relaxed_input_section): Adjust code to use
4533         Output_section_lookup_maps class.
4534         (Output_section::get_input_sections): Export merge sections.  Adjust
4535         code to use Output_section_lookup_maps class.
4536         (Output_section:::add_script_input_section): Adjust code to use
4537         Output_section_lookup_maps class.  Update lookup maps for merge
4538         sections also.
4539         (Output_section::discard_states): Use Output_section_lookup_maps.
4540         (Output_section::restore_states): Same.
4541         * output.h (Merge_section_properties): Move class defintion out of
4542         Output_section.
4543         (Output_section_lookup_maps): New class.
4544         (Output_section::Input_section::is_merge_section): New method
4545         defintion.
4546         (Output_section::Input_section::relobj): Move defintion out of class
4547         defintion.  Declare method only.
4548         (Output_section::Input_section::shndx): Ditto.
4549         (Output_section::Input_section::output_merge_base): New method defintion.
4550         (Output_section::Input_section::u2_.pomb): New union field.
4551         (Output_section::Merge_section_by_properties_map,
4552         Output_section::Output_section_data_by_input_section_map,
4553         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4554         Remove types.
4555         (Output_section::add_merge_input_section): Add new parameter
4556         KEEPS_INPUT_SECTIONS.
4557         (Output_section::build_lookup_maps): New method declaration.
4558         (Output_section::merge_section_map_,
4559         Output_section::merge_section_by_properties_map_,
4560         Output_section::relaxed_input_section_map_,
4561         Output_section::is_relaxed_input_section_map_valid_): Remove data
4562         members.
4563         (Output_section::lookup_maps_): New data member.
4564
4565 2010-05-21  Doug Kwan  <dougkwan@google.com>
4566
4567         PR gold/11619
4568         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4569         avoid a compilation error.
4570
4571 2010-05-19  Rafael Espindola  <espindola@google.com>
4572
4573         * script-sections.cc (Output_section_definition::allocate_to_segment):
4574         Update the phdrs_list even when the output section is NULL.
4575         * testsuite/Makefile.am: Add test.
4576         * testsuite/Makefile.in: Regenerate.
4577         * testsuite/script_test_9.cc: New.
4578         * testsuite/script_test_9.sh: New.
4579         * testsuite/script_test_9.t: New.
4580
4581 2010-05-19  Doug Kwan  <dougkwan@google.com>
4582
4583         * arm.cc (Arm_input_section::original_size): New method.
4584         (Arm_input_section::do_addralign): Add a cast.
4585         (Arm_input_section::do_output_offset): Remove static cast.
4586         (Arm_input_section::original_addralign,
4587          Arm_input_section::original_size_): Change type to uint32_t.
4588         (Arm_input_section::init): Add safe casts for section alignment
4589         and size.
4590         (Arm_input_section::set_final_data_size): Do not set address and
4591         offset of stub table.
4592         (Arm_output_section::fix_exidx_coverage): Change use of of
4593         Output_section::Simple_input_section to that of
4594         Output_section::Input_section.
4595         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4596         except for the first pass.
4597         * output.cc (Output_section::get_input_sections): Change type of
4598         input_sections to std::list<Input_section>.
4599         (Output_section::add_script_input_section): Rename from
4600         Output_section::add_simple_input_section.  Change type of SIS
4601         parameter from Simple_input_section to Input_section.
4602         * output.h (Output_section::Simple_input_section): Remove class.
4603         (Output_section::Input_section): Change class visibility to public.
4604         (Output_section::Input_section::addralign): Use stored alignments
4605         for special input sections if set.
4606         (Output_section::Input_section::set_addralign): New method.
4607         (Output_section::get_input_sections): Change parameter type from
4608         list of Simple_input_section to list of Input_section.
4609         (Output_section::add_script_input_section): Rename from
4610         Output_section::add_simple_input_section. Change first parameter's
4611         type from Simple_input_section to Input_section and remove the
4612         second and third parameters.
4613         * script-sections.cc (Input_section::Input_section_list): Change
4614         type to list of Output_section::Input_section/
4615         (Input_section_info::Input_section_info): Change parameter type of
4616         INPUT_SECTION to Output_section::Input_section.
4617         (Input_section_info::input_section): Change return type.
4618         (Input_section_info::input_section_): Change type to
4619         Output_section::Input_section.
4620         (Output_section_element_input::set_section_addresses): Adjust code
4621         to use Output_section::Input_section instead of
4622         Output_section::Simple_input_section.  Adjust code for renaming
4623         of Output_section::add_simple_input_section.
4624         (Orphan_output_section::set_section_addresses): Ditto.
4625
4626 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4627
4628         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4629         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4630
4631 2010-05-18  Rafael Espindola  <espindola@google.com>
4632
4633         * options.cc (General_options::finalize): Handle -nostdlib.
4634         * options.h (nostdlib): New option.
4635         * script.cc (script_add_search_dir): Handle -nostdlib.
4636
4637 2010-05-12  Doug Kwan  <dougkwan@google.com>
4638
4639         * arm.cc (Target_arm::do_finalize_sections): Create an empty
4640         attributes section only if there no attributes section after merging.
4641         (Target_arm::merge_object_attributes): Move value of
4642         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4643         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4644         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4645         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4646         and arm_attr_merge_7.stdout.
4647         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4648         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4649         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4650         arm_attr_merge_7b.o): New rules.
4651         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4652         arm_attr_merge_7
4653         * testsuite/Makefile.in: Regenerate.
4654         * testsuite/arm_attr_merge.sh: New file.
4655         * testsuite/arm_attr_merge_[67][ab].s: Same.
4656
4657 2010-05-05  Nick Clifton  <nickc@redhat.com>
4658
4659         * po/es.po: Updated Spanish translation.
4660
4661 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4662
4663         * Makefile.am (install-exec-local): Properly install gold as
4664         default cross linker.
4665         * Makefile.in: Regenerated.
4666
4667 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
4668             Nick Clifton  <nickc@redhat.com>
4669
4670         * configure.ac (install_as_default): Define and set to false
4671         unless --enable-gold or --enable-gold=both/gold has been
4672         specified.
4673         * configure: Regenerate.
4674
4675         * Makefile.am (install-exec-local): Install the executable as
4676         'ld.gold'.  If install_as_default is true then also install it as
4677         'ld'.
4678         * Makefile.in: Regenerated.
4679
4680 2010-04-24  Ian Lance Taylor  <iant@google.com>
4681
4682         * layout.cc (Layout::layout_reloc): In relocatable link don't
4683         combine reloc sections for grouped sections.
4684
4685 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
4686
4687         * gc.h (gc_process_relocs): Pass information on relocs pointing to
4688         sections that are not ordinary to icf.
4689         * icf.cc (get_section_contents): Handle relocation pointing to section
4690         with no object or shndx information.
4691         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4692         * testsuite/Makefile.in: Regenerate.
4693         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4694         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4695
4696 2010-04-22  Ian Lance Taylor  <iant@google.com>
4697
4698         * expression.cc (Expression::Expression_eval_info): Add
4699         result_alignment_pointer field.
4700         (Expression::eval_with_dot): Add result_alignment_pointer
4701         parameter.  Change all callers.
4702         (Expression::eval_maybe_dot): Likewise.
4703         (class Binary_expression): Add alignment_pointer parameter to
4704         left_value and right_value.  Change all callers.
4705         (BINARY_EXPRESSION): Set result alignment.
4706         (class Trinary_expression): Add alignment_pointer parameter to
4707         arg2_value and arg3_value.  Change all callers.
4708         (Trinary_cond::value): Set result alignment.
4709         (Max_expression::value, Min_expression::value): Likewise.
4710         (Align_expression::value): Likewise.
4711         * script-sections.cc (class Sections_element): Add dot_alignment
4712         parameter to set_section_addresses virtual function.  Update
4713         instantiations.
4714         (class Output_section_element): Likewise.
4715         (Script_sections::create_segments): Add dot_alignment parameter.
4716         Change all callers.
4717         (Script_sections::create_segments_from_phdrs_clause): Likewise.
4718         (Script_sections::set_phdrs_clause_addresses): Likewise.
4719         * script-sections.h: Update declarations.
4720         * script.h: Update declarations.
4721         * output.h (Output_segment::set_minimum_p_align): Don't decrease
4722         min_p_align.
4723         * testsuite/script_test_3.t: Set large alignment.
4724         * testsuite/script_test_3.sh: Make sure that at least one LOAD
4725         segment has expected alignment.
4726
4727 2010-04-22  Nick Clifton  <nickc@redhat.com>
4728
4729         * po/gold.pot: Updated by the Translation project.
4730         * po/vi.po: Updated Vietnamese translation.
4731
4732 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
4733
4734         * testsuite/Makefile.am (check_PROGRAMS): Add
4735         icf_virtual_function_folding_test.
4736         * testsuite/Makefile.in: Regenerated.
4737
4738 2010-04-15  Andrew Haley  <aph@redhat.com>
4739
4740         * options.h (merge_exidx_entries): New option.
4741         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4742         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4743         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4744         (Target_arm::merge_exidx_entries): New function.
4745         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4746         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4747         to Arm_exidx_fixup constructor.
4748         Add new arg, merge_exidx_entries.
4749         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4750         Arm_output_section::fix_exidx_coverage.
4751
4752 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
4753
4754         * icf.cc (get_section_contents): Check for preemptible functions.
4755         Ignore addend when appropriate.
4756         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
4757         section folded.
4758         (add_from_relobj): Check for section folded.
4759         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4760         * symtab.h (should_add_dynsym_entry): Add new parameter.
4761         * target-reloc.h (scan_relocs): Check for section folded.
4762         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4763         Check reloc types for function pointers in shared objects.
4764         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4765         case.
4766         (icf_preemptible_functions_test): New test case.
4767         (icf_string_merge_test): New test case.
4768         * testsuite.Makefile.in: Regenerate.
4769         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4770         bar_glob.  Refactor code.
4771         * testsuite/icf_preemptible_functions_test.cc: New file.
4772         * testsuite/icf_preemptible_functions_test.sh: New file.
4773         * testsuite/icf_string_merge_test.cc: New file.
4774         * testsuite/icf_string_merge_test.sh: New file.
4775         * testsuite/icf_virtual_function_folding_test.cc: New file.
4776         * testsuite/icf_virtual_function_folding_test.sh: New file.
4777
4778 2010-04-14  Doug Kwan  <dougkwan@google.com>
4779
4780         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4781         for local symbol recounting if we remove a section due to ICF.
4782         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4783         there are no regular objects in input.
4784
4785 2010-04-13  Doug Kwan  <dougkwan@google.com>
4786
4787         * arm.cc (Arm_input_section::set_final_data_size): Compute
4788         accurate final data size instead of using current data size.
4789
4790 2010-04-09  Doug Kwan  <dougkwan@google.com>
4791
4792         * layout.cc (Layout::choose_output_section): Handle script section
4793         types.
4794         (Layout::make_output_section_for_script): Add section type parameter.
4795         Handle script section types.
4796         * layout.h (Layout::make_output_section_for_script): Add section
4797         type parameter.
4798         * output.cc (Output_section::Output_section): Initialize data member
4799         is_noload_.
4800         (Output_section::do_reset_address_and_file_offset): Do not set address
4801         to 0 if section is a NOLOAD section.
4802         * output.h (Output_section::is_noload): New method.
4803         (Output_section::set_is_noload): Ditto.
4804         (Output_section::is_noload_): New data member.
4805         * script-c.h (Script_section_type): New enum type.
4806         (struct Parser_output_section_header): Add new file section_type.
4807         * script-sections.cc (Sections_element::output_section_name): Add
4808         parameter for returning script section type.
4809         (Output_section_definition::output_section_name): Ditto.
4810         (Output_section_definition::section_type)P; New method.
4811         (Output_section_definiton::script_section_type_name): Ditto.
4812         (Output_section_definition::script_section_type_): New data member.
4813         (Output_section_definition::Output_section_definition): Initialize
4814         data member Output_section_definition::script_section_type_.
4815         (Output_section_definition::create_sections): Pass script section type
4816         to Layout::make_output_section_for_script.
4817         (Output_section_definition::output_section_name): Return script
4818         section type to caller.
4819         (Output_section_definition::set_section_address): Do not advance
4820         dot value and load address if section type is NOLOAD.  Set address
4821         of NOLOAD sections regardless of section flags.
4822         (Output_section_definition::print): Print section type if it is
4823         not SCRIPT_SECTION_TYPE_NONE.
4824         (Output_section_definition::section_type): New method.
4825         (Output_section_definition::script_section_type_name): Ditto.
4826         (Script_sections::output_section_name): Add new parameter
4827         PSECTION_TYPE for returning script section type.  Pass it to
4828         section elements.  Handle discard sections.
4829         (Sort_output_sections::operator()): Handle NOLOAD sections.
4830         * script-sections.h (Script_sections::Section_type): New enum type.
4831         (Script_sections::output_section_name): Add a new parameter for
4832         returning script section type.
4833         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4834         INFO and NOLOAD.
4835         * yyscript.y (union): Add new field SECTION_TYPE.
4836         (COPY, DSECT, INFO, NOLOAD): New tokens.
4837         (opt_address_and_section_type): Change type to output_section_header.
4838         (section_type): New non-terminal
4839         (section_header): Handle section type.
4840         (opt_address_and_section_type): Return section type value.
4841
4842 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
4843
4844         * testsuite/plugin_common_test_1.c (foo): Add prototype.
4845         * testsuite/plugin_common_test_2.c (foo): Likewise.
4846
4847 2010-04-08  Doug Kwan  <dougkwan@google.com>
4848
4849         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4850         Output_merge_data.
4851         * output.cc (Output_section::add_merge_input_section): Simplify
4852         code and return status of Output_merge_base::add_input_section.
4853         Update merge section map only if Output_merge_base::add_input_section
4854         returns true.
4855
4856 2010-04-07  Doug Kwan  <dougkwan@google.com>
4857
4858         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4859         if section is marked as containing instructions but has no mapping
4860         symbols.
4861         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4862         correct section index.
4863         (Arm_relobj::find_linked_text_section): Ditto.
4864
4865 2010-04-07  Cary Coutant  <ccoutant@google.com>
4866
4867         * archive.cc (include_member): Destroy Read_symbols_data object before
4868         releasing file.
4869         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4870         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4871         (Read_symbols_data::~Read_symbols_data) New destructor.
4872         (Section_relocs::Section_relocs) New constructor.
4873         (Section_relocs::~Section_relocs) New destructor.
4874         (Read_relocs_data::Read_relocs_data) New constructor.
4875         (Read_relocs_data::~Read_relocs_data) New destructor.
4876         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4877         pointers to NULL after deleting.
4878
4879 2010-04-07  Doug Kwan  <dougkwan@google.com>
4880
4881         * arm.cc: Replace "endianity" with "endianness" in comments.
4882         (Arm_exidx_cantunwind): Ditto.
4883         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4884         (Arm_relobj::merge_flags_and_attributes): New method.
4885         (Arm_relobj::merge_flags_and_attributes_): New data member.
4886         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4887         (Arm_relobj::scan_sections_for_stubs): Ditto.
4888         (Arm_relobj::do_read_symbols): Check to see if we really want to
4889         merge processor-specific flags and attributes.  Exit early if
4890         an object is empty except for section names and the undefined symbol.
4891         (Target_arm::do_finalize_sections): Move check for ELF format to
4892         Arm_relobj::do_read_symbols.  Merge processor specific flags and
4893         attributes from a regular object only when we have determined that
4894         it is aapropriate.  Do not create an .ARM.attributes section in
4895         output if there is no regular input object.
4896         (Target_arm::merge_processor_specific_flags): Check
4897         --warn-mismatch before printing any error.
4898         (Target_arm::merge_object_attributes): Ditto.
4899         * gold.cc (queue_middle_tasks): Handle the case in which there is
4900         no regular object in input.
4901         * options.cc (General_options::parse_EB): New method.
4902         (General_options::parse_EL): Same.
4903         (General_options::General_options): Initialize endianness_.
4904         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4905         New options.
4906         (General_options::Endianness): New enum.
4907         (General_options::endianness): New method.
4908         (General_options::endianness_): New data member.
4909         * parameters.cc (Parameters::set_options): Check target endianness.
4910         (Parameters::set_target_once): Ditto.
4911         (Parameters::check_target_endianness): New method.
4912         (parameters_force_valid_target): If either -EL or -EB is specified,
4913         use it to define endianness of default target.
4914         * parameters.h (Parameters::check_target_endianness): New method
4915         declaration.
4916         * target.h (class Target): Change "endianity" to "endianness"
4917         in comments.
4918
4919 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4920
4921         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4922         * configure: Regenerate.
4923         * Makefile.in: Regenerate.
4924         * testsuite/Makefile.in: Regenerate.
4925
4926 2010-04-06  Cary Coutant  <ccoutant@google.com>
4927
4928         gcc PR lto/42757
4929         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4930         prevailing definitions of common symbols.
4931         * testsuite/plugin_test_6.sh: New test case.
4932         * testsuite/plugin_common_test_1.c: New test case.
4933         * testsuite/plugin_common_test_2.c: New test case.
4934         * testsuite/Makefile.am (plugin_test_6): New test case.
4935         * testsuite/Makefile.in: Regenerate.
4936
4937 2010-04-06  Nick Clifton  <nickc@redhat.com>
4938
4939         * po/vi.po: New Vietnamese translation.
4940
4941 2010-03-30  Doug Kwan  <dougkwan@google.com>
4942
4943         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4944
4945 2010-03-25  Doug Kwan  <dougkwan@google.com>
4946
4947         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4948         to avoid a conversion warning on a 32-bit host.
4949
4950 2010-03-24  Ian Lance Taylor  <iant@google.com>
4951
4952         * testsuite/script_test_3.t: Add a TLS segment.
4953         * testsuite/Makefile.am (check_PROGRAMS): Add
4954         tls_phdrs_script_test.
4955         (tls_phdrs_script_test_SOURCES): Define.
4956         (tls_phdrs_script_test_DEPENDENCIES): Define.
4957         (tls_phdrs_script_test_LDFLAGS): Define.
4958         (tls_phdrs_script_test_LDADD): Define.
4959         * testsuite/Makefile.in: Rebuild.
4960
4961 2010-03-23  Cary Coutant  <ccoutant@google.com>
4962
4963         * fileread.cc (find_or_make_view): Fix comment.
4964
4965 2010-03-23  Ian Lance Taylor  <iant@google.com>
4966
4967         * script-sections.cc (class Orphan_section_placement): Define
4968         PLACE_TLS and PLACE_TLS_BSS.
4969         (Orphan_section_placement::Orphan_section_placement): Initialize
4970         new places.
4971         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4972         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4973         (tls_script_test_SOURCES): Define.
4974         (tls_script_test_DEPENDENCIES): Define.
4975         (tls_script_test_LDFLAGS): Define.
4976         (tls_script_test_LDADD): Define.
4977         * testsuite/Makefile.in: Rebuild.
4978
4979 2010-03-22  Doug Kwan  <dougkwan@google.com>
4980
4981         * arm.cc (Arm_relocate_functions::abs8,
4982         Arm_relocate_functions::abs16): Use correct check for overflow
4983         specified in the ARM ELF specs.
4984         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
4985         target of a BLX instruction specially.
4986         (Reloc_stub::stub_type_for_reloc): Ditto.
4987         (Relocate::relocate): Use symbolic names instead of numeric relocation
4988         codes to report error.
4989         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4990         workaround.
4991         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4992         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4993         thumb2_blx_out_of_range.stdout
4994         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4995         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4996         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4997         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4998         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4999         thumb2_blx_in_range, thumb2_blx_in_range.o,
5000         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5001         thumb2_blx_out_of_range.o): New rules.
5002         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5003         thumb2_blx_in_range and thumb2_blx_out_of_range.
5004         * testsuite/Makefile.in: Regenerate.
5005         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5006         * testsuite/thumb_blx_in_range.s: New file.
5007         * testsuite/thumb_blx_out_of_range.s: New file.
5008
5009 2010-03-22  Rafael Espindola  <espindola@google.com>
5010
5011         * archive.cc (Should_include): Move to archive.h.
5012         (should_include_member): Make it a member of Archive.
5013         (Lib_group): New.
5014         (Add_lib_group_symbols): New.
5015         * archive.h: Include options.h.
5016         (Archive_member): Moved from Archive.
5017         (Should_include): Moved from archive.cc.
5018         (Lib_group): New.
5019         (Add_lib_group_symbols): New.
5020         * dynobj.cc (do_should_include_member): New.
5021         * dynobj.h (do_should_include_member): New.
5022         * gold.cc (queue_initial_tasks): Update call to queue.
5023         * main.cc (main): Print lib group stats.
5024         * object.cc (do_should_include_member): New.
5025         * object.h: Include archive.h.
5026         (Object::should_include_member): New.
5027         (Object::do_should_include_member): New.
5028         (Sized_relobj::do_should_include_member): New.
5029         * options.cc (General_options::parse_start_lib): New.
5030         (General_options::parse_end_lib): New.
5031         (Input_arguments::add_file): Handle lib groups.
5032         (Input_arguments::start_group): Check we are not in a lib.
5033         (Input_arguments::start_lib): New.
5034         (Input_arguments::end_lib): New.
5035         * options.h (General_options): Add start_lib and end_lib.
5036         (Input_argument::lib_): New.
5037         (Input_argument::lib): New.
5038         (Input_argument::is_lib): New.
5039         (Input_file_lib): New.
5040         (Input_arguments::in_lib_): New.
5041         (Input_arguments::in_lib): New.
5042         (Input_arguments::start_lib): New.
5043         (Input_arguments::end_lib_): New.
5044         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5045         in unused members as preempted.
5046         (Sized_pluginobj::do_should_include_member): New.
5047         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5048         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5049         return the blocker.
5050         (Read_symbols::do_whole_lib_group): New.
5051         (Read_symbols::do_lib_group): New.
5052         (Read_symbols::do_read_symbols): Handle lib groups.
5053         (Read_symbols::get_name): Handle lib groups.
5054         * readsyms.h (Read_symbols): Add an archive member pointer.
5055         (Read_symbols::do_whole_lib_group): New.
5056         (Read_symbols::do_lib_group): New.
5057         (Read_symbols::member_): New.
5058         * script.cc (read_input_script): Update call to queue_soon.
5059
5060 2010-03-19  Doug Kwan  <dougkwan@google.com>
5061
5062         * arm.cc (Stub_table::Stub_table): Initialize new data members
5063         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5064         (Stub_table::add_reloc_stub): Assign stub offset and update
5065         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5066         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5067         New data members.
5068         (Stub_table::update_data_size_and_addralign): Use
5069         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5070         instead of going over all reloc stubs.
5071         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5072         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5073         Stringpool_template::offset_ to size of Stringpool_char.
5074         (Stringpool_template::new_key_offset): Remove code to initialize
5075         Stringpool_template::offset_.
5076         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5077         Stringpool_template::offset_ to zero.
5078
5079 2010-03-15  Doug Kwan  <dougkwan@google.com>
5080
5081         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5082         offset_.
5083         (Stringpool_template::new_key_offset): New method.
5084         (Stringpool_template::add_string): Assign offsets when adding new
5085         strings.
5086         (Stringpool_template::set_string_offsets): Do not set string offsets
5087         when not optimizing.
5088         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5089         member size_.
5090         (Chunked_vector::clear): Clear size_.
5091         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5092         (Chunked_vector::size): Return size_.
5093         (Chunked_vector::push_back): Use size_ to find insert position.
5094         (Chunked_vector::size_): New data member.
5095         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5096         (Stringpool_template::new_key_offset): New method declaration.
5097         (Stringpool_template::offset_): New data member.
5098
5099 2010-03-15   Rafael Espindola  <espindola@google.com>
5100
5101         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5102         Add_symbols' constructor.
5103         * readsyms.h (Add_symbols): Remove the input_group member.
5104
5105 2010-03-10  Ian Lance Taylor  <iant@google.com>
5106
5107         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5108         target to ask whether a reference to a symbol requires a stack
5109         split.
5110         * target.h (Target::is_call_to_non_split): New function.
5111         (Target::do_is_call_to_non_split): Declare virtual function.
5112         * target.cc: Include "symtab.h".
5113         (Target::do_is_call_to_non_split): New function.
5114         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5115
5116 2010-03-10  Cary Coutant  <ccoutant@google.com>
5117
5118         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5119         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5120         (File_read::open[2]): Add whole_file_view_ to list of views.
5121         (File_read::make_view): Remove test of whole_file_view_.
5122         (File_read::find_or_make_view): Create whole_file_view_ if
5123         necessary.
5124         (File_read::clear_views): Replace bool parameter with enum;
5125         adjust all callers.  Don't delete views with permanent data;
5126         do delete cached views and views from archives if
5127         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5128         if clearing the corresponding view.
5129         * fileread.h (File_read::Clear_views_mode): New enum.
5130         (File_read::View::is_permanent_view): New method.
5131         (File_read::clear_views): Replace bool parameter
5132         with enum; adjust all callers.
5133         * options.h (General_options): Change keep_files_mapped option;
5134         add map_whole_files.
5135         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5136         releasing the file.
5137         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5138         the file.
5139
5140 2010-03-10  David S. Miller  <davem@davemloft.net>
5141
5142         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5143
5144 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5145
5146         * icf.cc (get_section_contents): Add '@' marker after processing the
5147         merge reloc.
5148
5149 2010-03-08  Doug Kwan  <dougkwan@google.com>
5150
5151         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5152         due to a conversion warning.
5153         (Arm_relobj::update_output_local_symbol_count): Check for local
5154         symbol with unset output index.
5155
5156 2010-03-05  Ian Lance Taylor  <iant@google.com>
5157
5158         * options.h (class General_options): Add --spare-dynamic-tags.
5159         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5160         --spare-dynamic-tags.
5161
5162 2010-03-05  Ian Lance Taylor  <iant@google.com>
5163
5164         * incremental.cc: Include "libiberty.h".
5165
5166 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5167
5168         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5169         function, is_info_ member.
5170         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5171         (Versions::Versions): Update caller.
5172         (Versions::define_base_version): Likewise.
5173         (Versions::add_def): Likewise.
5174
5175 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5176
5177         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5178         (Scan::possible_function_pointer_reloc): New function.
5179         (Scan::local_reloc_may_be_function_pointer): Change to call
5180         possible_function_pointer_reloc.
5181         (Scan::global_reloc_may_be_function_pointer): Ditto.
5182         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5183         relocations in ".data.rel.ro._ZTV" section.
5184         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5185         * testsuite/icf_safe_so_test.cc: Ditto.
5186         * testsuite/icf_safe_test.cc: Ditto.
5187         * testsuite/icf_safe_test.sh: Ditto.
5188
5189 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5190             Ian Lance Taylor  <iant@google.com>
5191
5192         * target-reloc.h (relocate_section): Check the symbol table index
5193         for -1U before setting the local symbol index.
5194         (scan_relocatable_relocs): If copying the relocation, record that
5195         the local symbol is required.
5196         * object.h (Symbol_value::is_output_symtab_index_set): New
5197         function.
5198         (Symbol_value::may_be_discarded_from_output_symtab): New
5199         function.
5200         (Symbol_value::has_output_symtab_entry): New function.
5201         (Symbol_value::needs_output_symtab_entry): Remove.
5202         (Symbol_value::output_symtab_index): Make sure the symbol index is
5203         set.
5204         (Symbol_value::set_output_symtab_index): Make sure the symbol
5205         index is not set.  Make sure the new index is valid.
5206         (Symbol_value::set_must_have_output_symtab_entry): New function.
5207         (Symbol_value::has_output_dynsym_entry): New function.
5208         (Symbol_value::set_output_dynsym_index): Make sure the new index
5209         is valid.
5210         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5211         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5212         local symbol if permitted.
5213         (Sized_relobj::do_finalize_local_symbols): Call
5214         is_output_symtab_index_set rather than needs_output_symtab_entry.
5215         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5216         rather than needs_output_symtab_entry.  Call
5217         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5218         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5219         is_output_symtab_index_set rather than needs_output_symtab_entry.
5220         * testsuite/discard_locals_relocatable_test.c: New file.
5221         * testsuite/discard_locals_test.sh: Test -r.
5222         * testsuite/Makefile.am (check_DATA): Add
5223         discard_locals_relocatable_test1.syms,
5224         discard_local_relocatable_test2.syms.
5225         (MOSTLYCLEANFILES): Likewise.  Also add
5226         discard_locals_relocatable_test1.lout and
5227         discard_locals_relocatable_test2.out.
5228         (discard_locals_relocatable_test1.syms): New target.
5229         (discard_locals_relocatable_test.o): New target.
5230         (discard_locals_relocatable_test1.out): New target.
5231         (discard_locals_relocatable_test2.syms): New target.
5232         (discard_locals_relocatable_test2.out): New target.
5233         (various): Add missing ../ld-new dependencies.
5234         * testsuite/Makefile.in: Rebuild.
5235
5236 2010-03-03  Nick Clifton  <nickc@redhat.com>
5237
5238         * po/fi.po: New Finnish translation.
5239
5240 2010-03-01  Doug Kwan  <dougkwan@google.com>
5241
5242         * layout.cc (Layout::Layout): Force section types of .init_array*,
5243         .preinit_array* and .fini_array* sections.
5244         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5245         Fix check of return value of std::string::find.().
5246         (Output_section::Input_section_sort_compare::operator()): Remove
5247         comment about .init_array.
5248         (Output_section::Input_section_sort_init_fini_compare::operator()):
5249         New method.
5250         (Output_section::sort_attached_input_sections): Handle .init_array
5251         and .fini_array specially.
5252         * output.h (Output_section::Inut_section_sort_compare): Update
5253         comment.
5254         (Output_section::Input_section_sort_init_fini_compare): New struct.
5255
5256 2010-02-26  Doug Kwan  <dougkwan@google.com>
5257
5258         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5259         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5260         * testsuite/debug_msg.sh: Avoid matching source line number for
5261         use of global variable undef_int.
5262
5263 2010-02-26  Doug Kwan  <dougkwan@google.com>
5264
5265         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5266         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5267         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5268         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5269         * options.cc (General_options::General_options): Initialize member
5270         fix_v4bx_.
5271         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5272         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5273         and rm_no_fix_v4bx.stdout
5274         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5275         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5276         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5277         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5278         and arm_no_fix_v4bx.
5279         * Makefile.in: Regenerate.
5280         * testsuite/arm_fix_v4bx.s: New file.
5281         * testsuite/arm_fix_v4bx.sh: Ditto.
5282
5283 2010-02-24  Doug Kwan  <dougkwan@google.com>
5284
5285         * arm.cc (Target_arm::got_section): Make the .got section the first
5286         non RELRO section in the data segment.
5287         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5288         suffixes of section names.
5289
5290 2010-02-24  Doug Kwan  <dougkwan@google.com>
5291
5292         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5293         flags and attributes merging if an input file is a binary file.
5294         * fileread.cc (Input_file::open): Record format of original file.
5295         * fileread.h (Input_file::Format): New enum type.
5296         (Input_file::Input_file): Initialize data member format_.
5297         (Input_file::format): New method definition.
5298         (Input_file::format_):: New data member.
5299
5300 2010-02-24  Doug Kwan  <dougkwan@google.com>
5301
5302         * arm.cc (Arm_output_data_got): New class.
5303         (ARM_TCB_SIZE): New constant
5304         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5305         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5306         If user uses a script with a SECTIONS clause, issue only a warning
5307         for a misplaced EXIDX input section.  Otherwise, issue an error.
5308         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5309         garbage collection.
5310         (Target_arm::got_mode_index_entry): Handle static linking.
5311         (Target_arm::Scan::local): Ditto.
5312         (Target_arm::Scan::global): Ditto.
5313         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5314         all incorrectly implemented relocations.
5315         (Target_arm::fix_exidx_coverage): Pass layout to
5316         Arm_output_section::fix_exidx_coverage.
5317         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5318         from ".ARM.exidx." and ".ARM.extab.".
5319
5320 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5321
5322         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5323         section if it does not already exist.
5324         * attributes.cc (Attributes_section_data::Attributes_section_data):
5325         Don't crash if size is zero.
5326
5327 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5328             Ian Lance Taylor  <iant@google.com>
5329
5330         * gold.cc (queue_middle_tasks): If no input files were opened,
5331         exit.
5332         * workqueue.h (Task_function::Task_function): Assert that there is
5333         a blocker.
5334
5335 2010-02-22  Doug Kwan  <dougkwan@google.com>
5336
5337         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5338         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5339         types to avoid warnings due to different uint64_t implementations
5340         on different hosts.
5341
5342 2010-02-21  Doug Kwan  <dougkwan@google.com>
5343
5344         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5345         handling of the maximum backward branch offset.
5346         (Arm_relocate_functions::thumb_branch_common): Ditto.
5347         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5348         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5349         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5350         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5351         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5352         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5353         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5354         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5355         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5356         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5357         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5358         thumb2_bl_out_of_range.o): New rules.
5359         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5360         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5361         thumb2_bl_out_of_range
5362         * testsuite/Makefile.in: Regenerate.
5363         * testsuite/arm_bl_in_range.s: New file.
5364         * testsuite/arm_bl_out_of_range.s: Ditto.
5365         * testsuite/arm_branch_in_range.sh: Ditto.
5366         * testsuite/arm_branch_range.t: Ditto.
5367         * testsuite/thumb2_branch_range.t: Ditto.
5368         * testsuite/thumb_bl_in_range.s: Ditto.
5369         * testsuite/thumb_bl_out_of_range.s: Ditto.
5370         * testsuite/thumb_branch_range.t: Ditto.
5371
5372 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5373
5374         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5375         Add reloc offset information.
5376         * icf.cc (get_section_contents): Change iterators to point to the new
5377         vectors. Add reloc offset information to the contents.
5378         * icf.h (Icf::Sections_reachable_info): New typedef.
5379         (Icf::Sections_reachable_list): New typedef.
5380         (Icf::Offset_info): New typedef.
5381         (Icf::Reloc_info): New struct typedef.
5382         (Icf::Reloc_info_list): New typedef.
5383         (Icf::symbol_reloc_list): Delete method.
5384         (Icf::addend_reloc_list): Delete method.
5385         (Icf::section_reloc_list): Delete method.
5386         (Icf::reloc_info_list): New method.
5387         (Icf::reloc_info_list_): New member.
5388
5389 2010-02-19  Doug Kwan  <dougkwan@google.com>
5390
5391         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5392         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5393         * arm.cc (Arm_relocation_functions): New forward declaration.
5394         (Target_arm::Target_arm): Initialize new data members
5395         got_mod_index_offset_ and tls_base_symbol_defined_.
5396         (Target_arm::Relocate::relocate_tls): New method.
5397         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5398          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5399         New methods.
5400         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5401         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5402         (Target_arm::got_mod_index_offset_,
5403         Target_arm::tls_base_symbol_defined_): New data members.
5404         (Target_arm::Scan::local, Target::Scan::global,
5405         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5406         relocations.
5407
5408 2010-02-18  Doug Kwan  <dougkwan@google.com>
5409
5410         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5411         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5412         text section as a parameter becuase some broken tools may not set
5413         the link in section header.
5414         (Target_arm::has_got_section): New method.
5415         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5416         without any mapping symbol as data only.  Remove warning.
5417         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5418         link in its section header, try to discover the link by inspecting the
5419         REL31 relocation at the beginning of the section.
5420         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5421         in error message.
5422         (Target_arm::Scan::global): Treat any reference to the symbol
5423         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5424
5425 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5426
5427         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5428         (Scan::global_reloc_may_be_function_pointer): New function.
5429         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5430         (Scan::global_reloc_may_be_function_pointer): New function.
5431         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5432         (Scan::global_reloc_may_be_function_pointer): New function.
5433         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5434         (Scan::global_reloc_may_be_function_pointer): New function.
5435         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5436         (Scan::global_reloc_may_be_function_pointer): New function.
5437         (Scan::possible_function_pointer_reloc): New function.
5438         (Target_x86_64::can_check_for_function_pointers): New function.
5439         * gc.h (gc_process_relocs): Scan relocation types to determine if
5440         function pointers were taken for targets that support it.
5441         * icf.cc (Icf::find_identical_sections): Include functions for
5442         folding in safe ICF whose pointer is not taken.
5443         * icf.h (Secn_fptr_taken_set): New typedef.
5444         (fptr_section_id_): New member.
5445         (section_has_function_pointers): New function.
5446         (set_section_has_function_pointers): New function.
5447         (check_section_for_function_pointers): New function.
5448         * options.h: Fix comment for safe ICF option.
5449         * target.h (can_check_for_function_pointers): New function.
5450         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5451         Modify icf_safe_test for X86-64.
5452         * testsuite/Makefile.in: Regenerate.
5453         * testsuite/icf_safe_so_test.cc: New file.
5454         * testsuite/icf_safe_so_test.sh: New file.
5455         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5456         (main): Change to take pointer to function kept_func_3.
5457         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5458         folding is done correctly for X86-64.
5459
5460 2010-02-12  David S. Miller  <davem@davemloft.net>
5461
5462         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5463         is_symbolless parameter.
5464         (Output_reloc<SHT_REL>::is_symbolless): New.
5465         (Output_reloc<SHT_REL>::is_symbolless_): New.
5466         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5467         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5468         (Output_reloc<SHT_RELA>::is_symbolless): New.
5469         (Output_data_reloc::add_global): Handle is_symbolless.
5470         (Output_data_reloc::add_global_relative): Likewise.
5471         (Output_data_reloc::add_local): Likewise.
5472         (Output_data_reloc::add_local_relative): Likewise.
5473         (Output_data_reloc::add_symbolless_global_addend): New.
5474         (Output_data_reloc::add_symbolless_local_addend): New.
5475         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5476         is_symbolless.
5477         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5478         instead of ->is_relative_
5479         (Output_reloc::write): Likewise.
5480         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5481         (Output_reloc::write_rel): Simplify.
5482
5483         * sparc.cc (Target_sparc::Scan::local): Use
5484         ->add_symbolless_local_addend as needed.
5485         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5486         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5487         based upon relocation offset.
5488
5489 2010-02-11  Doug Kwan  <dougkwan@google.com>
5490
5491         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5492         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5493         beginning of function.
5494         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5495         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5496         parameter is_32bit in calls to should_apply_static_reloc.
5497         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5498         (check_DATA): Add arm_abs_global.stdout.
5499         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5500         arm_abs_global.stdout): New rules.
5501         (MOSTLLYCLEANFILES): Add arm_abs_global
5502         * Makefile.in: Regenerate.
5503         * testsuite/arm_abs_global.s: New file.
5504         * testsuite/arm_abs_global.sh: Ditto.
5505         * testsuite/arm_abs_lib.s: Ditto.
5506
5507 2010-02-11  Ian Lance Taylor  <iant@google.com>
5508
5509         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5510         Read_relocs task.
5511         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5512         Allocate_commons_task first.
5513         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5514         task, rather than symtab_lock_.
5515         (Gc_process_relocs::~Gc_process_relocs): New function.
5516         (Gc_process_relocs::is_runnable): Check this_blocker_.
5517         (Gc_process_relocs::locks): Use next_blocker_ rather than
5518         blocker_.
5519         (Scan_relocs::~Scan_relocs): New function.
5520         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5521         symtab_lock_.
5522         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5523         next_blocker_.
5524         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5525         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5526         constructor accordingly.
5527         (class Gc_process_relocs): Likewise.
5528         (class Scan_relocs): Likewise.
5529         * common.h (class Allocate_commons_task): Remove symtab_lock_
5530         field, and corresponding constructor parameter.
5531         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5532         symtab_lock_.
5533         (Allocate_commons_task::locks): Likewise.
5534
5535 2010-02-11  Ian Lance Taylor  <iant@google.com>
5536
5537         * gold-threads.h (class Once): Define.
5538         (class Initialize_lock): Rewrite as child of Once.
5539         * gold-threads.cc (class Once_initialize): Define.
5540         (once_pointer_control): New static variable.
5541         (once_pointer, once_arg): New static variables.
5542         (c_run_once): New static function.
5543         (Once::Once, Once::run_once, Once::internal_run): New functions.
5544         (class Initialize_lock_once): Remove.
5545         (initialize_lock_control): Remove.
5546         (initialize_lock_pointer): Remove.
5547         (initialize_lock_once): Remove.
5548         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5549         (Initialize_lock::initialize): Rewrite.
5550         (Initialize_lock::do_run_once): New function.
5551         * archive.cc (Archive::interpret_header): Only clear name if it is
5552         not already empty.
5553         * fileread.cc: Include "gold-threads.h"
5554         (file_counts_lock): New static variable.
5555         (file_counts_initialize_lock): Likewise.
5556         (File_read::release): Only increment counts when using --stats.
5557         Use a lock around the increment.
5558         * parameters.cc (class Set_parameters_target_once): Define.
5559         (set_parameters_target_once): New static variable.
5560         (Parameters::Parameters): Move here from parameters.h.
5561         (Parameters::set_target): Rewrite.
5562         (Parameters::set_target_once): New function.
5563         (Parameters::clear_target): Move here and rewrite.
5564         * parameters.h (class Parameters): Update declarations.  Add
5565         set_parameters_target_once_ field.
5566         (Parameters::Parameters): Move to parameters.cc.
5567         (Parameters::clear_target): Likewise.
5568         * readsyms.cc (Read_symbols::do_group): Create a Start_group
5569         task.
5570         (Start_group::~Start_group): New function.
5571         (Start_group::is_runnable): New function.
5572         (Start_group::locks, Start_group::run): New functions.
5573         (Finish_group::run): Change saw_undefined to size_t.
5574         * readsyms.h (class Start_group): Define.
5575         (class Finish_group): Change saw_undefined_ field to size_t.
5576         (Finish_group::Finish_group): Remove saw_undefined and
5577         this_blocker parameters.  Change all callers.
5578         (Finish_group::set_saw_undefined): New function.
5579         (Finish_group::set_blocker): New function.
5580         * symtab.h (class Symbol_table): Change saw_undefined to return
5581         size_t.  Change saw_undefined_ field to size_t.
5582         * target-select.cc (Set_target_once::do_run_once): New function.
5583         (Target_selector::Target_selector): Initialize set_target_once_
5584         field.  Don't initialize lock_ and initialize_lock_ fields.
5585         (Target_selector::instantiate_target): Rewrite.
5586         (Target_selector::set_target): New function.
5587         * target-select.h (class Set_target_once): Define.
5588         (class Target_selector): Update declarations.  Make
5589         Set_target_once a friend.  Remove lock_ and initialize_lock_
5590         fields.  Add set_target_once_ field.
5591
5592 2010-02-10  Ian Lance Taylor  <iant@google.com>
5593
5594         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5595         queueing any tasks.
5596         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
5597         (queue_middle_tasks): Add all blockers before queueing any tasks.
5598         (queue_final_tasks): Likewise.
5599         * token.h (Task_token::add_blockers): New function.
5600         * object.h (Input_objects::number_of_relobjs): New function.
5601
5602 2010-02-10  Ian Lance Taylor  <iant@google.com>
5603
5604         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5605         shared, not if not position independent.
5606         * x86_64.cc (Relocate::relocate_tls): Likewise.
5607         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5608         (tls_pie_pic_test): New target.
5609         * testsuite/Makefile.in: Rebuild.
5610
5611         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5612         (tls_test_main_pie.o, tls_test_pie.o): New targets.
5613         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5614         * testsuite/Makefile.in: Rebuild.
5615
5616 2010-02-09  David S. Miller  <davem@davemloft.net>
5617
5618         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5619         R_SPARC_RELATIVE using ->add_local_relative().
5620         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5621
5622         * output.h (Output_data_dynamic::add_section_size): New method
5623         that takes two Output_data objects.
5624         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5625         entry param.  Handle it in initializers.
5626         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5627         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5628         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5629         arg.
5630         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5631         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5632         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5633         for dynrel_includes_plt.
5634         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5635         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5636         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5637         before .rela.plt
5638         (Target_sparc::do_finalize_sections): Update to pass true for
5639         dynrel_includes_plt.
5640         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5641         output before .rela.plt
5642         (Target_powerpc::do_finalize_sections): Update to pass true for
5643         dynrel_includes_plt when 32-bit.
5644
5645 2010-02-08  Doug Kwan  <dougkwan@google.com>
5646
5647         * arm.cc (Arm_relobj::simple_input_section_output_address): New
5648         method.
5649         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5650         Arm_relobj::scan_section_for_cortex_a8_stubs,
5651         Arm_relobj::do_relocation_section): Instead of calling
5652         Output_section::output_address, use faster
5653         Arm_relobj::simple_input_section_output_address.
5654
5655 2010-02-08  David S. Miller  <davem@davemloft.net>
5656
5657         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5658         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5659         relocation helper function.
5660
5661         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5662         just like R_SPARC_GOT{10,13,22}.
5663         (Target_sparc::Scan::local): Likewise.
5664         (Target_sparc::Relocate:relocate): Likewise.
5665
5666 2010-02-06  Ian Lance Taylor  <iant@google.com>
5667
5668         * configure.ac: Rewrite targetobjs duplicate removal code to use
5669         only shell constructs.
5670         * configure: Rebuild.
5671
5672 2010-02-05  Doug Kwan  <dougkwan@google.com>
5673
5674         PR 11247
5675         * arm.cc (Arm_relobj::section_is_scannable): New method.
5676         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5677         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5678
5679 2010-02-04  Doug Kwan  <dougkwan@google.com>
5680
5681         PR 11247
5682         * arm-reloc-property.cc (cstdio): Include.
5683         * configure.ac (targetobjs): Remove duplicates.
5684         * configure: Regenerate.
5685         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5686         big and little endian version for a given address size.
5687
5688 2010-02-03  Doug Kwan  <dougkwan@google.com>
5689
5690         * arm-reloc-property.cc
5691         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5692         definition.
5693         * arm-reloc-property.h
5694         (Arm_reloc_property_table::get_implemented_static_reloc_property):
5695         New method definition.
5696         (Arm_reloc_property_table::reloc_name_in_error_message): New method
5697         declaration.
5698         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5699         overflow to N.
5700         (GOT_PREL): Change implemented to Y.
5701         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5702         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5703         (Arm_relocate_functions::movw_abs_nc): Remove method.
5704         (Arm_relocate_functions::movt_abs): Ditto.
5705         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5706         (Arm_relocate_functions::thm_movt_abs): Ditto.
5707         (Arm_relocate_functions::movw_rel_nc): Ditto.
5708         (Arm_relocate_functions::movw_rel): Ditto.
5709         (Arm_relocate_functions::movt_rel): Ditto.
5710         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5711         (Arm_relocate_functions:thm_movw_rel): Ditto.
5712         (Arm_relocate_functions:thm_movt_rel): Ditto.
5713         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5714         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5715         New method definitions.
5716         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5717         (Arm_relocation_functions::arm_grp_ldr): Ditto.
5718         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5719         (Arm_relocation_functions::arm_grp_ldc): Ditto.
5720         (Target_arm::Relocate::relocate): Check for non-static or
5721         unimplemented relocation code and exit early.  Change calls to
5722         Target_arm::reloc_uses_thumb_bit and
5723         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5724         instead.  Refactor code to handle similar relocations to increase
5725         code sharing.  Remove check for unsupported relocation code in switch
5726         statement.
5727         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5728         relocation property table to find out size.  Change error message to
5729         print out the name of a relocation code instead of the numeric value.
5730         (Target_arm::scan_reloc_for_stub): Use relocation property table
5731         instead of calling Target_arm::reloc_uses_thumb_bit().
5732
5733 2010-02-02  Doug Kwan  <dougkwan@google.com>
5734
5735         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5736         types of relaxed input section.
5737
5738 2010-02-02  Doug Kwan  <dougkwan@google.com>
5739
5740         * Makefile.am (HFILES): Add arm-reloc-property.h.
5741         (DEFFILES): New.
5742         (TARGETSOURCES): Add arm-reloc-property.cc
5743         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5744         (libgold_a_SOURCES): $(DEFFILES)
5745         * Makefile.in: Regenerate.
5746         * arm-reloc-property.cc: New file.
5747         * arm-reloc-property.h: New file.
5748         * arm-reloc.def: New file.
5749         * arm.cc: Update comments.
5750         (arm-reloc-property.h): New included header.
5751         (arm_reloc_property_table): New global variable.
5752         (Target_arm::do_select_as_default_target): New method definition.
5753         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5754         arm-reloc-property to targ_extra_obj.
5755         * parameters.cc (set_parameters_target): Call
5756         Target::select_as_default_target().
5757         * target.h (Target::select_as_default_target): New method definition.
5758         (Target::do_select_as_default_target): Same.
5759
5760 2010-02-01  Doug Kwan  <dougkwan@google.com>
5761
5762         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5763         first_output_text_section_.
5764         (Arm_exidx_fixup::first_output_text_section): New method definition.
5765         (Arm_exidx_fixup::first_output_text_section_): New data member.
5766         (Arm_exidx_fixup::process_exidx_section): Record the first text
5767         output section seen.
5768         (Arm_output_section::fix_exidx_coverage): Set correct linked section
5769         and entsize in output section header.
5770
5771 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5772
5773         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5774         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5775         (Arm_relocate_functions::thm_alu11): New Method.
5776         (Arm_relocate_functions::thm_pc8): New Method.
5777         (Arm_relocate_functions::thm_pc12): New Method.
5778         (Target_arm::Scan::local): Handle the relocations.
5779         (Target_arm::Scan::global): Likewise.
5780         (Target_arm::Relocate::relocate): Likewise.
5781         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5782
5783 2010-01-29  Doug Kwan  <dougkwan@google.com>
5784
5785         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5786         of relocation types as ld.
5787
5788 2010-01-29  Doug Kwan  <dougkwan@google.com>
5789
5790         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5791         to public.
5792         (Arm_relocate_functions::thumb_branch_common): Ditto.
5793         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5794         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5795         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5796         Arm_relocate_functions::jump24): Remove.
5797         (Target_arm::Relocate::relocate): Adjust code to call
5798         Arm_relocation_functions::arm_branch_common and
5799         Arm_relocation_functions::thumb_branch_common instead of their removed
5800         wrappers.  Merge switch-cases together to reduce source code size.
5801
5802 2010-01-29  Doug Kwan  <dougkwan@google.com>
5803
5804         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5805         output_local_symbol_count_needs_update_.
5806         (Arm_relobj::output_local_symbol_count_needs_update,
5807          Arm_relobj::set_output_local_symbol_count_needs_update,
5808          Arm_relobj::update_output_local_symbol_count): New methods.
5809         (Arm_relobj::output_local_symbol_count_needs_update_): New data
5810         member.
5811         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5812         of pointed function as in a R_ARM_PREL31 relocation.
5813         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5814         for output local symbol count updating.
5815         (Target_arm::do_relax): Update output local symbol counts in objects
5816         if necessary.
5817         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5818
5819 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5820
5821         * arm.cc: Added support for the ARM relocations:
5822         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5823         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5824         (Arm_relocate_functions::movw_rel_nc): Renamed (was
5825         movw_prel_nc).
5826         (Arm_relocate_functions::movw_rel): New method.
5827         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5828         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5829         thm_movw_prel_nc).
5830         (Arm_relocate_functions::thm_movw_rel): New method.
5831         (Arm_relocate_functions::thm_movt_rel): Renamed (was
5832         thm_movt_prel).
5833         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5834         relocations.
5835         (Target_arm::Scan::global): Likewise.
5836         (Target_arm::Relocate::relocate): Likewise.
5837         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5838         Likewise.
5839
5840 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5841
5842         * arm.cc: Added support for ARM group relocations.
5843         (Target_arm::reloc_needs_sym_origin): New method.
5844         (Arm_relocate_functions::calc_grp_kn): New method.
5845         (Arm_relocate_functions::calc_grp_residual): New method.
5846         (Arm_relocate_functions::calc_grp_gn): New method.
5847         (Arm_relocate_functions::arm_grp_alu): New Method.
5848         (Arm_relocate_functions::arm_grp_ldr): New Method.
5849         (Arm_relocate_functions::arm_grp_ldrs): New Method.
5850         (Arm_relocate_functions::arm_grp_ldc): New Method.
5851         (Target_arm::Scan::local): Handle the ARM group relocations.
5852         (Target_arm::Scan::global): Likewise.
5853         (Target_arm::Relocate::relocate): Likewise.
5854         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5855         Likewise.
5856
5857 2010-01-26  Doug Kwan  <dougkwan@google.com>
5858
5859         * arm.cc (set): Include.
5860         (class Arm_exidx_fixup): Change type of last_input_section_ to const
5861         pointer type.
5862         (Arm_output_section::Text_section_list): New type.
5863         (Arm_output_section::append_text_sections_to_list): New method.
5864         (Arm_output_section::fix_exidx_coverage): Ditto.
5865         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5866         (Arm_relobj::convert_input_section_to_relaxed_section): Use
5867         Relobj::set_section_offset() instead of
5868         Sized_relobj::invalidate_section_offset().
5869         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5870         parameter for section headers. Ignore relocation sections for
5871         unallocated sections and EXIDX sections.
5872         (Target_arm::fix_exidx_coverage): New method.
5873         (Target_arm::output_section_address_less_than): New type.
5874         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5875         linked text section instead of the EXIDX section.
5876         (Arm_output_section::create_stub_group): Add an assertion to check
5877         that this is not an EXIDX output section.
5878         (Arm_output_section::append_text_sections_to_list): New method.
5879         (Arm_output_section::fix_exidx_coverage): Ditto.
5880         (Arm_relobj::scan_sections_for_stubs): Adjust call to
5881         Arm_relobj::section_needs_reloc_stub_scanning.
5882         (Target_arm::do_relax): Fix EXIDX output section coverage in the
5883         first pass.
5884         (Target_arm::fix_exidx_coverage): New method.
5885         * object.h (Relobj::set_output_section): New method.
5886         (Sized_relobj::invalidate_section_offset): Remove method.
5887         (Sized_relobj::do_invalidate_section_offset): Remove method.
5888         (Sized_relobj::do_set_section_offset): Handle offset value -1.
5889
5890 2010-01-25  Doug Kwan  <dougkwan@google.com>
5891
5892         * arm.cc (Arm_exidx_merged_section::do_output_offset):
5893         Fix warning due to signed and unsigned comparison on a 32-bit host.
5894
5895 2010-01-22  Doug Kwan  <dougkwan@google.com>
5896
5897         * arm.cc (Target_arm::do_relax): Record an output section for section
5898         offset adjustment it contains any stub table that has changed.
5899         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5900         offsets in an output section if necessary.
5901         * output.cc (Output_section::Output_section): Initialize
5902         section_offsets_need_adjustments_.
5903         (Output_section::add_input_section_for_script): Renamed to
5904         Output_section::add_simple_input_section.
5905         (Output_section::save_states): Add a comment.
5906         (Output_section::discard_states): New method defintion.
5907         (Output_section::adjust_section_offsets): Same.
5908         * output.h (Output_section::add_input_section_for_script): Renamed to
5909         Output_section::add_simple_input_section.
5910         (Output_section::discard_states): New method declaration.
5911         (Output_section::adjust_section_offsets): Same.
5912         (Output_section::section_offsets_need_adjustment,
5913         Output_section::set_section_offsets_need_adjustment): New method
5914         definitions.
5915         (Output_section::section_offsets_need_adjustment_): New data member.
5916         * script-sections.cc
5917         (Output_section_element_input::set_section_address): Adjust code for
5918         renaming of Output_section::add_input_section_for_script.
5919         (Orphan_output_section::set_section_address): Same.
5920
5921 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5922
5923         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5924         Fix_v4bx enum values .
5925         * gold/options.h (General_options): New option definitions.
5926         (General_options::fix_v4bx): New method.
5927         (General_options::Fix_v4bx): New enum.
5928         * gold/options.cc (General_options::parse_fix_v4bx): New method.
5929         (General_options::parse_fix_v4bx_interworking): New method.
5930
5931 2010-01-22  Doug Kwan  <dougkwan@google.com>
5932
5933         * arm.cc (Arm_exidx_fixup): New class.
5934
5935 2010-01-21  Doug Kwan  <dougkwan@google.com>
5936
5937         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5938         classes.
5939         (Arm_exidx_section_offset_map): New type.
5940
5941 2010-01-21  Doug Kwan  <dougkwan@google.com>
5942
5943         * arm.cc (Arm_exidx_input_section): New class.
5944         (Arm_relobj::exidx_input_section_by_link,
5945         Arm_relobj::exidx_input_section_by_shndx,
5946         Arm_relobj::make_exidx_input_section): New methods.
5947         (read_arm_attributes_section): Remove.
5948         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5949         information about them.
5950         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5951         to here.
5952
5953 2010-01-20  Doug Kwan  <dougkwan@google.com>
5954
5955         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5956         Input_section_specifier to Section_id.
5957         (Target_arm::new_arm_input_section: Adjust code for change of key
5958         type.
5959         (Target_arm::find_arm_input_section): Ditto.
5960         * gc.h (object.h): Include for Section_id nand Section_id_hash.
5961         (Section_id): Remove.
5962         (Garbage_collection::Section_id_hash): Remove.
5963         * icf.h (object.h): Include for Section_id nand Section_id_hash.
5964         (Section_id): Remove.
5965         (Icf::Section_id_hash): Remove.
5966         * object.h (Section_id, Const_section_id, Section_id_hash,
5967         Const_section_id_hash): New type definitions.
5968         * output.cc (Output_section::add_relaxed_input_section): Change to
5969         use Const_section_id instead of Input_section_specifier as key type.
5970         (Output_section::add_merge_input_section): Ditto.
5971         (Output_section::build_relaxation_map): Change to use Section_id
5972         instead of Input_section_specifier as key type.
5973         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5974         Ditto.
5975         (Output_section::convert_input_sections_to_relaxed_sections): Change
5976         to use Const_section_id instead of Input_section_specifier as key type.
5977         (Output_section::find_merge_section): Ditto.
5978         (Output_section::find_relaxed_input_section): Ditto.
5979         * output.h (Input_section_specifier): Remove class.
5980         (Output_section::Output_section_data_by_input_section_map): Change
5981         key type to Const_section_id.
5982         (Output_section::Output_relaxed_input_section_by_input_section_map):
5983         Ditto.
5984         (Output_section::Relaxation_map): Change key type to Section_id.
5985
5986 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5987
5988         * gold/arm.cc: Added support for R_ARM_V4BX relocation
5989         (class Arm_v4bx_stub): New class.
5990         (DEF_STUBS): Updated definition to support v4_veneer_bx.
5991         (Stub_factory::make_arm_v4bx_stub): New method.
5992         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5993         (Stub_table::empty): Handle v4bx stubs.
5994         (Stub_table::add_arm_v4bx_stub): New method.
5995         (Stub_table::find_arm_v4bx_stub): New method.
5996         (Arm_relocate_functions::v4bx): New method.
5997         (Target_arm::fix_v4bx): New method.
5998         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5999         (Stub_table::relocate_stubs): Likewise.
6000         (Stub_table::do_write): Likewise.
6001         (Stub_table::update_data_size_and_addralign): Likewise.
6002         (Stub_table::finalize_stubs):  Likewise.
6003         (Target_arm::Scan::local): Likewise.
6004         (Target_arm::Scan::global): Likewise.
6005         (Target_arm::do_finalize_sections): Likewise.
6006         (Target_arm::Relocate::relocate): Likewise.
6007         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6008         Likewise.
6009         (Target_arm::scan_reloc_for_stub): Likewise.
6010         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6011
6012 2010-01-19  Ian Lance Taylor  <iant@google.com>
6013
6014         * output.cc (Output_section_headers::do_sized_write): Write large
6015         segment count to sh_info field.
6016         (Output_file_header::do_sized_write): For large segment count,
6017         write PN_XNUM to e_phnum field.
6018
6019 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6020
6021         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6022         (Arm_relocate_functions::thm_jump8): New function.
6023         (Arm_relocate_functions::thm_jump11): New function.
6024         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6025         R_ARM_THM_JUMP11.
6026         (Target_arm::Scan::global): Likewise.
6027         (Target_arm::Relocate::relocate): Likewise.
6028         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6029         Likewise.
6030
6031 2010-01-14  Doug Kwan  <dougkwan@google.com>
6032
6033         * arm.cc (map, utility): Include headers.
6034         (Target_arm::apply_cortex_a8_workaround): New method.
6035         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6036         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6037         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6038         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6039         the --[no-]fix-cortex-a8 command line options.
6040         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6041         (Target_arm::relocate_stub): Use addend in instruction template.
6042         * options.h (DEFINE_bool): Set the user-set flag.
6043         (General_options): Add --[no-]-fix-cortex options.
6044         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6045         : Update fast look-up map after conversion.
6046
6047 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6048
6049         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6050         in the first pass of do_layout.
6051
6052 2010-01-13  Doug Kwan  <dougkwan@google.com>
6053
6054         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6055         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6056         apparent compiler problem of not folding static constant integral
6057         data members of elfcpp::Elf_sizes<32>.
6058
6059 2010-01-13  Doug Kwan  <dougkwan@google.com>
6060
6061         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6062         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6063         Arm_relobj::scan_section_for_cortex_a8_erratum,
6064         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6065         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6066         sections to scan for relocation stubs into a new method
6067         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6068         relocation and Cortex-A8 stub scanning.
6069         (Target_arm::do_relax): Force stubs to be after stubbed sections
6070         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6071         the beginning of a new relaxation pass.  Update a comment.
6072         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6073
6074 2010-01-12  Ian Lance Taylor  <iant@google.com>
6075
6076         * target-reloc.h (visibility_error): New inline function.
6077         (relocate_section): Call visibility_error.
6078         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6079         (MOSTLYCLEANFILES): Likewise.
6080         (protected_4_pic.o, protected_3.err): New targets.
6081         * testsuite/protected_4.cc: New file.
6082
6083 2010-01-12  Doug Kwan  <dougkwan@google.com>
6084
6085         * arm.cc (Cortex_a8_reloc): New class.
6086         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6087         and cortex_a8_relocs_info_.
6088         (Target_arm::fix_cortex_a8): New method definition.
6089         (Target_arm::Cortex_a8_relocs_info): New type.
6090         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6091         New data member declarations.
6092         (Target_arm::scan_reloc_for_stub): Record information about
6093         relocations for THUMB branches that might be exempted from the
6094         Cortex-A8 workaround.
6095         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6096         at the beginning of a relaxation pass.
6097
6098 2010-01-12  Doug Kwan  <dougkwan@google.com>
6099
6100         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6101         (Arm_relobj::Mapping_symbol_position,
6102          Arm_reloj::Mapping_symbol_position_less,
6103          Arm_relobj::Mapping_symbols_info): New types.
6104         (Target_arm::is_mapping_symbol_name): New method definition.
6105         (Arm_relobj::do_count_local_symbols): Save information about mapping
6106         symbols.
6107
6108 2010-01-11  Doug Kwan  <dougkwan@google.com>
6109
6110         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6111         Arm_relocate_functions::thumb32_branch_upper,
6112         Arm_relocate_functions::thumb32_branch_lower,
6113         Arm_relocate_functions::thumb32_cond_branch_offset,
6114         Arm_relocate_functions::thumb32_cond_branch_upper,
6115         Arm_relocate_functions::thumb32_cond_branch_lower,
6116         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6117         branch offset encoding.
6118         (Arm_relocate_functions::thumb_branch_common): Use new branch
6119         offset encoding methods to avoid code duplication.
6120         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6121         (Stub_addend_reader::operator()): Use new branch encoding method
6122         to avoid code duplication.
6123
6124 2010-01-11  Doug Kwan  <dougkwan@google.com>
6125
6126         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6127         (Target_arm::do_finalize_sections): Define special EXIDX section
6128         symbols only if referenced.
6129         * gc.h (Garbage_collection::add_reference): New method.
6130         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6131         code duplication.
6132
6133 2010-01-11  Ian Lance Taylor  <iant@google.com>
6134
6135         * script.cc (Version_script_info::build_expression_list_lookup):
6136         Change complaing about duplicate wildcard match from error to
6137         warning.
6138
6139         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6140         of 2009-12-30.
6141         (Version_script_info::Version_script_info): Initialize globs_,
6142         default_version_, default_is_global_, and exact_.  Don't
6143         initialize globals_ or locals_.
6144         (Version_script_info::build_lookup_tables): Build local symbols
6145         first.
6146         (Version_script_info::unquote): New function.
6147         (Version_script_info::add_exact_match): New function.
6148         (Version_script_info::build_expression_list_lookup): Remove lookup
6149         parameter.  Add is_global parameter.  Change all callers.  Handle
6150         wildcard pattern specially.  Unquote pattern.  Call
6151         add_exact_match.
6152         (Version_script_info::get_name_to_match): New function.
6153         (Version_script_info::get_symbol_version): New function.
6154         (Version_script_info::get_symbol_version_helper): Remove.
6155         (Version_script_info::check_unmatched_names): Call unquote.
6156         * script.h (class Version_script_info): Change get_symbol_version
6157         to be non-inline and add is_global parameter; change all callers.
6158         Rewrite symbol_is_local.  Update declarations.  Define struct
6159         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6160         Remove globals_ and locals_ members.  Add exact_, globs_,
6161         default_version_, is_global_.
6162         (Version_script_info::Glob): Remove pattern, add expression and
6163         is_global.  Update constructor.  Change all callers.
6164         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6165         default version.
6166         (Versions::symbol_section_contents): If a symbol is undefined, or
6167         defined in a dynamic object, set the version index to
6168         VER_NDX_LOCAL.
6169         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6170         symbol_is_local.
6171         (Symbol_table::add_from_pluginobj): Likewise.
6172         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6173
6174 2010-01-11  Doug Kwan  <dougkwan@google.com>
6175
6176         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6177         (incremental_dump_LDADD): Add linking option for libintl.
6178         * Makefile.in: Regenerate.
6179
6180 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6181
6182         PR gold/11144
6183         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6184         instead of -Ds.
6185         * testsuite/Makefile.in: Regenerated.
6186
6187 2010-01-10  Doug Kwan  <dougkwan@google.com>
6188
6189         * options.h (DEFINE_var): Use parentheses around argument varname__
6190         in macro body to avoid any unintended subsequent substitutions.
6191
6192 2010-01-10  Ian Lance Taylor  <iant@google.com>
6193
6194         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6195         candidates before doing symbol resolution.
6196
6197         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6198         ODR candidates if only one is weak.
6199
6200 2010-01-08  Ian Lance Taylor  <iant@google.com>
6201
6202         * script.cc (Version_script_info::build_expression_list_lookup):
6203         Don't warn about ambiguous version, just record the ambiguity.
6204         (Version_script_info::get_symbol_version_helper): Give error if
6205         version is ambiguous.
6206
6207 2010-01-08  Doug Kwan  <dougkwan@google.com>
6208
6209         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6210           prev_data_size_ and prev_addralign_.  Remove initializer for
6211           deleted data member has_been_changed_.
6212           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6213           to determine if the table is empty.
6214           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6215           Remove.
6216           (Stub_table::add_reloc_stub): Define method in class definition
6217           instead of just declaring it there.
6218           (Stub_table::add_cortex_a8_stub): New method definition.
6219           (Stub_table::update_data_size_and_addralign): Ditto.
6220           (Stub_table::finalize_stubs): Ditto.
6221           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6222           (Stub_table::do_addralign_): Return address alignment in the
6223           (Stub_table::do_reset_address_and_file_offset): Define method in
6224           class definition instead of declaring it there.  Set current data
6225           size to be the data size of the previous pass.
6226           (Stub_table::set_final_data_size): Use current data size as the
6227           final data size.
6228           (Stub_table::relocate_stub): Change parameter type of stub from
6229           Reloc_stub pointer to Stub pointer.
6230           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6231           (Stub_table::Cortex_a8_stub_list): New typedef.
6232           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6233            Stub_table::prev_addralign_): New data member.
6234           (Arm_relobj::Arm_relobj): Initialize data member
6235           section_has_cortex_a8_workaround_.
6236           (Arm_relobj::section_has_cortex_a8_workaround,
6237            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6238            definitions.
6239           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6240           declarations.
6241           (Target_arm::relocate_stub): Change parameter type of stub from
6242           Reloc_stub pointer to Stub pointer.
6243           (Insn_template::size, Insn_template::alignment): Handle
6244           THUMB16_SPECIAL_TYPE.
6245           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6246            Stub_table::update_data_size_and_addralign,
6247            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6248           definitions.
6249           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6250           (Stub_table::do_write): Ditto.
6251           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6252
6253 2010-01-08  Ian Lance Taylor  <iant@google.com>
6254
6255         PR 11108
6256         * symtab.h (class Symbol): Remove fields is_target_special_ and
6257         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6258         (Symbol::is_defined_in_discarded_section): New function.
6259         (Symbol::set_is_defined_in_discarded_section): New function.
6260         (Symbol::has_plt_offset): Rewrite.
6261         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6262         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6263         Don't initialize is_target_special_ or has_plt_offset_.
6264         Initialize is_defined_in_discarded_section_.
6265         (Symbol_table::add_from_relobj): If appropriate, set
6266         is_defined_in_discarded_section.
6267         * resolve.cc (Symbol::override_base_with_special): Don't test
6268         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6269         * target-reloc.h (relocate_section): Do special handling for
6270         symbols defined in discarded sections for global symbols as well
6271         as local symbols.
6272
6273 2010-01-08  Ian Lance Taylor  <iant@google.com>
6274
6275         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6276         the SHT_SYMTAB case.
6277
6278 2010-01-08  Ian Lance Taylor  <iant@google.com>
6279
6280         * object.cc (Sized_relobj::do_layout): Don't get confused if
6281         layout_eh_frame returns NULL.
6282
6283 2010-01-08  Ian Lance Taylor  <iant@google.com>
6284
6285         PR 11084
6286         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6287         dynamic symbol table, use the normal symbol table.
6288         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6289         symbol table.
6290
6291 2010-01-08  Ian Lance Taylor  <iant@google.com>
6292
6293         PR 11072
6294         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6295         sections.
6296
6297 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6298
6299         * version.cc (print_version): Change to "Copyright 2010".
6300
6301 2010-01-08  Ian Lance Taylor  <iant@google.com>
6302
6303         PR 10287
6304         PR 11063
6305         * i386.cc (class Target_i386): Change return type of plt_section
6306         to be non-const.
6307         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6308         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6309         tls_desc_rel_ field.
6310         (Output_data_plt_i386::rel_tls_desc): New function.
6311         (Target_i386::rel_tls_desc_section): New function.
6312         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6313         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6314         R_386_TLS_DESC reloc in rel_tls_desc_section.
6315         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6316         Define struct Tlsdesc_info.
6317         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6318         (Target_x86_64::do_reloc_symbol_index): New function.
6319         (Target_x86_64::add_tlsdesc_info): New function.
6320         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6321         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6322         tlsdesc_rel_ field.
6323         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6324         all callers.
6325         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6326         (Target_x86_64::rela_tlsdesc_section): New function.
6327         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6328         handling.
6329         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6330         (Target_x86_64::do_reloc_addend): New function.
6331         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6332         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6333         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6334         (Output_reloc::type): New function.
6335         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6336         (Output_reloc::is_target_specific): New function.
6337         (Output_reloc::target_arg): New function.
6338         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6339         absolute relocs and target specific relocs.
6340         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6341         add_target_specific.
6342         (class Output_data_reloc) [SHT_RELA]: Likewise.
6343         * output.cc (Output_reloc::Output_reloc): Add four new versions
6344         for absolute relocs and target specific relocs.
6345         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6346         (Output_reloc::get_symbol_index): Likewise.
6347         (Output_reloc::local_section_offset): Check that local_sym_index_
6348         is not TARGET_CODE or 0.
6349         (Output_reloc::symbol_value): Likewise.
6350         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6351         reloc.
6352         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6353         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6354         functions.
6355         * layout.cc (add_target_dynamic_tags): Use output section for
6356         DT_PLTRELSZ and DT_JMPREL.
6357
6358 2010-01-07  Ian Lance Taylor  <iant@google.com>
6359
6360         PR 11061
6361         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6362         function.
6363         (class Output_data_reloc_generic): Define.
6364         (class Output_data_reloc_base): Change base class to
6365         Output_data_reloc_generic.  Change add() method to call
6366         bump_relative_reloc_count for a relative reloc.  Remove
6367         sort_relocs_ field.
6368         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6369         to sort_relocs().
6370         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6371         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6372         appropriate.
6373         * layout.h (class Layout): Update declaration.
6374
6375 2010-01-07  Ian Lance Taylor  <iant@google.com>
6376
6377         * output.h (class Output_data): Add const version of
6378         output_section and do_output_section.
6379         (class Output_section_data): Add const version of
6380         do_output_section.
6381         (class Output_section): Likewise.
6382         * layout.cc (Layout::add_target_dynamic_tags): New function.
6383         * layout.h (class Layout): Update declarations.
6384         * arm.cc (Target_arm::do_finalize_sections): Use
6385         add_target_dynamic_tags.
6386         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6387         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6388         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6389         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6390
6391 2010-01-07  Ian Lance Taylor  <iant@google.com>
6392
6393         PR 11042
6394         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6395         object as needed.
6396
6397 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6398             Ian Lance Taylor  <iant@google.com>
6399
6400         PR 11019
6401         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6402         Xindex::read_symtab_xindex.
6403
6404 2010-01-07  Doug Kwan  <dougkwan@google.com>
6405
6406         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6407         (Insn_template::thumb16_bcond_insn): New method declaration.
6408         (Insn_template): Fix spelling.
6409         (Stub::thumb16_special): New method declaration.
6410         (Stub::do_write): Define virtual method which was previously pure
6411         virtual.
6412         (Stub::do_thumb16_special): New method declaration.
6413         (Stub::do_fixed_endian_write): New template member.
6414         (Reloc_stub::do_write): Remove.
6415         (Reloc_stub::do_fixed_endian_write): Remove.
6416         (Cortex_a8_stub): New class definition.
6417         (Stub_factory::make_cortex_a8_stub): New method definition.
6418         (Stub_factory::Stub_factory): Add missing static storage class
6419         qualifier for elf32_arm_stub_a8_veneer_blx.
6420
6421 2010-01-07  Ian Lance Taylor  <iant@google.com>
6422
6423         PR 10980
6424         * options.h (class General_options): Add --warn-unresolved-symbols
6425         and --error-unresolved-symbols.
6426         * errors.cc (Errors::undefined_symbol): Implement
6427         --warn-unresolved-symbols.
6428
6429         * options.h (class General_options): Add -z text and -z textoff.
6430         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6431
6432 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6433
6434         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6435         (Garbage_collection::cident_sections): New function.
6436         (Garbage_collection::add_cident_section): New function.
6437         (Garbage_collection::cident_sections_): New member.
6438         (gc_process_relocs): Add references to sections whose names are C
6439         identifiers.
6440         * gold.h (cident_section_start_prefix): New constant.
6441         (cident_section_stop_prefix): New constant.
6442         (is_cident): New function.
6443         * layout.cc (Layout::define_section_symbols): Replace string constants
6444         with the newly defined constants.
6445         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6446         C identifiers.
6447         * testsuite/Makefile.am: Add gc_orphan_section_test.
6448         * testsuite/Makefile.in: Regenerate.
6449         * testsuite/gc_orphan_section_test.cc: New file.
6450         * testsuite/gc_orphan_section_test.sh: New file.
6451
6452 2010-01-06  Ian Lance Taylor  <iant@google.com>
6453
6454         PR 10980
6455         * options.h (class General_options): Add --warn-shared-textrel.
6456         * layout.cc (Layout::finish_dynamic_section): Implement
6457         --warn-shared-textrel.
6458
6459         PR 10980
6460         * options.h (class General_options): Add --warn-multiple-gp.
6461
6462 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6463
6464         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6465         $(THREADSLIB) and $(LIBDL).
6466         * Makefile.in: Rebuild.
6467
6468 2010-01-06  Ian Lance Taylor  <iant@google.com>
6469
6470         PR 10980
6471         * options.cc (General_options::parse_section_start): New function.
6472         (General_options::section_start): New function.
6473         (General_options::General_options): Initialize all members.
6474         * options.h: Include <map>
6475         (class General_options): Add --section-start.  Add section_starts_
6476         member.
6477         * layout.cc (Layout::attach_allocated_section_to_segment): If
6478         --section-start was used, set the address of the segment.  Remove
6479         local sort_sections.
6480         (Layout::relaxation_loop_body): If the address of the load segment
6481         has been set by --section-start, don't use it.
6482         * output.h (Output_segment::update_flags_for_output_section): New
6483         function.
6484         * output.cc (Output_segment::add_output_section): Call
6485         update_flags_for_output_section.
6486
6487 2010-01-05  Ian Lance Taylor  <iant@google.com>
6488
6489         PR 10980
6490         * options.h (class General_options): Add --undefined-version.
6491         * script.cc (struct Version_expression): Add was_matched_by_symbol
6492         field.
6493         (Version_script_info::matched_symbol): New function.
6494         (Version_script_info::get_symbol_version_helper): Call
6495         matched_symbol.
6496         (Version_script_info::check_unmatched_names): New function.
6497         * script.h (class Version_script_info): Update declarations.
6498         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6499
6500         * options.h (class General_options): Use DEFINE_bool_alias for
6501         allow_multiple_definition.
6502         * resolve.cc (Symbol_table::should_override): Don't test
6503         allow_multiple_definition.
6504
6505         PR 10980
6506         * options.h (class General_options): Add --cref.
6507         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6508         until after printing cref table.
6509         * cref.cc: Include "symtab.h".
6510         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6511         (Cref_table_compare::operator()): New function.
6512         (Cref_inputs::gather_cref): New function.
6513         (filecol): New static const.
6514         (Cref_inputs::print_cref): New function.
6515         (Cref::print_cref): New function.
6516         * cref.h: Include <cstdio>.
6517         (class Cref): Update declarations.
6518         * mapfile.h (Mapfile::file): New function.
6519         * object.h (class Object): Define Symbols.  Declare virtual
6520         do_get_global_symbols.
6521         (Object::get_global_symbols): New function.
6522         * object.cc (Input_objects::add_object): Pass object to cref_ if
6523         --cref.
6524         (Input_objects::archive_start): Likewise.
6525         (Input_objects::archive_stop): Likewise.
6526         (Input_objects::print_cref): New function.
6527         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6528         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6529         --cref.
6530         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6531         function.
6532         * plugin.h (class Sized_pluginobj): Update declarations.
6533
6534 2010-01-05  Ian Lance Taylor  <iant@google.com>
6535
6536         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6537         to is_default_version.  Rename insdef to insdefault.
6538         (Symbol_table::add_from_relobj): Rename def to is_default_version
6539         and local to is_forced_local.
6540         (Symbol_table::add_from_pluginobj): Likewise.
6541         (Symbol_table::add_from_dynobj): Likewise.
6542         (Symbol_table::define_special_symbol): Rename insdef to
6543         insdefault.
6544
6545 2010-01-04  Ian Lance Taylor  <iant@google.com>
6546
6547         PR 10980
6548         * options.h (class General_options): Add
6549         --allow-multiple-definition and -z muldefs.
6550         * resolve.cc (Symbol_table::should_override): Don't warn about a
6551         multiple symbol definition if --allow-multiple-definition or -z
6552         muldefs.
6553
6554         PR 10980
6555         * options.h (class General_options): Add --add-needed and
6556         --copy-dt-needed-entries.  Tweak --as-needed help entry.
6557         * object.cc (Input_objects::check_dynamic_dependencies): Give an
6558         error if --copy-dt-needed-entries aka --add-needed is used and
6559         would cause a change in behaviour.
6560
6561         PR 10980
6562         * options.h (class General_options): Add -G as a short version of
6563         --shared.  Add no-op options -assert, -g, and -i.
6564
6565 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
6566
6567         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6568         check for .text or .gnu.linkonce.t sections.
6569         * icf.cc (Icf::find_identical_sections): Ditto.
6570         Change the detection for mangled function name within the section
6571         name.
6572         * icf.h (is_section_foldable_candidate): New function.
6573
6574 2009-12-30  Ian Lance Taylor  <iant@google.com>
6575
6576         PR 10980
6577         * options.h (class General_options): Permit two dashes with
6578         --retain-symbols-file.
6579
6580 2009-12-30  Ian Lance Taylor  <iant@google.com>
6581
6582         PR 10979
6583         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6584         don't put the file header and segment headers in the text
6585         segment.
6586
6587         PR 10979
6588         * common.cc (Sort_commons::operator()): Stabilize sort when both
6589         entries are NULL.
6590         (Symbol_table::do_allocate_commons_list): When allocating common
6591         symbols, skip a symbol which is no longer common.
6592         * symtab.h (Symbol::is_common): Test whether the symbol comes from
6593         an object before checking its type.
6594         * testsuite/common_test_2.c: New file.
6595         * testsuite/common_test_3.c: New file.
6596         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6597         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6598         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6599         (common_test_2_pic.o, common_test_2.so): New targets.
6600         (common_test_3_pic.o, common_test_3.so): New targets.
6601         * testsuite/Makefile.in: Rebuild.
6602
6603         PR 10979
6604         * script.cc (read_input_script): If we see a new SECTIONS clause,
6605         and we have added an input section, give an error.
6606         * layout.h (class Layout): Add have_added_input_section function.
6607         Add have_added_input_section_ field.
6608         * layout.cc (Layout::Layout): Initialize
6609         have_added_input_section_.
6610         (Layout::layout): Set have_added_input_section_.
6611         (Layout::layout_eh_frame): Likewise.
6612
6613 2009-12-30  Ian Lance Taylor  <iant@google.com>
6614
6615         PR 10931
6616         * options.h (class General_options): Add --sort-common option.
6617         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6618         * common.cc (Sort_common): Add sort_order parameter to
6619         constructor.  Add sort_order_ field.
6620         (Sort_commons::operator): Check sort_order_.
6621         (Symbol_table::allocate_commons): Determine the sort order.
6622         (Symbol_table::do_allocate_commons): Add sort_order parameter.
6623         Change all callers.
6624         (Symbol_table::do_allocate_commons_list): Likewise.
6625
6626 2009-12-30  Ian Lance Taylor  <iant@google.com>
6627
6628         PR 10916
6629         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6630         symbols from this object, don't change the visibility of an
6631         undefined symbol.
6632         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6633
6634 2009-12-30  Ian Lance Taylor  <iant@google.com>
6635
6636         PR 10861
6637         * script.h (class Version_script_info): Define Language enum.
6638         Update declarations.  Define Glob, Exact, and Lookup types.  Add
6639         new fields globals_, locals_, and is_finalized_.
6640         * script.cc: Various formatting fixes.
6641         (class Parser_closure): Change language_stack_ from a vector of
6642         std::string to one of Version_script_info::Language.  Adjust all
6643         uses accordingly.
6644         (class Lazy_demangler): Remove.
6645         (struct Version_expression): Change language from std::string to
6646         Version_script_info::Language.
6647         (Version_script_info::Version_script_info): New function.
6648         (Version_script_info::~Version_script_info): Don't call clear.
6649         (Version_script_info::finalize): New function.
6650         (Version_script_info::build_lookup_tables): New function.
6651         (Version_script_info::build_expression_list_lookup): New
6652         function.
6653         (Version_script_info::get_symbol_version_helper): Rewrite to use
6654         lookup tables.
6655         (Version_script_info::print_expression_list): Adjust to use
6656         Version_script_info::Language.
6657         (script_push_lex_into_version_mode): Check that the version script
6658         has not been finalized.
6659         (version_script_push_lang): Change language string to
6660         Version_script_info::Language.
6661         * options.cc (Command_line::version_script): New function.
6662         * options.h (class General_options): Add finalize_dynamic_list
6663         function.  Change version_script from declaration to definition.
6664         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6665         * testsuite/version_script.map: Remove duplicate def of foo.
6666         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6667         version_script.map.
6668         * testsuite/Makefile.in: Rebuild.
6669
6670 2009-12-30  Ian Lance Taylor  <iant@google.com>
6671
6672         PR 10843
6673         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6674         if the input symbol index is 0, make the output symbol index 0.
6675
6676 2009-12-30  Ian Lance Taylor  <iant@google.com>
6677
6678         PR 10670
6679         * options.h (class General_options): Add -x/--discard-all.
6680         * object.cc (Sized_relobj::do_count_local_symbols): Handle
6681         --discard-all.  If the local symbol needs a dynamic entry, check
6682         that before handling --discard-locals.
6683
6684 2009-12-30  Ian Lance Taylor  <iant@google.com>
6685
6686         PR 10450
6687         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6688         flags to PF_R.
6689         (Output_segment::add_output_section): Don't change the flags if
6690         the type is PT_TLS.
6691
6692         PR 10450
6693         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6694         GNU hash table if they need a dynamic value.  Otherwise, don't add
6695         them if they are defined in a dynamic object or are forced local.
6696
6697 2009-12-29  Ian Lance Taylor  <iant@google.com>
6698
6699         PR 10450
6700         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6701         .gnu.hash table for a 32-bit target.
6702
6703         PR 10450
6704         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6705         regular and a dynamic object only needs a dynamic symbol table
6706         entry if it is externally visible.
6707
6708         PR 10450
6709         * i386.cc (class Target_i386): Initialize global_offset_table_ in
6710         constructor.  Add global_offset_table_ field.
6711         (Target_i386::got_section): Set global_offset_table_.
6712         (Target_i386::do_finalize_sections): Set global_offset_table_
6713         size.
6714         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6715         in constructor.  Add global_offset_table_ field.
6716         (Target_x86_64::got_section): Set global_offset_table_.
6717         (Target_x86_64::do_finalize_sections): Set global_offset_table_
6718         size.
6719
6720         * layout.cc (Layout::Layout): Initialize increase_relro_.
6721         (Layout::get_output_section): Add is_relro, is_last_relro, and
6722         is_first_non_relro parameters.  Change all callers.
6723         (Layout::choose_output_section): Likewise.
6724         (Layout::add_output_section_data): Likewise.
6725         (Layout::make_output_section): Likewise.
6726         (Layout::set_segment_offsets): Clear increase_relro when using a
6727         linker script.
6728         * layout.h (class Layout): Add increase_relro method.  Add
6729         increase_relro_ field.  Update declarations.
6730         * output.cc (Output_section::Output_section): Initialize
6731         is_last_relro_ and is_first_non_relro_.
6732         (Output_segment::add_output_section): Group relro sections is
6733         do_sort is true.  Handle is_last_relro and is_first_non_relro.
6734         (Output_segment::maximum_alignment): Remove relro handling.
6735         (Output_segment::set_section_addresses): Add increase_relro
6736         parameter.  Change all callers.  Add initial alignment to align
6737         relro sections on separate page.  Remove old relro handling.
6738         (Output_segment::set_section_list_addresses): Remove in_relro
6739         parameter.  Change all callers.
6740         (Output_segment::set_offset): Add increase parameter.  Change all
6741         callers.  Remove old relro handling.
6742         * output.h (class Output_section): Add new methods: is_last_relro,
6743         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6744         Add is_last_relro_ and is_first_non_relro_ fields.
6745         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6746         Create separate .got.plt section.  Call increase_relro.
6747         * x86_64.cc (Target_x86_64::got_section): Likewise.
6748         * testsuite/relro_script_test.t: Add .got.plt.
6749
6750         PR 10450
6751         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6752         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6753         (Layout::finalize): Call set_dynamic_symbol_size.
6754         (Layout::set_dynamic_symbol_size): New function.
6755         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
6756         set_dynamic_symbol_size.
6757
6758         PR 10450
6759         * output.h (class Output_section): Add is_entsize_zero_ field.
6760         * output.cc (Output_section::Output_section): Initialize
6761         is_entsize_zero_.
6762         (Output_section::set_entsize): If two different entsizes are
6763         requested, force it to zero.
6764         (Output_section::add_input_section): Set flags for .debug_str
6765         before updating section flags.  Set entsize.
6766         (Output_section::update_flags_for_input_section): Set SHF_MERGE
6767         and SHF_STRING if all input sections have those flags.
6768
6769 2009-12-29   Rafael Espindola  <espindola@google.com>
6770
6771         * main.cc (main): Fix the sys time reporting.
6772         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6773         reporting.
6774
6775 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
6776
6777         * options.cc (General_options::parse_version): Allow -v to exit
6778         without an error if there is nothing to link.
6779
6780 2009-12-29  Ian Lance Taylor  <iant@google.com>
6781
6782         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6783         using a version of gcc before 4.1.
6784         * configure: Rebuild.
6785
6786 2009-12-28  Chris Demetriou  <cgd@google.com>
6787
6788         * attributes.cc (Output_attributes_section_data::do_write): Use
6789         std::vector::front rather than std::vector::data.
6790
6791 2009-12-28  Ian Lance Taylor  <iant@google.com>
6792
6793         * symtab.h (class Symbol_table): Add enum Defined.
6794         * resolve.cc (Symbol_table::should_override): Add defined
6795         parameter.  Change all callers.  Test whether object is NULL
6796         before calling a method on it.
6797         (Symbol_table::report_resolve_problem): Add defined parameter.
6798         Change all callers.
6799         (Symbol_table::should_override_with_special): Likewise.
6800         * symtab.cc (Symbol_table::define_in_output_data): Add defined
6801         parameter.  Change all callers.
6802         (Symbol_table::do_define_in_output_data): Likewise.
6803         (Symbol_table::define_in_output_segment): Likewise.
6804         (Symbol_table::do_define_in_output_segment): Likewise.
6805         (Symbol_table::define_as_constant): Likewise.
6806         (Symbol_table::do_define_as_constant): Likewise.
6807         * script.h (class Symbol_assignment): Add is_defsym parameter to
6808         constructor; change all callers.
6809         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6810         parameter.  Change all callers.  Add is_defsym_ field.
6811         (class Parser_closure): Add parsing_defsym parameter to
6812         constructor; change all callers.  Add parsing_defsym accessor
6813         function.  Add parsing_defsym_ field.
6814
6815 2009-12-28  Ian Lance Taylor  <iant@google.com>
6816
6817         * gold.cc (queue_middle_tasks): Fix formatting.
6818         * object.cc (Relobj::is_section_name_included): Likewise.
6819
6820 2009-12-23  Ian Lance Taylor  <iant@google.com>
6821
6822         * i386.cc (Target_i386::do_calls_non_split): Recognize
6823         -fsplit-stack prologue for a function with a static chain.
6824         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6825         -fsplit-stack prologue when using %r11.
6826
6827 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
6828
6829         * options.cc (General_options::parse_version): Make -v continue and do
6830         the link like GNU ld does.
6831
6832 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
6833
6834         * Makefile.am (CCFILES): Add timer.cc.
6835         (HFILES): Add timer.h.
6836         * configure.ac: Check for sysconf and times.
6837         * main.cc: include timer.h.
6838         (main): Use Timer instead of get_run_time.
6839         * timer.cc: New.
6840         * timer.h: New.
6841         * workqueue.cc: include timer.h.
6842         (Workqueue::find_and_run_task):
6843         Report user, sys and wall time.
6844         * Makefile.in: Regenerate.
6845         * config.in: Regenerate.
6846         * configure: Regenerate.
6847
6848 2009-12-16  Doug Kwan  <dougkwan@google.com>
6849
6850         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6851         sections.
6852         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6853         relaxed input sections.
6854         * output.cc (Output_section::find_relaxed_input_section): Change
6855         return type to Output_relaxed_input_section pointer.  Adjust code
6856         for new type of relaxed_input_section_map_.
6857         * output.h (Output_section::find_relaxed_input_section): Change
6858         return type to Output_relaxed_input_section pointer.
6859         (Output_section::Output_relaxed_input_section_by_input_section_map):
6860         New type.
6861         (Output_section::relaxed_input_section_map_): Change type to
6862         Output_section::Output_relaxed_input_section_by_input_section_map.
6863         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6864         input section.
6865
6866 2009-12-15  Ian Lance Taylor  <iant@google.com>
6867
6868         * layout.cc (Layout::create_shstrtab): Only write out after input
6869         sections if we are compressing debug sections.
6870
6871 2009-12-15  Ian Lance Taylor  <iant@google.com>
6872
6873         * archive.cc (Archive::add_symbols): Only look up a symbol without
6874         a version if there is, in fact, a version.
6875
6876 2009-12-14  Ian Lance Taylor  <iant@google.com>
6877
6878         Revert -Wshadow changes, all changes from:
6879         2009-12-11  Doug Kwan  <dougkwan@google.com>
6880         2009-12-11  Nick Clifton  <nickc@redhat.com>
6881         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6882
6883 2009-12-11  Doug Kwan  <dougkwan@google.com>
6884
6885         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6886         due to -Wshadow.
6887         * attributes.cc (Object_attribute::size): Ditto.
6888         (Attributes_section_data::size): Ditto.
6889         (Attributes_section_data::Attributes_section_data): Ditto.
6890         (Output_attributes_section_data::do_write): Ditto.
6891         * attributes.h (Object_attribute::set_type): Ditto.
6892         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6893
6894 2009-12-11  Nick Clifton  <nickc@redhat.com>
6895
6896         * archive.cc: Fix shadowed variable warnings.
6897         * arm.cc: Likewise.
6898         * compressed_output.cc: Likewise.
6899         * compressed_output.h: Likewise.
6900         * configure: Likewise.
6901         * dwarf_reader.cc: Likewise.
6902         * dynobj.cc: Likewise.
6903         * dynobj.h: Likewise.
6904         * ehframe.cc: Likewise.
6905         * ehframe.h: Likewise.
6906         * errors.cc: Likewise.
6907         * expression.cc: Likewise.
6908         * fileread.cc: Likewise.
6909         * fileread.h: Likewise.
6910         * freebsd.h: Likewise.
6911         * i386.cc: Likewise.
6912         * icf.cc: Likewise.
6913         * incremental.h: Likewise.
6914         * layout.cc: Likewise.
6915         * layout.h: Likewise.
6916         * mapfile.cc: Likewise.
6917         * merge.cc: Likewise.
6918         * merge.h: Likewise.
6919         * object.cc: Likewise.
6920         * object.h: Likewise.
6921         * options.h: Likewise.
6922         * output.cc: Likewise.
6923         * output.h: Likewise.
6924         * parameters.cc: Likewise.
6925         * plugin.cc: Likewise.
6926         * powerpc.cc: Likewise.
6927         * reduced_debug_output.cc: Likewise.
6928         * reduced_debug_output.h: Likewise.
6929         * reloc.cc: Likewise.
6930         * reloc.h: Likewise.
6931         * resolve.cc: Likewise.
6932         * script-sections.cc: Likewise.
6933         * script.cc: Likewise.
6934         * script.h: Likewise.
6935         * sparc.cc: Likewise.
6936         * symtab.cc: Likewise.
6937         * symtab.h: Likewise.
6938         * target-select.cc: Likewise.
6939         * target-select.h: Likewise.
6940         * token.h: Likewise.
6941         * workqueue.cc: Likewise.
6942         * workqueue.h: Likewise.
6943         * x86_64.cc: Likewise.
6944
6945 2009-12-10  Doug Kwan  <dougkwan@google.com>
6946
6947         * arm.cc (attributes.h): New include.
6948         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6949         (Arm_relobj::~Arm_relobj): Delete object pointed by
6950         attributes_section_data_.
6951         (Arm_relobj::attributes_section_data): New method definition.
6952         (Arm_relobj::attributes_section_data_): New data member declaration.
6953         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6954         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6955         attributes_section_data_.
6956         (Arm_dynobj::attributes_section_data): New method definition.
6957         (Arm_dynobj::attributes_section_data_): New data member declaration.
6958         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
6959         initialization value of may_use_blx_ to false.
6960         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6961         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6962         object attributes to compute results instead of hard-coding.
6963         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6964         Target_arm::get_secondary_compatible_arch,
6965         Target_arm::set_secondary_compatible_arch
6966         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6967         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6968         New method declarations.
6969         (Target_arm::get_aeabi_object_attribute): New method definition.
6970         (Target_arm::attributes_section_data_): New data member declaration.
6971         (read_arm_attributes_section): New template definition.
6972         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6973         (Arm_dynobj::do_read_symbols): Ditto.
6974         (Target_arm::do_finalize_sections): Merge attributes sections from
6975         input.  Check for BLX use after attributes section merging.
6976         Fix __exidx_start and __exidx_end visibility.  Create an
6977         .ARM.attributes section if necessary.
6978         (Target_arm::get_secondary_compatible_arch,
6979         Target_arm::set_secondary_compatible_arch,
6980         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6981         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6982         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6983         New method definitions.
6984
6985 2009-12-09  Ian Lance Taylor  <iant@google.com>
6986
6987         * plugin.cc (Plugin::load): Don't cast from void* to a function
6988         pointer.
6989
6990 2009-12-09  Ian Lance Taylor  <iant@google.com>
6991
6992         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6993         information fields.
6994
6995 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
6996
6997         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6998         Replace two_file_shared_1.so with two_file_shared_2.so.
6999         * testsuite/Makefile.in: Regenerated.
7000
7001 2009-12-08  Doug Kwan  <dougkwan@google.com>
7002
7003         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7004         (HFILES): Add attributes.h and int_encoding.h.
7005         * Makefile.in: Regenerate.
7006         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7007         function definitions to int_encoding.cc
7008         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7009         prototypes to int_encoding.h
7010         * reduced_debug_output.cc (int_encoding.h): New include.
7011         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7012         function definitions to int_encoding.cc
7013         (insert_into_vector, read_from_pointer): Move template definitions to
7014         int_encoding.h
7015         * attributes.cc: New file.
7016         * attributes.h: New file.
7017         * int_encoding.cc: New file.
7018         * int_encoding.h: New file.
7019
7020 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7021
7022         PR gold/11055
7023         * incremental-dump.cc (dump_incremental_inputs): New.
7024         (main): Use dump_incremental_inputs.
7025
7026 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7027
7028         PR gold/10893
7029         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7030         checking elfcpp::STT_FUNC.
7031         (Target_i386::Relocate::relocate): Likewise.
7032         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7033
7034         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7035         symbols from shared libraries into normal FUNC symbols.
7036
7037         * symtab.h (Symbol): Add is_func and use it.
7038
7039 2009-12-05  Doug Kwan  <dougkwan@google.com>
7040
7041         * arm.cc (Target_arm::arm_info): Initialize new fields
7042         attributes_section and attributes_vendor.
7043         * i386.cc (Target_i386::i386_info): Same.
7044         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7045         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7046         fields attributes_section and attributes_vendor.
7047         * sparc.cc (Target_sparc::sparc_info): Same.
7048         * target.h (Target::attributes_section, Target::attributes_vendor,
7049         Target::is_attributes_section, Target::attribute_arg_type,
7050         Target::attributes_order): New method definitions.
7051         (Target::Target_info::attributes_section,
7052         Target::Target_info::attributes_vendor): New fields.
7053         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7054         virtual method definitions.
7055         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7056         attributes_section and attributes_vendor.
7057         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7058
7059 2009-12-05  Doug Kwan  <dougkwan@google.com>
7060
7061         * arm.cc: Update comments about interworking and stub generation.
7062         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7063         considered as non-PIC.
7064         (Arm_relocate_functions::base_abs): Fix formatting.
7065         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7066         of function to use GOT entry address instead of offset.
7067         (Target_arm::Scan::global): Issue an error if a symbol would need a
7068         PLT does not get one because it is untyped.  Remove code to create
7069         dynamic symbols for relative branches.
7070         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7071         takes unsigned integer instead of boolean.
7072
7073 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7074
7075         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7076         (two_file_test_LDADD): Likewise.
7077         (common_test_1_LDADD): Likewise.
7078         (exception_test_LDADD) Likewise.
7079         (weak_test_LDADD): Likewise.
7080         (many_sections_test_LDADD): Likewise.
7081         (initpri1_LDADD): Likewise.
7082         (script_test_1_LDADD): Likewise.
7083         (script_test_2_LDADD): Likewise.
7084         (justsyms_LDADD): Likewise.
7085         (binary_test_LDADD): Likewise.
7086         (large_LDADD): Likewise.
7087         * testsuite/Makefile.in: Regenerated.
7088
7089 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7090
7091         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7092         (Symbol_table::override_with_special): Likewise.
7093         (Symbol_table::add_from_object): Likewise.
7094
7095 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7096
7097         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7098         Don't set the data_offset twice.
7099
7100 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7101
7102         * testsuite/Makefile.in: Regenerate.
7103
7104 2009-12-03  Doug Kwan  <dougkwan@google.com>
7105
7106         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7107         (Target_arm::do_finalize_sections): Add parameter for symbol table
7108         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7109         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7110         parameter for symbol table pointer.
7111         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7112         an additional parameter for a pointer to symbol table.
7113         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7114         parameter for a symbol table pointer.
7115         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7116         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7117         Ditto.
7118         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7119         parameter for a symbol table pointer.
7120
7121 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7122
7123         * incremental.cc (Incremental_inputs_header)
7124         (Incremental_inputs_header_write, Incremental_inputs_entry)
7125         (Incremental_inputs_entry_write): Move ...
7126         * incremental.h (Incremental_inputs_header)
7127         (Incremental_inputs_header_write, Incremental_inputs_entry)
7128         (Incremental_inputs_entry_write): here.
7129
7130 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7131
7132         * incremental.cc (make_sized_incremental_binary): Set the target.
7133         Error if it is incompatible.
7134         * output.h (Output_file): Add filename method.
7135
7136 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7137
7138         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7139         from the get_* methods.
7140
7141 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7142
7143         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7144         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7145         Write 0 for the data_offset of scripts.
7146
7147 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7148
7149         * testsuite/Makefile.am: Add the incremental_test.sh test.
7150         * testsuite/incremental_test.sh: New.
7151         * testsuite/incremental_test_1.c: New.
7152         * testsuite/incremental_test_2.c: New.
7153
7154 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7155
7156        * incremental-dump.cc (main): Fix typos.
7157
7158 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7159
7160         PR gold/11025
7161         * incremental-dump.cc (main): Use llu to print 64 bit values.
7162
7163 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7164             H.J. Lu  <hongjiu.lu@intel.com>
7165
7166         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7167         $(LIBDL).
7168         (incremental_dump_LDADD): Likewise.
7169         * Makefile.in: Regenerated.
7170
7171 2009-11-25  Doug Kwan  <dougkwan@google.com>
7172
7173         Revert:
7174
7175         2009-11-25  Doug Kwan  <dougkwan@google.com>
7176
7177                 * arm.cc (Target_arm::Target_arm): Move method definition
7178                 outside of class definition.  Add code to handle
7179                 --target1-rel, --target1-abs and --target2= options.
7180                 (Target_arm::get_reloc_reloc_type): Change method to be
7181                 non-static and const.
7182                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7183                 New data member declaration.
7184                 (Target_arm::Scan::local, Target_arm::Scan::global,
7185                 Target_arm::Relocate::relocate,
7186                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7187                 Adjust call to Target_arm::get_real_reloc_type.
7188                 (Target_arm::get_real_reloc_type): Use command line options
7189                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7190                 * options.h (--target1-rel, --target1-abs, --target2): New
7191                 ARM-only options.
7192
7193 2009-11-25  Doug Kwan  <dougkwan@google.com>
7194
7195         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7196         class definition.  Add code to handle --target1-rel, --target1-abs
7197         and --target2= options.
7198         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7199         and const.
7200         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7201         member declaration.
7202         (Target_arm::Scan::local, Target_arm::Scan::global,
7203         Target_arm::Relocate::relocate,
7204         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7205         call to Target_arm::get_real_reloc_type.
7206         (Target_arm::get_real_reloc_type): Use command line options to
7207         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7208         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7209         options.
7210
7211 2009-11-25  Doug Kwan  <dougkwan@google.com>
7212
7213         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7214         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7215         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7216         formatting.
7217         (Arm_relocate_functions::thm_call): Replace body with a call to
7218         Arm_relocate_functions::thumb_branch_common.
7219         (Arm_relocate_functions::thm_jump24,
7220         Arm_relocate_functions::thm_xpc22): New method definitions.
7221         (Arm_relocate_functions::thumb_branch_common): New method definition.
7222         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7223         operator.
7224         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7225         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7226
7227 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7228
7229         * Makefile.am: Build incremental-dump
7230         * Makefile.in: Regenerate.
7231         * incremental-dump.cc: New.
7232         * incremental.cc (Incremental_inputs_header_data,
7233         Incremental_inputs_entry_data): Move to incremental.h
7234         * incremental.h: (Incremental_inputs_header_data,
7235         Incremental_inputs_entry_data): Move from incremental.cc
7236
7237 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7238
7239         * incremental.cc (Incremental_inputs_header,
7240         Incremental_inputs_header_write, Incremental_inputs_entry,
7241         Incremental_inputs_entry_write): Add a typedef with the data type.
7242
7243 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7244
7245         * incremental.cc (Incremental_inputs_header,
7246         Incremental_inputs_header_write, Incremental_inputs_entry,
7247         Incremental_inputs_entry_write): Update comment about which
7248         type has the filed descriptions.
7249
7250 2009-11-15  Doug Kwan  <dougkwan@google.com>
7251
7252         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7253         (Arm_relocate_functions::arm_branch_common): Change method defintion
7254         in class definition to a method declaration and update list of formal
7255         parameters.
7256         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7257         Arm_relocation_functions::jump24): Adjust call to
7258         Arm_relocate_functions::arm_branch_common.  Update list of formal
7259         parameters.
7260         (Arm_relocate_functions::xpc25): New method definition.
7261         (Arm_relocate_functions::arm_branch_common): Move method defintion
7262         out from class definition.  Use stubs for mode-switching and extending
7263         branch ranges.
7264         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7265         specially.  Change code to enable use of stubs in ARM branches.
7266
7267 2009-11-10  Doug Kwan  <dougkwan@google.com>
7268
7269         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7270         in method declaration.
7271         (Target_arm::relocate_stub): New method declaration.
7272         (Target_arm::default_target): Change to return a pointer instead of
7273         a const reference.
7274         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7275         Target_arm::default_target.
7276         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7277         method definition.
7278         (Target_arm::relocate_section): Adjust view.
7279         (Target_arm::relocate_stub): New method definition.
7280
7281 2009-11-10  Doug Kwan  <dougkwan@google.com>
7282
7283         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7284         a format warning.
7285         * incremental.cc (open_incremental_binary): Initialized local
7286         variables to avoid warnings.
7287         * object.cc (make_elf_object): Ditto.
7288         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7289         a format warning.
7290
7291 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7292
7293         PR gold/10930
7294         * testsuite/plugin_test.c: Include "config.h".
7295
7296 2009-11-09  Doug Kwan  <dougkwan@google.com>
7297
7298         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7299         (arm_symbol_value): Remove.
7300         (Arm_relocate_functions::arm_branch_common,
7301         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7302         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7303         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7304         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7305         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7306         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7307         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7308         Arm_relocate_functions::thm_mobw_abs_nc,
7309         Arm_relocate_functions::thm_mov_abs,
7310         Arm_relocate_functions::movw_prel_nc,
7311         Arm_relocate_functions::thm_movt_abs,
7312         Arm_relocate_functions::movt_prel,
7313         Arm_relocate_functions::thm_movw_prel_nc,
7314         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7315         (Target_arm::Relocate::relocate): Only decompose address into two
7316         parts if relocation type uses the thumb-bit and pass the actual
7317         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7318         calls to methods in Arm_relocate_functions for this change.
7319
7320 2009-11-08  Ian Lance Taylor  <iant@google.com>
7321
7322         PR 10925
7323         * reloc.cc: Instantiate
7324         Sized_relobj::initialize_input_to_output_maps and
7325         Sized_relobj:free_input_to_output_maps.
7326
7327 2009-11-06  Ian Lance Taylor  <iant@google.com>
7328
7329         PR 10876
7330         * defstd.cc (in_segment): Set only_if_ref true for "end".
7331
7332 2009-11-06  Doug Kwan  <dougkwan@google.com>
7333
7334         * arm.cc (class Reloc_stub): Correct a comment.
7335         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7336         (Target_arm::scan_section_for_stubs): New method declaration.
7337         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7338         Change methods from private to protected.
7339         (Target_arm::do_may_relax): New method definition.
7340         (Target_arm::do_relax, Target_arm::group_sections,
7341         Target_arm::scan_reloc_for_stub,
7342         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7343         (Target_arm::arm_input_section_map_): New data member declaration.
7344         (Target_arm::scan_reloc_for_stub,
7345         Target_arm::scan_reloc_section_for_stubs,
7346         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7347         Target_arm::do_relax): New method definitions.
7348
7349 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7350
7351         * configure.ac: Check for (struct stat)::st_mtim
7352         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7353         * config.in: Regenerate.
7354         * configure: Regenerate.
7355
7356 2009-11-05  Ian Lance Taylor  <iant@google.com>
7357
7358         PR 10910
7359         * output.cc (Output_segment::add_output_section): Add missing
7360         return statement.
7361
7362 2009-11-04  Ian Lance Taylor  <iant@google.com>
7363
7364         PR 10880
7365         * object.h (class Object): Add is_needed and set_is_needed
7366         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7367         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7368         defined in a dynamic object and referenced by a regular object,
7369         set is_needed for the dynamic object.
7370         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7371         if the file is marked with as_needed and it is not needed.
7372
7373 2009-11-04  Ian Lance Taylor  <iant@google.com>
7374
7375         PR 10887
7376         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7377         tags if data is discarded by linker script.
7378         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7379         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7380         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7381         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7382
7383 2009-11-04  Ian Lance Taylor  <iant@google.com>
7384
7385         * layout.cc (Layout::get_output_section): Add is_interp and
7386         is_dynamic_linker_section parameters.  Change all callers.
7387         (Layout::choose_output_section): Likewise.
7388         (Layout::make_output_section): Likewise.
7389         (Layout::add_output_section_data): Add is_dynamic_linker_section
7390         parameter.  Change all callers.
7391         * layout.h (class Layout): Update declarations.
7392         * output.h (class Output_section): Add is_interp, set_is_interp,
7393         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7394         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7395         generate_code_fills_at_write_ to a bitfield.
7396         * output.cc (Output_section::Output_sections): Initialize new
7397         fields.
7398         (Output_segment::add_output_section): Add do_sort parameter.
7399         Change all callers.
7400
7401 2009-11-03  Ian Lance Taylor  <iant@google.com>
7402
7403         PR 10860
7404         * options.h (class General_options): Add --warn-common.
7405         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7406         merging two common symbols.
7407         (Symbol_table::should_override): Handle --warn-common when merging
7408         a common symbol with a defined symbol.  Use report_resolve_problem
7409         for multiple definitions.
7410         (Symbol_table::report_resolve_problem): New function.
7411         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7412
7413 2009-11-03  Doug Kwan  <dougkwan@google.com>
7414
7415         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7416         stub_factory_.
7417         (Target_arm::stub_factory): New method definition.
7418         (Target_arm::new_arm_input_section,
7419         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7420         Target_arm::reloc_uses_thumb_bit): New method declarations.
7421         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7422         New type definitions.
7423         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7424         member declarations.
7425         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7426         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7427         New method definitions.
7428
7429 2009-11-03  Ian Lance Taylor  <iant@google.com>
7430
7431         * options.h (class General_options): Add --warn_constructors.
7432
7433 2009-11-03  Ian Lance Taylor  <iant@google.com>
7434
7435         PR 10893
7436         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7437         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7438
7439 2009-11-03  Ian Lance Taylor  <iant@google.com>
7440
7441         PR 10895
7442         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7443         --msgid-bugs-address.
7444         (install-pdf): New target.
7445         (install-data_yes): Look up one directory to find mkinstalldirs.
7446
7447 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7448
7449         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7450         tree.
7451
7452 2009-10-30  Doug Kwan  <dougkwan@google.com>
7453
7454         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7455
7456 2009-10-30  Doug Kwan  <dougkwan@google.com>
7457
7458         * arm.cc (Stub_addend_reader): New struct template definition
7459         and partial specializations.
7460         (Stub_addend_reader::operator()): New method definition for a
7461         partially specialized template.
7462
7463 2009-10-30  Doug Kwan  <dougkwan@google.com>
7464
7465         * arm.cc (Arm_relobj::processor_specific_flags): New method
7466         definition.
7467         (Arm_relobj::do_read_symbols): New method declaration.
7468         (Arm_relobj::processor_specific_flags_): New data member declaration.
7469         (Arm_dynobj): New class definition.
7470         (Target_arm::do_finalize_sections): Add input_objects parameter.
7471         (Target_arm::do_adjust_elf_header): New method declaration.
7472         (Target_arm::are_eabi_versions_compatible,
7473         (Target_arm::merge_processor_specific_flags): New method declaration.
7474         (Target_arm::do_make_elf_object): New overloaded method definitions
7475         and declaration.
7476         (Arm_relobj::do_read_symbols): New method definition.
7477         (Arm_dynobj::do_read_symbols): Ditto.
7478         (Target_arm::do_finalize_sections): Add input_objects parameters.
7479         Merge processor-specific flags from all input objects.
7480         (Target_arm::are_eabi_versions_compatible,
7481         Target_arm::merge_processor_specific_flags,
7482         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7483         New method definitions.
7484         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7485         Input_objects pointer type parameter.
7486         * layout.cc (Layout::finalize): Pass input objects to target's.
7487         finalize_sections function.
7488         * output.cc (Output_file_header::do_sized_write): Set ELF file
7489         header's processor-specific flags.
7490         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7491         Input_objects pointer type parameter.
7492         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7493         * target.h (Input_objects): New forward class declaration.
7494         (Target::processor_specific_flags,
7495         Target::are_processor_specific_flags_sect): New method definitions.
7496         (Target::finalize_sections): Add input_objects parameter.
7497         (Target::Target): Initialize processor_specific_flags_ and
7498         are_processor_specific_flags_set_.
7499         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7500         parameter.
7501         (Target::set_processor_specific_flags): New method definition.
7502         (Target::processor_specific_flags_,
7503         Target::are_processor_specific_flags_set_): New data member
7504         declarations.
7505         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7506         Input_objects pointer type parameter.
7507
7508 2009-10-30  Doug Kwan  <dougkwan@google.com>
7509
7510         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7511
7512 2009-10-28  Ian Lance Taylor  <iant@google.com>
7513
7514         * object.h (class Relobj): Drop options parameter from
7515         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7516         do_scan_relocs, do_relocate.  Change all callers.
7517         (class Sized_relobj): Drop options parameters from
7518         do_gc_process_relocs, do_scan_relocs, do_relocate,
7519         do_relocate_sections, relocate_sections, emit_relocs_scan,
7520         emit_relocs_scan_reltype.  Change all callers.
7521         (struct Relocate_info): Remove options field and all references to
7522         it.
7523         * reloc.h (class Read_relocs): Remove options constructor
7524         parameter and options_ field.  Change all callers.
7525         (class Gc_process_relocs, class Scan_relocs): Likewise.
7526         (class Relocate_task): Likewise.
7527         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7528         all callers.
7529         (scan_relocatable_relocs): Likewise.
7530         * target.h (class Sized_target): Remove options parameter from
7531         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7532         all callers.
7533         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7534         callers.
7535         * arm.cc: Update functions to remove options parameters.
7536         * i386.cc: Likewise.
7537         * powerpc.cc: Likewise.
7538         * sparc.cc: Likewise.
7539         * x86_64.cc: Likewise.
7540         * testsuite/testfile.cc: Likewise.
7541
7542 2009-10-28  Doug Kwan  <dougkwan@google.com>
7543
7544         * arm.cc (Arm_relobj): New class definition.
7545         (Arm_relobj::scan_sections_for_stubs,
7546         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7547         New method definitions.
7548
7549 2009-10-28  Cary Coutant  <ccoutant@google.com>
7550
7551         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7552         (Plugin::cleanup_done_): New member.
7553         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7554         (Plugin_manager::cleanup_done_): Remove.
7555         (Plugin_manager::add_input_file): Edit error message.
7556         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7557         (Plugin_manager::cleanup): Remove use of cleanup_done_.
7558
7559 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
7560
7561         * fileread.cc: (File_read::View::~View): Use the new
7562         data_ownership_ filed.
7563         (File_read::~File_read): Dispose the new whole_file_view_.
7564         (File_read::open): Mmap the whole file if needed.
7565         (File_read::open): Use whole_file_view_ instead of contents_.
7566         (File_read::find_view): Use whole_file_view_ if applicable.
7567         (File_read::do_read): Use whole_file_view_ instead of contents_.
7568         (File_read::make_view): Use whole_file_view_ instead of contents_,
7569         update File_read::View::View call.
7570         (File_read::find_or_make_view): Update File_read::View::View
7571         call.
7572         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7573         remove contents_
7574         (File_read::View::Data_ownership): New enum.
7575         (File_read::View::View): Replace bool mapped_ with Data_ownership
7576         argument.
7577         (File_read::View::mapped_): Remove (replaced by data_ownership_).
7578         (File_read::View::data_ownership_): New field.
7579         (File_read::contents_): Remove (replaced by whole_file_view_).
7580         (File_read::whole_file_view_): New field.
7581         * options.h (class General_options): Add --keep-files-mapped.
7582
7583 2009-10-27  Cary Coutant  <ccoutant@google.com>
7584
7585         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7586         * testsuite/Makefile.am (plugin_test_5): New test case.
7587         * testsuite/Makefile.in: Regenerate.
7588
7589 2009-10-25  Doug Kwan  <dougkwan@google.com>
7590
7591         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7592         from private to protected to allow access by child class.
7593         (Sized_relobj::do_relocate_sections): New method declaration.
7594         (Sized_relobj::relocate_sections): Virtualize.
7595         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7596         Sized_relobj::relocate_sections.  Instantiate template explicitly
7597         for different target sizes and endianity.
7598
7599 2009-10-24  Doug Kwan  <dougkwan@google.com>
7600
7601         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7602         (Arm_input_section::as_arm_input_section): New method.
7603         (Arm_output_section): New class definition.
7604         (Arm_output_section::create_stub_group,
7605         Arm_output_section::group_sections): New method definitions.
7606
7607 2009-10-22  Doug Kwan  <dougkwan@google.com>
7608
7609         * arm.cc (Arm_input_section): New class definition.
7610         (Arm_input_section::init, Arm_input_section:do_write,
7611         Arm_input_section::set_final_data_size,
7612         Arm_input_section::do_reset_address_and_file_offset): New method
7613         definitions.
7614
7615 2009-10-21  Doug Kwan  <dougkwan@google.com>
7616
7617         * arm.cc (Stub_table, Arm_input_section): New forward class
7618         declarations.
7619         (Stub_table): New class defintion.
7620         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7621         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7622         New method definition.
7623
7624 2009-10-21  Doug Kwan  <dougkwan@google.com>
7625
7626         * arm.cc: Update copyright comments.
7627         (Target_arm): New forward class template declaration.
7628         (Arm_address): New type.
7629         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7630         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7631         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7632         constants.
7633         (Insn_template): Same.
7634         (DEF_STUBS): New macro.
7635         (Stub_type): New enum type.
7636         (Stub_template): New class definition.
7637         (Stub): Same.
7638         (Reloc_stub): Same.
7639         (Stub_factory): Same.
7640         (Target_arm::Target_arm): Initialize may_use_blx_ and
7641         should_force_pic_veneer_.
7642         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7643         Target_arm::should_force_pic_veneer,
7644         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7645         Target_arm::using_thumb_only, Target_arm:;default_target): New
7646         method defintions.
7647         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7648         New data member declarations.
7649         (Insn_template::size, Insn_template::alignment): New method defintions.
7650         (Stub_template::Stub_template): New method definition.
7651         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7652         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7653         (Stub_factory::Stub_factory): New method definition.
7654         * gold.h (string_hash): New template.
7655         * output.h (Input_section_specifier::hash_value): Use
7656         gold::string_hash.
7657         (Input_section_specifier::string_hash): Remove.
7658         * stringpool.cc (Stringpool_template::string_hash): Use
7659         gold::string_hash.
7660
7661 2009-10-20  Doug Kwan  <dougkwan@google.com>
7662
7663         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7664         symbols of relaxed input sections.
7665         * output.h (Output_section::find_relaxed_input_section): Make
7666         method public.
7667
7668 2009-10-16  Doug Kwan  <dougkwan@google.com>
7669
7670         * dynobj.cc (Versions::Versions): Initialize version_script_.
7671         Only insert base version symbol definition for a shared object
7672         if version script defines any version versions.
7673         (Versions::define_base_version): New method definition.
7674         (Versions::add_def): Check that base version is not needed.
7675         (Versions::add_need): Define base version lazily.
7676         * dynobj.h (Versions::define_base_version): New method declaration.
7677         (Versions::needs_base_version_): New data member declaration.
7678         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7679         (check_DATA): Add no_version_test.stdout.
7680         (libno_version_test.so, no_version_test.o no_version_test.stdout):
7681         New make rules.
7682         * testsuite/Makefile.in: Regenerate.
7683         * testsuite/no_version_test.c: New file.
7684         * testsuite/no_version_test.sh: Ditto.
7685
7686 2009-10-16  Doug Kwan  <dougkwan@google.com>
7687
7688         * expression.cc (class Segment_start_expression): New class definition.
7689         (Segment_start_expression::value): New method definition.
7690         (script_exp_function_segment_start): Return a new
7691         Segment_start_expression.
7692         * gold/script-c.h (script_saw_segment_start_expression): New function
7693         prototype.
7694         * script-sections.cc (Script_sections::Script_sections): Initialize
7695         SAW_SEGMENT_START_EXPRESSION_ to false.
7696         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7697         and -Tbbs options to specify section addresses if given in
7698         command line and no SEGMENT_START expression is seen in a script.
7699         * script-sections.h (Script_sections::saw_segment_start_expression,
7700         Script_sections::set_saw_segment_start_expression): New method
7701         definition.
7702         (Script_sections::saw_segment_start_expression_): New data member
7703         declaration.
7704         * script.cc (script_saw_segment_start_expression): New function.
7705         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7706         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7707         script_test_7.sh and script_test_8.sh.
7708         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7709         script_test_8.stdout.
7710         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7711         (script_test_6, script_test_6.stdout, script_test_7,
7712         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7713         * Makefile.in: Regenerate.
7714         * testsuite/script_test_6.sh: New file.
7715         * testsuite/script_test_6.t: Same.
7716         * testsuite/script_test_7.sh: Same.
7717         * testsuite/script_test_7.t: Same.
7718         * testsuite/script_test_8.sh: Same.
7719
7720 2009-10-16  Doug Kwan  <dougkwan@google.com>
7721
7722         * output.cc (Output_segment::set_section_list_address): Cast
7723         expressions to unsigned long long type to avoid format warnings.
7724
7725 2009-10-15  Ian Lance Taylor  <iant@google.com>
7726
7727         * script.cc (Script_options::add_symbol_assignment): Always add a
7728         dot assignment to script_sections_.
7729         * script-sections.cc (Script_sections::add_dot_assignment):
7730         Initialize if necessary.
7731
7732         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7733         program headers with no load segment if there is a linker script.
7734
7735         * layout.cc (Layout::set_segment_offsets): Align the file offset
7736         to the segment aligment for -N or -n with no load segment.
7737         * output.cc (Output_segment::add_output_section): Don't crash if
7738         the first section is a TLS section.
7739         (Output_segment::set_section_list_addresses): Print an error
7740         message if the address moves backward in a linker script.
7741         * script-sections.cc
7742         (Output_section_element_input::set_section_addresses): Don't
7743         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7744         (Orphan_output_section::set_section_addresses): Likewise.
7745
7746 2009-10-15  Doug Kwan  <dougkwan@google.com>
7747
7748         * layout.cc (Layout::finish_dynamic_section): Generate tags
7749         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7750         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7751         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7752
7753 2009-10-14  Ian Lance Taylor  <iant@google.com>
7754
7755         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7756         fields.
7757         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7758         data_shdr fields of relinfo.
7759         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7760         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
7761         R_386_TLS_LDO_32, adjust based on section flags.
7762         (Target_i386::Relocate::fix_up_ldo): Remove.
7763
7764 2009-10-13  Ian Lance Taylor  <iant@google.com>
7765
7766         Add support for -pie.
7767         * options.h (class General_options): Add -pie and
7768         --pic-executable.
7769         (General_options::output_is_position_independent): Test -pie.
7770         (General_options::output_is_executable): Return true if not shared
7771         and not relocatable.
7772         (General_options::output_is_pie): Remove.
7773         * options.cc (General_options::finalize): Reject incompatible uses
7774         of -pie.
7775         * gold.cc (queue_middle_tasks): A -pie link is not static.
7776         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7777         * symtab.cc (Symbol::final_value_is_known): Return false if
7778         output_is_position_independent.
7779         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7780         output_is_position_independent.
7781         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7782         output_is_position_independent.
7783         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7784         output_is_position_independent.
7785         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7786         two_file_pie_test.
7787         (basic_pie_test.o, basic_pie_test): New targets.
7788         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7789         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7790         (two_file_pie_test): New target.
7791         * testsuite/Makefile.in: Rebuild.
7792         * README: Remove note saying that -pie is not supported.
7793
7794 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
7795
7796         * options.h (class General_options): Add -init and -fini.
7797         * layout.cc (Layout::finish_dynamic_section): Emit
7798         given init and fini functions.
7799
7800 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
7801
7802         * gc.h (gc_process_relocs): Check if icf is enabled using new
7803         function.
7804         * gold.cc (queue_initial_tasks): Likewise.
7805         (queue_middle_tasks): Likewise.
7806         * object.cc (do_layout): Likewise.
7807         * symtab.cc (is_section_folded): Likewise.
7808         * main.cc (main): Likewise.
7809         * reloc.cc (Read_relocs::run): Likewise.
7810         (Sized_relobj::do_scan_relocs): Likewise.
7811         * icf.cc (is_function_ctor_or_dtor): New function.
7812         (Icf::find_identical_sections): Check if function is ctor or dtor when
7813         safe icf is chosen.
7814         * options.h (General_options::icf): Change option to be an enum.
7815         (Icf_status): New enum.
7816         (icf_enabled): New method.
7817         (icf_safe_folding): New method.
7818         (set_icf_status): New method.
7819         (icf_status_): New variable.
7820         * (options.cc) (General_options::finalize): Set icf_status_.
7821         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7822         icf_test and icf_keep_unique_test to use the --icf enum flag.
7823         * testsuite/icf_safe_test.sh: New file.
7824         * testsuite/icf_safe_test.cc: New file.
7825
7826 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
7827
7828         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7829         includes to gc.h and icf.h.
7830         * arm.cc: Include gc.h.
7831         * gold.cc: Likewise.
7832         * i386.cc: Likewise.
7833         * powerpc.cc: Likewise.
7834         * sparc.cc: Likewise.
7835         * x86_64.cc: Likewise.
7836         * gc.h: Include icf.h.
7837
7838 2009-10-11  Ian Lance Taylor  <iant@google.com>
7839
7840         * plugin.cc: Include "gold.h" before other header files.
7841
7842 2009-10-10  Chris Demetriou  <cgd@google.com>
7843
7844         * options.h (Input_file_argument::Input_file_type): New enum.
7845         (Input_file_argument::is_lib_): Replace with...
7846         (Input_file_argument::type_): New member.
7847         (Input_file_argument::Input_file_argument): Take Input_file_type
7848         'type' rather than boolean 'is_lib' as second argument.
7849         (Input_file_argument::is_lib): Use type_.
7850         (Input_file_argument::is_searched_file): New function.
7851         (Input_file_argument::may_need_search): Handle is_searched_file.
7852         * options.cc (General_options::parse_library): Support -l:filename.
7853         (General_options::parse_just_symbols): Update for Input_file_argument
7854         changes.
7855         (Command_line::process): Likewise.
7856         * archive.cc (Archive::get_file_and_offset): Likewise.
7857         * plugin.cc (Plugin_manager::release_input_file): Likewise.
7858         * script.cc (read_script_file, script_add_file): Likewise.
7859         * fileread.cc (Input_file::Input_file): Likewise.
7860         (Input_file::will_search_for): Handle is_searched_file.
7861         (Input_file::open): Likewise.
7862         * readsyms.cc (Read_symbols::get_name): Likewise.
7863         * testsuite/Makefile.am (searched_file_test): New test.
7864         * testsuite/Makefile.in: Regenerate.
7865         * testsuite/searched_file_test.cc: New file.
7866         * testsuite/searched_file_test_lib.cc: New file.
7867
7868 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7869             Ian Lance Taylor  <iant@google.com>
7870
7871         * descriptor.cc: Include <cstdio> and "binary-io.h".
7872         (Descriptors::open): Open the files in binary mode always.
7873         * script.cc (Lex::get_token): Treat \r as whitespace.
7874
7875 2009-10-09  Ian Lance Taylor  <iant@google.com>
7876
7877         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7878
7879 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7880             Ian Lance Taylor  <iant@google.com>
7881
7882         * configure.ac: Check for readv function also.
7883         * fileread.cc (readv): Define if not HAVE_READV.
7884         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7885         does not exist.
7886         * config.in: Regenerate.
7887         * configure: Regenerate.
7888
7889 2009-10-09  Doug Kwan  <dougkwan@google.com>
7890
7891         * layout.cc (Layout::make_output_section): Call target hook to make
7892         ordinary output section.
7893         (Layout::finalize): Adjust parameter list of call the
7894         Target::may_relax().
7895         * layout.h (class Layout::section_list): New method.
7896         * merge.h (Output_merge_base::entsize): Change visibility to public.
7897         (Output_merge_base::is_string, Output_merge_base::do_is_string):
7898         New methods.
7899         (Output_merge_string::do_is_string): New method.
7900         * object.cc (Sized_relobj::do_setup): renamed from
7901         Sized_relobj::set_up.
7902         * object.h (Sized_relobj::adjust_shndx,
7903         Sized_relobj::initializ_input_to_output_maps,
7904         Sized_relobj::free_input_to_output_maps): Change visibilities to
7905         protected.
7906         (Sized_relobj::setup): Virtualize.
7907         (Sized_relobj::do_setup): New method declaration.
7908         (Sized_relobj::invalidate_section_offset,
7909         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7910         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7911         * options.cc (parse_int): New function.
7912         * options.h (parse_int): New declaration.
7913         (DEFINE_int): New macro.
7914         (stub_group_size): New option.
7915         * output.cc (Output_section::Output_section): Initialize memebers
7916         merge_section_map_, merge_section_by_properties_map_,
7917         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7918         (Output_section::add_input_section): Handled deferred code-fill
7919         generation and remove an old comment.
7920         (Output_section::add_relaxed_input_section): New method definition.
7921         (Output_section::add_merge_input_section): Use merge section by
7922         properties map to speed to search.  Update merge section maps
7923         as appropriate.
7924         (Output_section::build_relaxation_map): New method definition.
7925         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7926         Same.
7927         (Output_section::relax_input_section): Renamed to
7928         Output_section::convert_input_sections_to_relaxed_sections and change
7929         interface to take a vector of pointers to relaxed sections.
7930         (Output_section::find_merge_section,
7931         Output_section::find_relaxed_input_section): New method definitions.
7932         (Output_section::is_input_address_mapped,
7933         Output_section::output_offset, Output_section::output_address):
7934         Use output section data maps to speed up searching.
7935         (Output_section::find_starting_output_address): Add comments.
7936         (Output_section::do_write,
7937         Output_section::write_to_postprocessing_buffer): Do code-fill
7938         generation as appropriate.
7939         (Output_section::get_input_sections): Invalidate relaxed input section
7940         map.
7941         (Output_section::restore_states): Adjust type of checkpoint .
7942         Invalidate relaxed input section map.
7943         * output.h (Output_merge_base): New class declaration.
7944         (Input_section_specifier): New class defintion.
7945         (class Output_relaxed_input_section) Change base class to
7946         Output_section_data_build.
7947         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7948         base class initializer.
7949         (Output_section::add_relaxed_input_section): New method declaration.
7950         (Output_section::Input_section): Change visibility to protected.
7951         (Output_section::Input_section::relobj,
7952         Output_section::Input_section::shndx): Handle relaxed input sections.
7953         Output_section::input_sections) Change visibility to protected.  Also
7954         define overload to return a non-const pointer.
7955         (Output_section::Merge_section_properties): New class defintion.
7956         (Output_section::Merge_section_by_properties_map,
7957         Output_section::Output_section_data_by_input_section_map,
7958         Output_section::Relaxation_map): New types.
7959         (Output_section::relax_input_section): Rename method to
7960         Output_section::convert_input_sections_to_relaxed_sections and change
7961         interface to take a vector of relaxed section pointers.
7962         (Output_section::find_merge_section,
7963         Output_section::find_relaxed_input_section,
7964         Output_section::build_relaxation_map,
7965         Output_section::convert_input_sections_in_list_to_relaxed_sections):
7966         New method declarations.
7967         (Output_section::merge_section_map_
7968         Output_section::merge_section_by_properties_map_,
7969         Output_section::relaxed_input_section_map_,
7970         Output_section::is_relaxed_input_section_map_valid_,
7971         Output_section::generate_code_fills_at_write_): New data members.
7972         * script-sections.cc
7973         (Output_section_element_input::set_section_addresses): Call
7974         current_data_size and addralign methods of relaxed input sections.
7975         (Orphan_output_section::set_section_addresses): Call current_data_size
7976         and addralign methods of relaxed input sections.
7977         * symtab.cc (Symbol_table::compute_final_value): Extract template
7978         from the body of Symbol_table::sized_finalize_symbol.
7979         (Symbol_table::sized_finalized_symbol): Call
7980         Symbol_table::compute_final_value.
7981         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7982         (Symbol_table::compute_final_value): New templated method declaration.
7983         * target.cc (Target::do_make_output_section): New method defintion.
7984         * target.h (Target::make_output_section): New method declaration.
7985         (Target::relax): Add more parameters for input objects, symbol table
7986         and layout.  Adjust call to do_relax.
7987         (Target::do_make_output_section): New method declaration.
7988         (Target::do_relax): Add parameters for input objects, symbol table
7989         and layout.
7990
7991 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7992
7993         * pread.c: Include stdio.h.
7994
7995 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7996
7997         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7998         defined.
7999
8000 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8001
8002         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8003         Change read_shndx type to unsigned int.
8004         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8005         int.
8006         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8007         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8008         Change read_shndx type to unsigned int.
8009         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8010         int.
8011         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8012         * layout.cc (Layout::create_symtab_sections): Cast the result of
8013         local_symcount * symsize to off_t in the gold_assert.
8014
8015 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8016
8017         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8018         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8019         R_ARM_BASE_ABS.
8020         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8021         (Arm_relocate_functions::thm_abs5): New function.
8022         (Arm_relocate_functions::abs12): New function.
8023         (Arm_relocate_functions::abs16): New function.
8024         (Arm_relocate_functions::base_abs): New function.
8025         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8026         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8027         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8028         R_ARM_BASE_ABS.
8029         (Scan::global): Likewise.
8030         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8031         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8032         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8033         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8034         R_ARM_BASE_ABS.
8035
8036 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8037
8038         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8039         (Arm_relocate_functions::movt_prel): New function.
8040         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8041         (Arm_relocate_functions::thm_movt_prel): New function.
8042         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8043         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8044         (Scan::global, Relocate::relocate): Likewise.
8045         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8046
8047 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8048
8049         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8050         Incremental_checker.
8051         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8052         unsigned int.
8053         (class Incremental_inputs_header): New class.
8054         (Incremental_inputs_header_writer): Edit comment.
8055         (Incremental_inputs_entry): New class.
8056         (Incremental_inputs_entry_writer): Edit comment.
8057         (Sized_incremental_binary::do_find_incremental_inputs_section):
8058         Add *strtab_shndx parameter, fill it.
8059         (Sized_incremental_binary::do_check_inputs): New method.
8060         (Incremental_checker::can_incrementally_link_output_file): Use
8061         Sized_incremental_binary::check_inputs.
8062         (Incremental_inputs::report_command_line): Save command line in
8063         command_line_.
8064         * incremental.h:
8065         (Incremental_binary::find_incremental_inputs_section): New
8066         method.
8067         (Incremental_binary::do_find_incremental_inputs_section): Add
8068         strtab_shndx parameter.
8069         (Incremental_binary::do_check_inputs): New pure virtual method.
8070         (Sized_incremental_binary::do_check_inputs): Declare.
8071         (Incremental_checker::Incremental_checker): Add incremental_inputs
8072         parameter, use it to initialize incremental_inputs_.
8073         (Incremental_checker::incremental_inputs_): New field.
8074         (Incremental_checker::command_line): New method.
8075         (Incremental_checker::inputs): New method.
8076         (Incremental_checker::command_line_): New field.
8077
8078 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8079
8080         * incremental.cc: Include <cstdarg> and "target-select.h".
8081         (vexplain_no_incremental): New function.
8082         (explain_no_incremental): New function.
8083         (Incremental_binary::error): New method.
8084         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8085         method.
8086         (make_sized_incremental_binary): New function.
8087         (open_incremental_binary): New function.
8088         (can_incrementally_link_file): Add checks if output is ELF and has
8089         inputs section.
8090         * incremental.h: Include "elfcpp_file.h" and "output.h".
8091         (Incremental_binary): New class.
8092         (Sized_incremental_binary): New class.
8093         (open_incremental_binary): Declare.
8094         * object.cc (is_elf_object): Use
8095         elfcpp::Elf_recognizer::is_elf_file.
8096         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8097         * output.h (Output_file::filesize): New method.
8098
8099 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8100
8101         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8102         New function.
8103         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8104         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8105         function.
8106         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8107         function.
8108         (Arm_relocate_functions::movw_abs_nc): New function.
8109         (Arm_relocate_functions::movt_abs): New function.
8110         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8111         (Arm_relocate_functions::thm_movt_abs): New function.
8112         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8113         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8114         (Scan::global): Likewise.
8115         (Relocate::relocate): Likewise.
8116         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8117
8118 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8119
8120         * arm.cc (Arm_relocate_functions::got_prel) New function.
8121         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8122         (Relocate::relocate): Likewise.
8123         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8124
8125 2009-10-06  Ian Lance Taylor  <iant@google.com>
8126
8127         * options.h (class General_options): Define
8128         split_stack_adjust_size parameter.
8129         * object.h (class Object): Add uses_split_stack_ and
8130         has_no_split_stack_ fields.  Add uses_split_stack and
8131         has_no_split_stack accessor functions.  Declare
8132         handle_split_stack_section.
8133         (class Reloc_symbol_changes): Define.
8134         (class Sized_relobj): Define Function_offsets.  Declare
8135         split_stack_adjust, split_stack_adjust_reltype, and
8136         find_functions.
8137         * object.cc (Object::handle_split_stack_section): New function.
8138         (Sized_relobj::do_layout): Call handle_split_stack_section.
8139         * dynobj.cc (Sized_dynobj::do_layout): Call
8140         handle_split_stack_section.
8141         * reloc.cc (Sized_relobj::relocate_sections): Call
8142         split_stack_adjust for executable sections in split_stack
8143         objects.  Pass reloc_map to relocate_section.
8144         (Sized_relobj::split_stack_adjust): New function.
8145         (Sized_relobj::split_stack_adjust_reltype): New function.
8146         (Sized_relobj::find_functions): New function.
8147         * target-reloc.h: Include "object.h".
8148         (relocate_section): Add reloc_symbol_changes parameter.  Change
8149         all callers.
8150         * target.h (class Target): Add calls_non_split method.  Declare
8151         do_calls_non_split virtual method.  Declare match_view and
8152         set_view_to_nop.
8153         * target.cc: Include "elfcpp.h".
8154         (Target::do_calls_non_split): New function.
8155         (Target::match_view): New function.
8156         (Target::set_view_to_nop): New function.
8157         * gold.cc (queue_middle_tasks): Give an error if mixing
8158         split-stack and non-split-stack objects with -r.
8159         * i386.cc (Target_i386::relocate_section): Add
8160         reloc_symbol_changes parameter.
8161         (Target_i386::do_calls_non_split): New function.
8162         * x86_64.cc (Target_x86_64::relocate_section): Add
8163         reloc_symbol_changes parameter.
8164         (Target_x86_64::do_calls_non_split): New function.
8165         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8166         parameter.
8167         * powerpc.cc (Target_powerpc::relocate_section): Add
8168         reloc_symbol_changes parameter.
8169         * sparc.cc (Target_sparc::relocate_section): Add
8170         reloc_symbol_changes parameter.
8171         * configure.ac: Call AM_CONDITIONAL for the default target.
8172         * configure: Rebuild.
8173         * testsuite/Makefile.am (TEST_AS): New variable.
8174         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8175         (check_DATA): Add split_i386 and split_x86_64 files.
8176         (SPLIT_DEFSYMS): Define.
8177         (split_i386_[1234n].o): New targets.
8178         (split_i386_[124]): New targets.
8179         (split_i386_[1234r].stdout): New targets.
8180         (split_x86_64_[1234n].o): New targets.
8181         (split_x86_64_[124]): New targets.
8182         (split_x86_64_[1234r].stdout): New targets.
8183         (MOSTLYCLEANFILES): Add new executables.
8184         * testsuite/split_i386.sh: New file.
8185         * testsuite/split_x86_64.sh: New file.
8186         * testsuite/split_i386_1.s: New file.
8187         * testsuite/split_i386_2.s: New file.
8188         * testsuite/split_i386_3.s: New file.
8189         * testsuite/split_i386_4.s: New file.
8190         * testsuite/split_i386_n.s: New file.
8191         * testsuite/split_x86_64_1.s: New file.
8192         * testsuite/split_x86_64_2.s: New file.
8193         * testsuite/split_x86_64_3.s: New file.
8194         * testsuite/split_x86_64_4.s: New file.
8195         * testsuite/split_x86_64_n.s: New file.
8196         * testsuite/testfile.cc (Target_test): Update relocation_section
8197         function.
8198         * testsuite/Makefile.in: Rebuild.
8199
8200 2009-10-06  Ian Lance Taylor  <iant@google.com>
8201
8202         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8203         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8204         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8205         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8206         the address on ldo_addrs_.
8207         (Target_i386::Relocate::fix_up_ldo): New function.
8208
8209 2009-10-06   Rafael Espindola  <espindola@google.com>
8210
8211         * plugin.cc (add_input_library): New.
8212         (Plugin::load): Add add_input_library to tv.
8213         (Plugin_manager::add_input_file): Add the is_lib argument.
8214         (add_input_file): Update call to Plugin_manager::add_input_file.
8215         (add_input_library): New.
8216         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8217
8218 2009-09-30  Doug Kwan  <dougkwan@google.com>
8219
8220         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8221         symbol and call Symbol::may_need_copy_reloc to determine if
8222         a copy reloc is needed.
8223         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8224         nocopyreloc is given in command line.
8225         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8226         given in command line.
8227         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8228         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8229         of the removed Target_i386::may_need_copy_reloc.
8230         * options.h (copyreloc): New option with default value false.
8231         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8232         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8233         instead of the removed Target_powerpc::may_need_copy_reloc.
8234         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8235         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8236         instead of the removed Target_sparc::may_need_copy_reloc.
8237         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8238         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8239         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8240         instead of the removed Target_x86_64::may_need_copy_reloc.
8241
8242 2009-09-30  Ian Lance Taylor  <iant@google.com>
8243
8244         * object.h (class Object): Remove target_ field, and target,
8245         sized_target, and set_target methods.
8246         (Object::sized_target): Remove.
8247         (class Sized_relobj): Update declarations.  Remove sized_target.
8248         * object.cc (Sized_relobj::setup): Remove target parameter.
8249         Change all callers.
8250         (Input_objects::add_object): Don't do anything with the target.
8251         (make_elf_sized_object): Add punconfigured parameter.  Change all
8252         callers.  Set or test parameter target.
8253         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8254         Change all callers.
8255         * parameters.cc (Parameters::set_target): Change parameter type to
8256         be non-const.
8257         (Parameters::default_target): Remove.
8258         (set_parameters_target): Change parameter type to be non-const.
8259         (parameters_force_valid_target): New function.
8260         (parameters_clear_target): New function.
8261         * parameters.h (class Parameters): Update declarations.  Remove
8262         default_target method.  Add sized_target and clear_target
8263         methods.  Change target_ to be non-const.
8264         (set_parameters_target): Update declaration.
8265         (parameters_force_valid_target): Declare.
8266         (parameters_clear_target): Declare.
8267         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8268         as NULL if we aren't searching.
8269         (Add_symbols::run): Don't check for compatible target.
8270         * fileread.cc (Input_file::open_binary): Call
8271         parameters_force_valid_target.
8272         * gold.cc (queue_middle_tasks): Likewise.
8273         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8274         set_target on object.
8275         * dynobj.h (class Sized_dynobj): Update declarations.
8276         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8277         make_elf_object returns NULL.
8278         (Archive::include_member): Don't check whether object target is
8279         compatible.
8280         * output.cc (Output_section::add_input_section): Get target from
8281         parameters.
8282         (Output_section::relax_input_section): Likewise.
8283         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8284         parameters.
8285         (Sized_relobj::do_scan_relocs): Likewise.
8286         (Sized_relobj::relocate_sections): Likewise.
8287         * resolve.cc (Symbol_table::resolve): Likewise.
8288         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8289         parameter.  Change all callers.
8290         (Symbol_table::add_from_object): Get target from parameters.
8291         (Symbol_table::add_from_relobj): Don't check object target.
8292         (Symbol_table::add_from_dynobj): Likewise.
8293         (Symbol_table::define_special_symbol): Get target from
8294         parameters.
8295         * symtab.h (class Symbol_table): Update declaration.
8296         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8297         parameter.  Change all callers.  Clear parameter target.
8298         (Binary_test): Test target here.
8299         * testsuite/object_unittest.cc (gold_testsuite): Remove
8300         target_test_pointer parameter.  Change all callers.
8301         (Object_test): Test target here.
8302
8303 2009-09-26  Ian Lance Taylor  <iant@google.com>
8304
8305         * testsuite/initpri1.c: Don't try to use constructor priorities if
8306         compiling with gcc before 4.3.
8307
8308 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8309
8310         * testsuite/retain_symbols_file_test.sh (check_present): Change
8311         output file name to retain_symbols_file_test.stdout.
8312         (check_absent): Likewise.
8313
8314 2009-09-18  Craig Silverstein  <csilvers@google.com>
8315
8316         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8317         * options.cc: Include <cerrno> and <fstream>.
8318         (General_options::finalize): Parse -retain-symbols-file tag.
8319         * options.h: New flag.
8320         (General_options): New method should_retain_symbol, new
8321         variable symbols_to_retain.
8322         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8323         should_retain_symbol map.
8324         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8325         * testsuite/Makefile.in: Regenerate.
8326         * testsuite/retain_symbols_file_test.sh: New file.
8327
8328 2009-09-18  Nick Clifton  <nickc@redhat.com>
8329
8330         * po/es.po: Updated Spanish translation.
8331
8332 2009-09-17  Doug Kwan  <dougkwan@google.com>
8333
8334         * debug.h (DEBUG_RELAXATION): New constant.
8335         (DEBUG_ALL): Add DEBUG_RELAXATION.
8336         (debug_string_to_enum): Add relaxation debug option.
8337         * layout.cc
8338         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8339         Layout::Relaxation_debug_check::read_sections,
8340         Layout::Relaxation_debug_check::read_sections): New method definitions.
8341         (Layout::Layout): Initialize data members
8342         record_output_section_data_from_scrips_,
8343         script_output_section_data_list_ and relaxation_debug_check_.
8344         (Layout::save_segments, Layout::restore_segments,
8345         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8346         Layout::relaxation_loop_body): New method definitions.
8347         (Layout::finalize): Support relaxation.  Move section layout code to
8348         Layout::relaxation_loop_body.
8349         (Layout::set_asection_address_from_script): Move code for orphan
8350         section placement out.
8351         (Layout::place_orphan_sections_in_script): New method definition.
8352         * layout.h (Output_segment_headers, Output_file_header):
8353         New forward class declarations.
8354         (Layout::~Layout): Define.
8355         (Layout::new_output_section_data_from_script): New method definition.
8356         (Layout::place_orphan_sections_in_script): New method declaration.
8357         (Layout::Segment_states): New type declaration.
8358         (Layout::save_segments, Layout::restore_segments,
8359         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8360         Layout::relaxation_loop_body): New method declarations.
8361         (Layout::Output_section_data_list): New type declaration.
8362         (Layout::Relaxation_debug_check): New class definition.
8363         (Layout::record_output_section_data_from_script_,
8364         Layout::script_output_section_data_list_, Layout::segment_states_,
8365         Layout::relaxation_debug_check_): New data members.
8366         * output.cc: (Output_section_headers::do_size): New method definition.
8367         (Output_section_headers::Output_section_headers): Move size
8368         computation to Output_section_headers::do_size.
8369         (Output_segment_headers::do_size): New method definition.
8370         (Output_file_header::Output_file_header): Move size computation to
8371         Output_file_header::do_size and call it.
8372         (Output_file_header::do_size): New method definition.
8373         (Output_data_group::Output_data_group): Adjust call to
8374         Output_section_data.
8375         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8376         (Output_symtab_xindex::do_write): Add array bound check.
8377         (Output_section::Input_section::print_to_mapfile): Handle
8378         RELAXED_INPUT_SECTION_CODE.
8379         (Output_section::Output_section): Initialize data member checkpoint_.
8380         (Output_section::~Output_section): Delete checkpoint object pointed
8381         by checkpoint_.
8382         (Output_section::add_input_section): Always add an Input_section if
8383         relaxing.
8384         (Output_section::add_merge_input_section): Add assert.
8385         (Output_section::relax_input_section): New method definition.
8386         (Output_section::set_final_data_size): Set load address to zero for
8387         an unallocated section.
8388         (Output_section::do_address_and_file_offset_have_reset_values):
8389         New method definition.
8390         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8391         Handle relaxed input section.
8392         (Output_section::sort_attached_input_sections): Checkpoint input
8393         section list lazily.
8394         (Output_section::get_input_sections): Change type of input_sections to
8395         list of Simple_input_section pointers.  Checkpoint input section list
8396         lazily.  Also handle relaxed input sections.
8397         (Output_section::add_input_section_for_script): Take a reference to
8398         a Simple_input_section object instead of Relobj pointer and section
8399         index as parameter.  Handle relaxed input sections.
8400         (Output_section::save_states, Output_section::restore_states): New
8401         method definitions.
8402         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8403         (Output_data::is_data_size_fixed): New method definition.
8404         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8405         if it is fixed.
8406         (Output_data::address_and_file_offset_have_reset_values): New method
8407         definition.
8408         (Output_data::do_address_and_file_offset_have_reset_values): New method
8409         definition.
8410         (Output_data::set_data_size): Check that data size is not fixed.
8411         (Output_data::fix_data_size): New method definition.
8412         (Output_data::is_data_size_fixed_): New data member.
8413         (Output_section_headers::set_final_data_size): New method definition.
8414         (Output_section_headers::do_size): New method declaration.
8415         (Output_segment_headers::set_final_data_size): New method definition.
8416         (Output_segment_headers::do_size): New method declaration.
8417         (Output_file_header::set_final_data_size)::New method definition.
8418         (Output_file_header::do_size)::New method declaration.
8419         (Output_section_data::Output_section_data): Add new parameter
8420         is_data_size_fixed and use it to fix data size.
8421         (Output_data_const::Output_data_const): Adjust call to base class
8422         constructor and fix data size.
8423         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8424         base class constructor and fix data size.
8425         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8426         base class constructor and fix data size.
8427         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8428         class constructor and fix data size.
8429         (Output_data_group::set_final_data_size): New method definition.
8430         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8431         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8432         class constructor and fix data size.
8433         (Output_relaxed_input_section): New class definition.
8434         (Output_section::Simple_input_section): New class definition.
8435         (Output_section::get_input_sections): Adjust parameter list.
8436         (Output_section::add_input_section_for_script): Same.
8437         (Output_section::save_states, Output_section::restore_states,
8438         Output_section::do_address_and_file_offset_have_reset_values,
8439         (Output_section::Input_section::Input_section): Handle
8440         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8441         Output_relaxed_input_section.
8442         (Output_section::Input_section::is_input_section,
8443         Output_section::Input_section::set_output_section): Handle relaxed
8444         input section.
8445         (Output_section::Input_section::is_relaxed_input_section,
8446         Output_section::Input_section::output_section_data,
8447         Output_section::Input_section::relaxed_input_section): New method
8448         definitions.
8449         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8450         value.
8451         (Output_section::Input_section::u1_): Update comments.
8452         (Output_section::Input_section::u2_): Add new union member poris.
8453         (Output_section::Checkpoint_output_section): New classs definition.
8454         (Output_section::relax_input_section): New method declaration.
8455         (Output_section::checkpoint_): New data member.
8456         (Output_segment): Update comments.
8457         (Output_segment::Output_segment): Un-privatize copy constructor.
8458         (Output_segment::operator=): Un-privatize.
8459         * script-sections.cc (Output_section_element::Input_section_list):
8460         Change element type to Output_section::Simple_input_section.
8461         (Output_section_element_dot_assignment::set_section_addresses):
8462         Register output section data for relaxation clean up.
8463         (Output_data_exression::Output_data_expression): Adjust call to base
8464         constructor to fix data size.
8465         (Output_section_element_data::set_section_addresses): Register
8466         Output_data_expression object for relaxation clean up.
8467         (struct Input_section_info): Replace Relobj pointer and section index
8468         pair with Output_section::Simple_input_section and Convert struct to a
8469         class.
8470         (Input_section_sorter::operator()): Adjust access to
8471         Input_section_info data member to use accessors.
8472         (Output_section_element_input::set_section_addresses): Use layout
8473         parameter.  Adjust code to use Output_section::Simple_input_section
8474         and Input_secction_info classes.  Register filler for relaxation
8475         clean up.
8476         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8477         and section index pair with Output_section::Simple_input_section
8478         class.  Adjust code accordingly.
8479         (Phdrs_element::release_segment): New method definition.
8480         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8481         segment list.
8482         (Script_sections::release_segments): New method definition.
8483         * gold/script-sections.h (Script_sections::release_segments): New
8484         method declaration.
8485         * gold/target.h (Target::may_relax, Target::relax,
8486         Target::do_may_relax, Target::do_relax): New method definitions.
8487
8488 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8489
8490         * arm.cc (has_signed_unsigned_overflow): New function.
8491         (Arm_relocate_functions::abs8): New function.
8492         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8493         (Target_arm::Scan::global): Likewise.
8494         (Target_arm::relocate::relocate): Likewise.
8495         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8496         Likewise.
8497
8498 2009-09-16  Cary Coutant  <ccoutant@google.com>
8499
8500         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8501         * testsuite/Makefile.in: Regenerate.
8502
8503 2009-09-11  Nick Clifton  <nickc@redhat.com>
8504
8505         * po/gold.pot: Updated by the Translation project.
8506
8507 2009-09-08  Cary Coutant  <ccoutant@google.com>
8508
8509         * output.cc (Output_file::open): Add execute permission to empty file.
8510         * testsuite/Makefile.am (permission_test): New test.
8511         * testsuite/Makefile.in: Regenerate.
8512
8513 2009-09-02  Ian Lance Taylor  <iant@google.com>
8514
8515         * output.cc (Output_file::resize): Call map_no_anonymous rather
8516         than map.
8517
8518 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8519
8520         * gold.cc: Include "incremental.h".
8521         (queue_initial_tasks): Call Incremental_checker methods.
8522         * incremental.cc: Include "output.h".
8523         (Incremental_checker::can_incrementally_link_output_file): New
8524         method.
8525         * incremental.h (Incremental_checker): New class.
8526
8527         * output.cc (Output_file::open_for_modification): New method.
8528         (Output_file::map_anonymous): Changed return type to bool.  Record
8529         map in base_ field.
8530         (Output_file::map_no_anonymous): New method, broken out of map.
8531         (Output_file::map): Use map_no_anonymous and map_anonymous.
8532         * output.h (class Output_file): Update declarations.
8533
8534 2009-08-24  Cary Coutant  <ccoutant@google.com>
8535
8536         * options.h (Command_line::Pre_options): New class.
8537         (Command_line::pre_options): New member.
8538         * options.cc (gold::options::ready_to_register): New variable.
8539         (One_option::register_option): Do nothing if not registering options.
8540         Assert if same short option registered twice.
8541         (General_options::General_options): Turn off option registration when
8542         done constructing.
8543         (Command_line::Pre_options::Pre_options): New constructor.
8544
8545 2009-08-24  Cary Coutant  <ccoutant@google.com>
8546
8547         * options.h (General_options::no_keep_memory): Remove incorrect
8548         short option.
8549
8550 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8551
8552         * Makefile.am (am__skiplex, am__skipyacc): New.
8553         * Makefile.in: Regenerate.
8554
8555 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8556
8557         * Makefile.am (AM_CPPFLAGS): Renamed from ...
8558         (INCLUDES): ... this.
8559         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8560         (AM_CPPFLAGS): Renamed from ...
8561         (INCLUDE): ... this.
8562         * Makefile.in, testsuite/Makefile.in: Regenerate.
8563
8564         * Makefile.in: Regenerate.
8565         * aclocal.m4: Likewise.
8566         * config.in: Likewise.
8567         * configure: Likewise.
8568         * testsuite/Makefile.in: Likewise.
8569
8570         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8571         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8572         * Makefile.in: Regenerate.
8573         * testsuite/Makefile.in: Regenerate.
8574
8575 2009-08-19  Cary Coutant  <ccoutant@google.com>
8576
8577         * resolve.cc (Symbol_table::resolve): Don't complain about defined
8578         symbols in shared libraries overridden by hidden or internal symbols
8579         in the main program.
8580
8581 2009-08-19  Chris Demetriou  <cgd@google.com>
8582
8583         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8584         checking source file names in error messages.
8585
8586 2009-08-18  Doug Kwan  <dougkwan@google.com>
8587
8588         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8589         an elcpp::Ehdr as parameter.  Adjust call to set_target.
8590         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8591         an elfcpp::Ehdr as parameter.
8592         * object.cc (Object::set_target): Remove the version that looks up
8593         a target and sets it.
8594         (Sized_relobj::setup): Take a Target object instead of
8595         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
8596         (make_elf_sized_object): Find target and ask target to
8597         make an ELF object.
8598         * object.h: (Object::set_target): Remove the version that looks up
8599         a target and sets it.
8600         (Sized_relobj::setup): Take a Target object instead of
8601         an elfcpp:Ehdr as parameter.
8602         * target.cc: Include dynobj.h.
8603         (Target::do_make_elf_object_implementation): New.
8604         (Target::do_make_elf_object): New.
8605         * target.h (Target::make_elf_object): New template declaration.
8606         (Target::do_make_elf_object): New method declarations.
8607         (Target::do_make_elf_object_implementation): New template declaration.
8608
8609 2009-08-14  Ian Lance Taylor  <iant@google.com>
8610
8611         * gold.h (FUNCTION_NAME): Define.
8612         (gold_unreachable): Use FUNCTION_NAME.
8613
8614 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8615
8616         * icf.cc (Icf::find_identical_sections): Issue a warning when a
8617         symbol in the --keep-unique list is not found.
8618
8619 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
8620
8621         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8622         been maked as --keep-unique.
8623         (Icf::unfold_section): New function.
8624         * icf.h (Icf::unfold_section): New function.
8625         * options.h (General_options::keep_unique): New option.
8626         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8627         * testsuite/Makefile.in: Regenerate.
8628         * testsuite/icf_keep_unique_test.sh: New file.
8629         * testsuite/icf_keep_unique_test.cc: New file.
8630
8631 2009-08-12  Cary Coutant  <ccoutant@google.com>
8632
8633         PR 10471
8634         * resolve.cc (Symbol_table::resolve): Check for references from
8635         dynamic objects to hidden and internal symbols.
8636         * testsuite/Makefile.am (hidden_test.sh): New test.
8637         * testsuite/Makefile.in: Regenerate.
8638         * testsuite/hidden_test.sh: New script.
8639         * testsuite/hidden_test_1.c: New test source.
8640         * testsuite/hidden_test_main.c: New test source.
8641
8642 2009-08-11  Doug Kwan  <dougkwan@google.com>
8643
8644         * arm.cc: Update comments.
8645         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8646         segment to locate the .ARM.exidx section if present.
8647
8648 2009-08-09  Doug Kwan  <dougkwan@google.com>
8649
8650         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8651         patch.
8652
8653 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
8654         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8655         compiler warnings.
8656
8657 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
8658
8659         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8660         valid tls_segment only for non-debug-section relocations.
8661         * testsuite/Makefile.am: Add gc_tls_test.
8662         * testsuite/Makefile.in: Regenerate.
8663         * testsuite/gc_tls_test.cc: New file.
8664         * testsuite/gc_tls_test.sh: New file.
8665
8666 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
8667
8668         * icf.cc: New file.
8669         * icf.h: New file.
8670         * Makefile.am (CCFILES): Add icf.cc.
8671         (HFILES): Add icf.h
8672         * Makefile.in: Regenerate.
8673         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8674         * gc.h (gc_process_relocs): Populate lists used by icf to contain
8675         section, symbol and addend information for the relocs.
8676         * gold.cc (queue_middle_tasks): Call identical code folding.
8677         * gold.h: Add defines for multimap.
8678         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8679         to the call of finalize_local_symbols.
8680         * main.cc (main): Create object of class Icf.
8681         * object.cc (Sized_relobj::do_layout): Allow this function to be
8682         called twice during icf.
8683         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8684         to sections marked as identical by icf.
8685         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8686         when available.
8687         (Sized_relobj::do_section_entsize): New function.
8688         * object.h (Object::section_entsize): New function.
8689         (Object::do_section_entsize): New pure virtual function.
8690         (Relobj::finalize_local_symbols): Add new parameter.
8691         (Relobj::do_section_entsize): New function.
8692         * options.h (General_options::icf): New option.
8693         (General_options::icf_iterations): New option.
8694         (General_options::print_icf_sections): New option.
8695         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8696         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8697         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8698         icf.
8699         * symtab.cc (Symbol_table::is_section_folded): New function.
8700         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
8701         to sections marked as identical by icf.
8702         * symtab.h (Symbol_table::set_icf): New function.
8703         (Symbol_table::icf): New function.
8704         (Symbol_table::is_section_folded): New function.
8705         (Symbol_table::icf_): New data member.
8706         * target-reloc.h (relocate_section): Ignore sections folded by icf.
8707         * testsuite/Makefile.am: Add commands to build icf_test.
8708         * testsuite/Makefile.in: Regenerate.
8709         * testsuite/icf_test.sh: New file.
8710         * testsuite/icf_test.cc: New file.
8711
8712 2009-07-24  Chris Demetriou  <cgd@google.com>
8713
8714         * layout.cc (is_compressible_debug_section): Fix incorrect
8715         comment about compressed section names.
8716
8717 2009-07-20  Ian Lance Taylor  <ian@airs.com>
8718
8719         PR 10419
8720         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8721
8722 2009-07-16  Ian Lance Taylor  <iant@google.com>
8723
8724         PR 10400
8725         * layout.h: #include <map>.
8726         (class Kept_section): Change from struct to class.  Add accessors
8727         and setters.  Add section size to Comdat_group mapping.  Change
8728         Comdat_group to std::map.  Add is_comdat_ field.  Add
8729         linkonce_size field in union.
8730         (class Layout): Update declaration of find_or_add_kept_section.
8731         Don't declare find_kept_object.
8732         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8733         parameter.  Add object, shndx, is_comdat, and is_group_name
8734         parameters.  Change all callers.  Adjust for new Kept_section.
8735         (Layout::find_kept_object): Remove.
8736         * object.cc (Sized_relobj::include_section_group): Update use of
8737         Kept_section.  Rename secnum to shndx.  Only record
8738         Kept_comdat_section if sections are the same size.
8739         (Sized_relobj::include_linkonce_section): Update use of
8740         Kept_section.  Only record Kept_comdat_section if sections are the
8741         same size.  Set size of linkonce section.
8742         (Sized_relobj::map_to_kept_section): Update call to
8743         get_kept_comdat_section.
8744         * object.h (class Sized_relobj): Rename fields in
8745         Kept_comdat_section to drop trailing underscores; change object
8746         field to Relobj*.  Change Kept_comdat_section_table to store
8747         struct rather than pointer.
8748         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8749         Add kept_object and kept_shndx parameters.  Change all callers.
8750         (Sized_relobj::get_kept_comdat_section): Change return type to
8751         bool.  Add kept_object and kept_shndx parameters.  Change all
8752         callers.
8753         * plugin.cc (Pluginobj::include_comdat_group): Update call to
8754         Layout::find_or_add_kept_section.
8755
8756 2009-07-09  Ian Lance Taylor  <iant@google.com>
8757
8758         * merge.cc (Object_merge_map::initialize_input_to_output_map):
8759         Reserve space in the hash table.
8760
8761 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
8762
8763         * fileread.cc (File_read::get_mtime): New method.
8764         * fileread.h (Timespec): New structure.
8765         (File_read::get_mtime): New method.
8766         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8767         Renamed from timestamp_nsec.
8768         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8769         Elf_Xword.
8770         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8771         timestamp_nsec.
8772         (Incremental_inputs::report_archive): Save mtime; style fix.
8773         (Incremental_inputs::report_obejct): Save mtime; style fix.
8774         (Incremental_inputs::report_script): Save mtime; style fix.
8775         (Incremental_inputs::finalize_inputs): Style fix.
8776         (Incremental_inputs::finalize): Style fix.
8777         (Incremental_inputs::create_input_section_data): Store inputs
8778         mtime.
8779         * incremental.h (Incremental_inputs::report_script): Add mtime
8780         argument.
8781         (Incremental_inputs::Input_info::Input_info): Intialize only one
8782         union member.
8783         (Incremental_inputs::Input_info::archive): Move to nameless
8784         union.
8785         (Incremental_inputs::Input_info::obejct): Move to nameless union.
8786         (Incremental_inputs::Input_info::script): Move to nameless union.
8787         (Incremental_inputs::mtime): New field.
8788         * script.cc (read_input_script): Pass file mtime to
8789         Incremental_input.
8790         * script.h (Script_info::inputs): Style fix.
8791
8792 2009-07-01  Ian Lance Taylor  <ian@airs.com>
8793
8794         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8795         instead of 32.
8796
8797 2009-06-24  Ian Lance Taylor  <iant@google.com>
8798
8799         PR 10156
8800         * layout.cc (Layout::choose_output_section): If we find an
8801         existing section, update the flags.
8802         (Layout::create_notes): New function, broken out of
8803         Layout::finalize.
8804         (Layout::finalize): Don't create note sections.
8805         (Layout::create_note): Don't crash if linker script discards
8806         section.
8807         (Layout::create_gold_note): Likewise.
8808         (Layout::create_build_id): Likewise.  Don't set
8809         after_input_sections on the section.
8810         (Layout::create_executable_stack_info): Remove target parameter.
8811         Change caller.
8812         * layout.h (class Layout): Declare create_notes.  Update
8813         declaration of create_executable_stack_info.
8814         * gold.cc (queue_middle_tasks): Call create_notes.
8815         * output.cc (Output_section::update_flags_for_input_section): Move
8816         here from output.h.  If SHF_ALLOC flag is newly set, mark address
8817         invalid.
8818         * output.h (Output_data::mark_address_invalid): New function.
8819         (class Output_section): Only declare, not define,
8820         update_flags_for_input_section.  Remove set_flags.
8821
8822 2009-06-24  Ian Lance Taylor  <iant@google.com>
8823
8824         * script-sections.cc (Output_section_definition::
8825         set_section_addresses): Rename shadowing local load_address to
8826         laddr.
8827
8828 2009-06-24  Ian Lance Taylor  <iant@google.com>
8829
8830         PR 10244
8831         * reloc.cc (relocate_sections): Skip empty relocation sections.
8832
8833 2009-06-23  Ian Lance Taylor  <iant@google.com>
8834
8835         PR 10156
8836         * layout.cc (Layout::create_note): Use choose_output_section
8837         rather than make_output_section.
8838
8839 2009-06-23  Ian Lance Taylor  <iant@google.com>
8840
8841         PR 10237
8842         * options.cc (General_options::parse_V): Set printed_version_.
8843         (General_options::General_options): Initialize printed_version_.
8844         * options.h (class General_options): Add printed_version_ field.
8845         * gold.cc (queue_initial_tasks): If there are no input files,
8846         don't give a fatal error if we printed the version information.
8847         (queue_middle_tasks): If using -r with a shared object, give a
8848         fatal error rather than an ordinary error.
8849
8850 2009-06-23  Ian Lance Taylor  <iant@google.com>
8851
8852         PR 10219
8853         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8854         (Layout::make_output_section): Set have_stabstr_section_ if we see
8855         a .stab*str section.
8856         (Layout::finalize): Call link_stabs_sections.
8857         (Layout::link_stabs_sections): New file.
8858         * layout.h (class Layout): Add have_stabstr_section_ field.
8859         Declare link_stabs_sections.
8860
8861 2009-06-23  Doug Kwan  <dougkwan@google.com>
8862
8863         * Makefile.am (libgold_a_LIBADD): New.
8864         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8865         * Makefile.in: Regenerate.
8866         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8867         * configure: Regenerate.
8868         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8869         * fileread.cc: Include sys/state.h
8870         * gold.h: Declare memmem and strndup if found missing.
8871         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8872
8873 2009-06-23  Ian Lance Taylor  <iant@google.com>
8874
8875         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8876         * configure: Rebuild.
8877
8878 2009-06-23  Ian Lance Taylor  <iant@google.com>
8879
8880         PR 10147
8881         * object.cc (Object::section_contents): Don't try to get a view if
8882         the section has length zero.
8883         (Object::handle_gnu_warning_section): If the section is empty, use
8884         the name of the section as the warning.
8885
8886 2009-06-23  Ian Lance Taylor  <iant@google.com>
8887
8888         PR 10133
8889         * stringpool.h (class Stringpool_template): Add optimize_ field.
8890         (Stringpool_template::set_optimize): New function.
8891         * stringpool.cc (Stringpool_template::Stringpool_template):
8892         Initialize optimize_ field.
8893         (Stringpool_template::set_string_offsets): Test local optimize
8894         fild rather than parameter.
8895         * layout.cc (Layout::Layout): Call set_optimize on the section
8896         name stringpool.
8897
8898 2009-06-22  Ian Lance Taylor  <iant@google.com>
8899
8900         PR 10030
8901         * yyscript.y: Parse TARGET.
8902         * script.cc (script_set_target): New function.
8903         * script-c.h (script_set_target): Declare.
8904         * options.cc (General_options::string_to_object_format): Rename
8905         from string_to_object_format in anonymous namespace.  Change
8906         callers.
8907         * options.h (class General_options): Declare
8908         string_to_object_format.
8909
8910 2009-06-22  Ian Lance Taylor  <iant@google.com>
8911
8912         * script-sections.cc (Script_sections::create_segments): Don't put
8913         program headers in a PT_LOAD segment if -n or -N.
8914
8915 2009-06-22  Ian Lance Taylor  <iant@google.com>
8916
8917         PR 10141
8918         * options.h (class General_options): Add -z lazy and -z now.  Sort
8919         -z options into alphabetical order.
8920         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8921
8922 2009-06-21  Ian Lance Taylor  <iant@google.com>
8923
8924         * layout.cc (Layout::make_output_section): Call
8925         Target::new_output_section.
8926         (Layout::attach_allocated_section_to_segment): Put large section
8927         sections in a separate load segment with the large segment flag
8928         set.
8929         (Layout::segment_precedes): Sort large data segments after other
8930         load segments.
8931         (align_file_offset): New static function.
8932         (Layout::set_segment_offsets): Use align_file_offset.
8933         * output.h (class Output_section): Add is_small_section_ and
8934         is_large_section_ fields.
8935         (Output_section::is_small_section): New function.
8936         (Output_section::set_is_small_section):  New function.
8937         (Output_section::is_large_section): New function.
8938         (Output_section::set_is_large_section): New function.
8939         (Output_section::is_large_data_section): New function.
8940         (class Output_segment): Add is_large_data_segment_ field.
8941         (Output_segment::is_large_data_segment): New function.
8942         (Output_segment::set_is_large_data_segment): New function.
8943         * output.cc (Output_section::Output_section): Initialize new
8944         fields.
8945         (Output_segment::Output_segment): Likewise.
8946         (Output_segment::add_output_section): Add assertion that large
8947         data sections always go in large data segments.  Force small data
8948         sections to the end of the list of data sections.  Force small BSS
8949         sections to the start of the list of BSS sections.  For large BSS
8950         sections to the end of the list of BSS sections.
8951         * symtab.h (class Symbol): Declare is_common_shndx.
8952         (Symbol::is_defined): Check Symbol::is_common_shndx.
8953         (Symbol::is_common): Likewise.
8954         (class Symbol_table): Define enum Commons_section_type.  Update
8955         declarations.  Add small_commons_ and large_commons_ fields.
8956         * symtab.cc (Symbol::is_common_shndx): New function.
8957         (Symbol_table::Symbol_table): Initialize new fields.
8958         (Symbol_table::add_from_object): Put small and large common
8959         symbols in the right list.
8960         (Symbol_table::sized_finalized_symbol): Check
8961         Symbol::is_common_shndx.
8962         (Symbol_table::sized_write_globals): Likewise.
8963         * common.cc (Symbol_table::do_allocate_commons): Allocate new
8964         common symbol lists.  Don't call do_allocate_commons_list if the
8965         list is empty.
8966         (Symbol_table::do_allocate_commons_list): Remove is_tls
8967         parameter.  Add comons_section_type parameter.  Change all
8968         callers.  Handle small and large common symbols.
8969         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8970         Symbol::is_common_shndx.
8971         * resolve.cc (symbol_to_bits): Likewise.
8972         * target.h (Target::small_common_shndx): New function.
8973         (Target::small_common_section_flags): New function.
8974         (Target::large_common_shndx): New function.
8975         (Target::large_common_section_flags): New function.
8976         (Target::new_output_section): New function.
8977         (Target::Target_info): Add small_common_shndx, large_common_shndx,
8978         small_common_section_flags, and large_common_section_flags
8979         fields.
8980         (Target::do_new_output_section): New virtual function.
8981         * arm.cc (Target_arm::arm_info): Initialize new fields.
8982         * i386.cc (Target_i386::i386_info): Likewise.
8983         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8984         Likewise.
8985         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8986         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8987         (Target_x86_64::do_new_output_section): New function.
8988         * configure.ac: Define conditional MCMODEL_MEDIUM.
8989         * testsuite/Makefile.am (check_PROGRAMS): Add large.
8990         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8991         (large_LDFLAGS): Define.
8992         * testsuite/large.c: New file.
8993         * testsuite/testfile.cc (Target_test::test_target_info):
8994         Initialize new fields.
8995         * configure, testsuite/Makefile.in: Rebuild.
8996
8997 2009-06-05  Doug Kwan  <dougkwan@google.com>
8998
8999         * Makefile.am (CCFILES): Add target.cc.
9000         * Makefile.in: Regenerate.
9001         * i386.cc (class Target_i386): Define new virtual method to
9002         override do_is_local_label_name in parent.
9003         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9004         local symbols if --discard-locals or -X is given.
9005         * options.h (class General_options): Declare new options
9006         '--discard-locals' and '-X' for discarding locals.
9007         * target.h (class Target): Define new methods is_local_label_name.
9008         Declare new virtual method do_is_local_label_name.
9009         * target.cc: New file.
9010         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9011         (check_SCRIPTS): Add discard_locals_test.sh.
9012         (check_DATA): Add discard_local_tests.syms.
9013         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9014         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9015         * testsuite/Makefile.in: Regenerate.
9016         * testsuite/discard_locals_test.c: New file.
9017         * testsuite/discard_locals_test.sh: Same.
9018
9019 2009-06-05  Doug Kwan  <dougkwan@google.com>
9020
9021         * object.cc (Sized_relobj::Sized_relobj): Initialize
9022         discarded_eh_frame_shndx_ to -1U.
9023         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9024         section.
9025         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9026         a discarded .eh_frame section.
9027         (Sized_relobj::do_finalize_local_symbols): Ditto.
9028         * object.h (class Sized_relobj): Declare new member
9029         discarded_eh_frame_shndx_.
9030         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9031         (local_labels_test.o, local_labels_test): New rules.
9032         * testsuite/Makefile.in: Regenerate.
9033
9034 2009-06-04  Doug Kwan  <dougkwan@google.com>
9035
9036         * layout.cc (Layout::section_name_mapping): Add mapping for
9037         special ARM sections.
9038
9039 2009-06-03  Doug Kwan  <dougkwan@google.com>
9040
9041         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9042         (utils::has_overflow): Same.
9043
9044 2009-06-03  Ian Lance Taylor  <iant@google.com>
9045
9046         * layout.cc (Layout::section_name_mapping): New array, replacing
9047         Layout::linkonce_mapping.
9048         (Layout::section_name_mapping_count): New variable, replacing
9049         Layout::linkonce_mapping_count.
9050         (Layout::linkonce_output_name): Remove.
9051         (Layout::output_section_name): Rewrite.
9052         * layout.h (class Layout): Rename Linkonce_mapping to
9053         Section_name_mapping, linkonce_mapping to section_name_mapping,
9054         linkonce_mapping_count to section_name_mapping_count.  Don't
9055         declare linkonce_output_name.
9056
9057 2009-06-03  Doug Kwan  <dougkwan@google.com>
9058
9059         * gold/arm.cc (namespace utils): New.
9060         (Target_arm::reloc_is_non_pic): Define new method.
9061         (class Arm_relocate_functions): New.
9062         (Target_arm::Relocate::relocate): Handle relocation types used by
9063         Android.
9064
9065 2009-06-03  Ian Lance Taylor  <iant@google.com>
9066
9067         * arm.cc (Target_arm::scan::global): Use || instead of |.
9068
9069 2009-06-02  Doug Kwan  <dougkwan@google.com>
9070
9071         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9072         issued_non_pic_error_.
9073         (class Target_arm::Scan): Declare new method check_non_pic.
9074         Define new method symbol_needs_plt_entry.
9075         Declare new data member issued_non_pic_error_.
9076         (class Target_arm::Relocate): Declare new method
9077         should_apply_static_reloc.
9078         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9079         (Target_arm::Scan::check_non_pic): Define new method.
9080         (Target_arm::Scan::local): Handle a small subset of reloc types used
9081         by Android.
9082         (Target_arm::Scan::local): Same.
9083         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9084
9085 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9086
9087         * incremental.cc (Incremental_inputs::report_command_line): Filter
9088         out --incremental-* options.
9089
9090 2009-05-29  Doug Kwan  <dougkwan@google.com>
9091
9092         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9093         template class.
9094         (class Target_arm): Update comment.
9095         (Target_arm::Target_arm): Initialize new data members GOT_,
9096         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9097         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9098         and Target_arm::rel_dyn_section.
9099         Declare new_enum Target_arm::Got_type.
9100         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9101         and DYNBSS_.
9102         Update commments for member do_dynsym_value.
9103         (Target_arm::got_size, Target_arm::plt_section,
9104         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9105         new methods inside class defintion.
9106         (Target_arm::got_section): Define new method.
9107         (Target_arm::rel_dyn_section): Same.
9108         (Output_data_plt_arm): New template class.
9109         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9110         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9111         (Output_data_plt_arm::add_entry): Same.
9112         (Output_data_plt_arm::first_plt_entry): Define new
9113         static data member for PLT instruction template.
9114         (Output_data_plt_arm::plt_entry): Same.
9115         (Output_data_plt_arm::do_write): Define new method.
9116         (Target_arm::make_plt_entry): Same.
9117         (Target_arm::do_finalize_sections): Same.
9118         (Target_arm::do_dynsym_value): Same.
9119
9120 2009-05-28  Doug Kwan  <dougkwan@google.com>
9121
9122         * Makefile.am (TARGETSOURCES): Add arm.cc.
9123         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9124         * Makefile.in: Regenerate.
9125         * arm.cc: New file.
9126         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9127
9128 2009-05-26  Doug Kwan  <dougkwan@google.com>
9129
9130         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9131         (General_options::check_excluded_libs): Strip off directories in
9132         archive name before matching like GNU ld does.
9133         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9134         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9135         (exclude_libs_test_LDFLAGS): Add linker option
9136         -Wl,--exclude-libs,libexclude_libs_test_3
9137         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9138         an explicit archive without using -l.
9139         (alt/libexclude_libs_test_3.a): New make rule.
9140         * testsuite/Makefile.in: Regenerate.
9141         * testsuite/exclude_libs_test.c : Declare lib3_default().
9142         (main): Call it.
9143         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9144         * exclude_libs_test_3.c: New file.
9145
9146 2009-05-26  Nick Clifton  <nickc@redhat.com>
9147
9148         * po/id.po: New Indonesian translation.
9149         * po/gold.pot: Updated template file.
9150
9151 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9152
9153         * testsuite/Makefile.am: Add -ffunction-sections to compile
9154         gc_comdat_test files.  Add -Wl,--gc-sections to build
9155         gc_comdat_test.
9156         * testsuite/Makefile.in: Regenerate.
9157         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9158
9159 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9160
9161         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9162         kept comdat section was garbage collected.
9163         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9164         * testsuite/Makefile.in: Regenerate.
9165         * testsuite/gc_comdat_test.sh: New file.
9166         * testsuite/gc_comdat_test_1.cc: New file.
9167         * testsuite/gc_comdat_test_2.cc: New file.
9168
9169 2009-05-19  Doug Kwan  <dougkwan@google.com>
9170
9171         * archive.cc (Archive::Archive): Move constructor from archive.h
9172         to here.  Initialize no_export_.
9173         (Archive::get_elf_object_for_member): Set no_export flag of object.
9174         * archive.h (Archive::Archive): Move constructor body to
9175         archive.cc.
9176         (Archive::no_export): New method.
9177         (Archive::no_export_): New field.
9178         * object.h (Object::Object): Initialize no_export_ to false.
9179         (Object::no_export, Object::set_no_export): New methods.
9180         (Object::no_export_): New field.
9181         * options.cc (General_options::parse_exclude_libs): New method.
9182         (General_options::check_excluded_libs) Same.
9183         * options.h (exclude_libs): New option.
9184         (General_options::check_excluded_libs): New method declaration.
9185         (General_options::excluded_libs_): New field.
9186         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9187         default or protected visibility if an object has no-export flag set.
9188         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9189         (check_SCRIPTS): Add exclude_libs_test.sh.
9190         (check_DATA): Add exclude_libs_test.syms.
9191         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9192         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9193         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9194         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9195         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9196         libexclude_libs_test_2.a): New rules.
9197         * testsuite/Makefile.in: Regenerate.
9198         * testsuite/exclude_libs_test.c: New file.
9199         * testsuite/exclude_libs_test.sh: Ditto.
9200         * testsuite/exclude_libs_test_1.c: Ditto.
9201         * testsuite/exclude_libs_test_2.c: Ditto.
9202
9203 2009-05-15  Ian Lance Taylor  <iant@google.com>
9204
9205         * configure.ac: Check for declarations for cases where libiberty.h
9206         checks HAVE_DECL_xxx.
9207         * configure, config.in: Rebuild.
9208
9209 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9210
9211         * gold.h (Incremental_argument_list): Remove (invalid) forward
9212         declaration.
9213         * incremental.cc (Incremental_inputs::report_achive): New method.
9214         (Incremental_inputs::report_object): New method.
9215         (Incremental_inputs::report_script): New method.
9216         (Incremental_inputs::finalize_inputs): New method.
9217         (Incremental_inputs::finalize): Call finalize_inputs().
9218         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9219         Create inputs entries.
9220         * incremental.h (Incremental_input_type): New enum.
9221         (Incremental_inputs::Incremental_input): Initialize new fields.
9222         (Incremental_inputs::report_inputs): New method.
9223         (Incremental_inputs::report_achive): New method.
9224         (Incremental_inputs::report_object): New method.
9225         (Incremental_inputs::report_script): New method.
9226         (Incremental_inputs::finalize_inputs): New method.
9227         (Incremental_inputs::Input_info): New struct.
9228         (Incremental_inputs::Input_info_map): New typedef.
9229         (Incremental_inputs::lock_): New field.
9230         (Incremental_inputs::Inputs_): New field.
9231         (Incremental_inputs::Inputs_map): New field.
9232         * main.cc (main): Call Incremental_input::report_inputs.
9233         * options.h (Input_argument_list): Typedef moved from
9234         Input_arguments.
9235         (Input_file_group::Files): Remove, use ::Input_argument_list.
9236         (Input_file_group::Input_argument_list): Remove, use
9237         ::Input_argument_list.
9238         * plugin.cc (Plugin_manager::add_input_file): Add error in
9239         incremental build.
9240         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9241         functions.
9242         * script.cc (read_input_script): Call
9243         Incremental_input::report_script.
9244         * script.h (Script_info): New class.
9245
9246 2009-04-27  Ian Lance Taylor  <iant@google.com>
9247
9248         * x86_64.cc (do_adjust_output_section): Set entsize to
9249         plt_entry_size.
9250
9251 2009-04-23  Elliott Hughes  <enh@google.com>
9252
9253         * output.cc (Output_file::close): After short writes, continue
9254         writing from the correct offset in the buffer being written.
9255
9256 2009-04-23  Chris Demetriou  <cgd@google.com>
9257
9258         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9259         * configure: Regenerate.
9260         * config.in: Regenerate.
9261         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9262         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9263
9264 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9265
9266         * incremental.cc (Incremental_inputs_header_data): Renamed from
9267         Incremental_input_header_data.
9268         (Incremental_inputs_header_data::data_size): New field.
9269         (Incremental_inputs_header_data::put_input_file_count): Renamed
9270         from input_file_count.
9271         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9272         from command_line_offset.
9273         (Incremental_inputs_header_data::put_reserved): Renamed from
9274         put_reserved.
9275         (Incremental_inputs_entry_data): Renamed from
9276         Incremental_input_entry_data.
9277         (Incremental_inputs_entry_data::data_size): New field.
9278         (Incremental_inputs::report_command_line): New method.
9279         (Incremental_inputs::finalize): New method.
9280         (Incremental_inputs::create_incremental_inputs_data): New method.
9281         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9282         * incremental.h: New file.
9283         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9284        (Layout::finalize): Create incremental inputs section in
9285         incremental builds.
9286        (Layout::create_incremental_info_sections): New method.
9287         * layout.h (Layout::incremental_inputs): New method.
9288        (Layout::create_incremental_info_sections): New method.
9289        (Layout::incremental_inputs_): New field.
9290         * main.cc (main): Notify Incremental_input of the command line.
9291
9292 2009-04-01  Ian Lance Taylor  <iant@google.com>
9293             Mikolaj Zalewski  <mikolajz@google.com>
9294
9295         * gold.h (reserve_unordered_map): Define, three versions, one for
9296         each version of Unordered_map.
9297         * layout.cc (Layout::Layout): Remove options parameter.  Add
9298         number_of_input_files parameter.  Don't initialize options_.
9299         Initialize number_of_input_files_ and resized_signatures_.  Move
9300         sections_are_attached_.
9301         (Layout::layout_group): Reserve space for group_signatures_.
9302         (Layout::find_or_add_kept_section): Change name parameter to be a
9303         reference.  Resize signatures_ map when it gets large enough.
9304         (Layout::layout_eh_frame): Use parameters->options() instead of
9305         this->options_.
9306         (Layout::make_output_section): Likewise.
9307         (Layout::attach_allocated_section_to_segment): Likewise.
9308         (Layout::finalize, Layout::create_executable_stack): Likewise.
9309         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9310         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9311         * layout.h (class Layout): Update declarations.  Remove options_
9312         field.  Add number_of_input_files_ and resized_signatures_
9313         fields.  Move sections_are_attached_ field.
9314         * main.cc (main): Pass number of input files to Layout
9315         constructor.  Don't pass options.
9316
9317 2009-03-30  Ian Lance Taylor  <iant@google.com>
9318
9319         * ffsll.c (ffsll): Correct implementation.
9320
9321 2009-03-27  Ian Lance Taylor  <iant@google.com>
9322
9323         * ffsll.c: New file.
9324         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9325         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9326         * ftruncate.c (ftruncate): Declare before definition.
9327         * mremap.c (mremap): Likewise.
9328         * pread.c (pread): Likewise.
9329         * configure, Makefile.in, config.in: Rebuild.
9330
9331         * mremap.c: New file.
9332         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9333         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9334         (mremap): Declare if HAVE_MREMAP is not defined.
9335         * configure, Makefile.in, config.in: Rebuild.
9336
9337 2009-03-27  Cary Coutant  <ccoutant@google.com>
9338
9339         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9340         position independent.
9341         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9342         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9343
9344 2009-03-24  Cary Coutant  <ccoutant@google.com>
9345
9346         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9347         an executable.
9348         (needs_dynamic_reloc): Likewise.
9349
9350 2009-03-24  Ian Lance Taylor  <iant@google.com>
9351
9352         * yyscript.y (file_cmd): Recognize EXTERN.
9353         (extern_name_list, extern_name_list_body): New nonterminals.
9354         * script.cc (script_add_extern): Define.
9355         * script-c.h (script_add_extern): Declare.
9356
9357 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9358
9359         * object.cc (is_elf_object): Define.
9360         * object.h (is_elf_object): Declare.
9361         * archive.cc (Archive::get_elf_object_for_member): Call
9362         is_elf_object.
9363         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9364
9365 2009-03-24  Elliott Hughes  <enh@google.com>
9366
9367         * output.cc (Output_file::map_anonymous): Define.
9368         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9369         try an anonymous one.  Report the size if the mmap fails.
9370         * output.h (class Output_file): Declare map_anonymous.
9371
9372 2009-03-24  Ian Lance Taylor  <iant@google.com>
9373
9374         * target-select.cc (instantiate_target): Don't acquire the lock if
9375         the instantiated_target_ field has already been set.
9376
9377 2009-03-23  Ian Lance Taylor  <iant@google.com>
9378
9379         * gold-threads.h (class Initialize_lock): Define.
9380         * gold-threads.cc (class Initialize_lock_once): Define.
9381         (initialize_lock_control): New static variable.
9382         (initialize_lock_pointer): New static variable.
9383         (initialize_lock_once): New static function.
9384         (Initialize_lock::Initialize_lock): Define.
9385         (Initialize_lock::initialize): Define.
9386         * target-select.h: Include "gold-threads.h".
9387         (class Target_selector): Add lock_ and initialize_lock_ fields.
9388         Don't define instantiate_target, just declare it.
9389         * target-select.cc (Target_selector::Target_selector): Initialize
9390         new fields.
9391         (Target_selector::instantiate_target): Define.
9392         * descriptors.h: Include "gold-threads.h".
9393         (class Descriptors): Add initialize_lock_ field.
9394         * descriptors.cc (Descriptors::Descriptors): Initialize new
9395         field.
9396         (Descriptors::open): Use initialize_lock_ field
9397         * errors.h (class Errors): Add initialize_lock_ field.
9398         * errors.cc (Errors::Errors): Initialize new field.
9399         (Errors::initialize_lock): Use initialize_lock_ field.
9400         * powerpc.cc (class Target_selector_powerpc): Remove
9401         instantiated_target_ field.  In do_recognize call
9402         instantiate_target rather than do_instantiate_target.  In
9403         do_instantiate_target just allocate a new target.
9404         * sparc.cc (class Target_selector_sparc): Likewise.
9405
9406         * freebsd.h: New file.
9407         * i386.cc: Include "freebsd.h".
9408         (Target_i386): Derive from Target_freebsd rather than
9409         Sized_target.
9410         (Target_selector_i386): Derive from Target_selector_freebsd rather
9411         than Target_selector.
9412         * x86_64.cc: Include "freebsd.h".
9413         (Target_x86_64): Derive from Target_freebsd rather than
9414         Sized_target.
9415         (Target_selector_x86_64): Derive from Target_selector_freebsd
9416         rather than Target_selector.
9417         * target.h (class Target): Add adjust_elf_header and
9418         do_adjust_elf_header.
9419         * output.cc (Output_file_header:: do_sized_write): Call target
9420         adjust_elf_header routine.
9421         * configure.tgt: Set targ_osabi.
9422         * configure.ac: Define GOLD_DEFAULT_OSABI.
9423         * parameters.cc (Parameters::default_target): Pass
9424         GOLD_DEFAULT_OSABI to select_target.
9425         * target-select.h (class Target_selector): Make instantiate_target
9426         protected rather than private.
9427         * Makefile.am (HFILES): Add freebsd.h.
9428         * configure, Makefile.in, config.in: Rebuild.
9429
9430         * merge.cc (do_add_input_section): Correct pend value.  Change
9431         message about last entry not being null terminated from error to
9432         warning.
9433
9434 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9435
9436         * incremental.cc: New file.
9437         * Makefile.am (CCFILES): Add incremental.cc.
9438         * Makefile.in: Rebuild.
9439
9440 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9441
9442         * layout.cc (Layout::output_section_name): Preserve names
9443         of '.note.' sections.
9444
9445 2009-03-19  Ian Lance Taylor  <iant@google.com>
9446
9447         * descriptors.cc (Descriptors::open): Check that the options are
9448         valid before using them.
9449
9450 2009-03-18  Ian Lance Taylor  <iant@google.com>
9451
9452         * script-sections.h: Include <list>.
9453         (class Script_sections): Change Sections_elements from std::vector
9454         to std::list.  Typedef public Elements_iterator.  Add
9455         orphan_section_placement_, data_segment_align_start_, and
9456         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9457         field.
9458         * script-sections.cc (class Orphan_section_placement): New class.
9459         (class Sections_element): Add virtual functions is_relro and
9460         orphan_section_init.  Remove virtual function place_orphan_here.
9461         (class Output_section_definition): Add is_relro and
9462         orphan_section_init.  Remove place_orphan_here.
9463         (class Orphan_output_section): Likewise.
9464         (Script_sections::Script_sections): Update for field changes.
9465         (Script_sections::data_segment_align): Set saw_data_segment_align_
9466         and data_segment_align_start_, not data_segment_align_index.
9467         (Script_sections::data_segment_relro_end): Check
9468         saw_data_segment_align_.  Use data_segment_align_start_ rather
9469         than data_segment_align_index_.
9470         (Script_sections::place_orphan): Rewrite to use
9471         Orphan_section_placement.
9472
9473 2009-03-17  Ian Lance Taylor  <iant@google.com>
9474
9475         * archive.cc (Archive::add_symbols): Check for a version attached
9476         to the symbol name in the archive map.
9477         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9478         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9479         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9480         (ver_test_11.a): New target.
9481         * testsuite/Makefile.in: Rebuild.
9482
9483         * configure.ac: Check for chsize and posix_fallocate.  Replace
9484         ftruncate.
9485         * ftruncate.c: New file, from gnulib.
9486         * output.cc (posix_fallocate): Define dummy version if not
9487         HAVE_POSIX_FALLOCATE.
9488         (Output_file::map): Call posix_fallocate rather than lseek and
9489         write.
9490         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9491         * configure, Makefile.in, config.in: Rebuild.
9492
9493 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9494
9495         * layout.h (Layout::create_note): Add section_name parameter.
9496         * layout.cc (Layout::create_note): Likewise.
9497         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9498
9499 2009-03-17  Ian Lance Taylor  <iant@google.com>
9500
9501         * descriptors.cc: Include "options.h".
9502         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9503         (Descriptors::open): Always use O_CLOEXEC when opening a new
9504         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9505         then set FD_CLOEXEC.
9506
9507         * sparc.cc (class Target_sparc): Add has_got_section.
9508         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9509         make sure we have a GOT section.
9510
9511         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9512         (Target_sparc::Scan::local): Likewise.
9513         (Target_sparc::Scan::global): Likewise.
9514         (Target_sparc::Relocate::relocate): Likewise.
9515         (Target_sparc::Relocate::relocate_tls): Likewise.
9516
9517         * symtab.cc (Symbol_table::define_default_version): New function,
9518         broken out of add_from_object.
9519         (Symbol_table::add_from_object): Call define_default_version.
9520         (Symbol_table::define_special_symbol): Add resolve_oldsym
9521         parameter.  Change all callers.  If the version for a symbol comes
9522         from a version script, resolve it with the symbol with the same
9523         name with no version.  Also add the symbol without a version if
9524         appropriate.
9525         (do_define_in_output_data): If resolving with oldsym, don't delete
9526         sym.
9527         (do_define_in_output_segment): Likewise.
9528         (do_define_as_constant): Likewise.
9529         * symtab.h (class Symbol_table): Update declarations.
9530
9531 2009-03-13  Ian Lance Taylor  <iant@google.com>
9532
9533         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9534         (Read_symbols::requeue): New function.
9535         (Read_symbols::do_read_symbols): If make_elf_object fails because
9536         the target type is not configured, and the file was searched for,
9537         issue a warning and retry with the next directory.
9538         (Add_symbols::run): If the file has an incompatible format, and
9539         it was searched for, requeue the Read_symbols task.  On error,
9540         release the object.
9541         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
9542         dirindex parameter to constructor.  Change all callers.  Declare
9543         incompatible_warning and requeue.
9544         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9545         input_argument_ and input_group_ fields.  Add them to
9546         constructor.  Change all callers.
9547         (class Read_script): Add dirindex_ field.  Add it to constructor.
9548         Change all callers.
9549         * archive.cc (Archive::setup): Remove input_objects parameter.
9550         Change all callers.
9551         (Archive::get_file_and_offset): Likewise.
9552         (Archive::read_all_symbols): Likewise.
9553         (Archive::read_symbols): Likewise.
9554         (Archive::get_elf_object_for_member): Remove input_objects
9555         parameter.  Add punconfigured parameter.  Change all callers.
9556         (Archive::add_symbols): Change return type to bool.  Check return
9557         value of include_member.
9558         (Archive::include_all_members): Likewise.
9559         (Archive::include_member): Change return type to bool.  Return
9560         false if first included object has incompatible target.  Set
9561         included_member_ field.
9562         (Add_archive_symbols::run): If add_symbols returns false, requeue
9563         Read_symbols task.
9564         * archive.h (class Archive): Add included_member_ field.
9565         Initialize it in constructor.  Add input_file and searched_for
9566         methods.  Update declarations.
9567         (class Add_archive_symbols): Add dirpath_, dirindex_, and
9568         input_argument_ fields.  Add them to constructor.  Change all
9569         callers.
9570         * script.cc: Include "target-select.h".
9571         (class Parser_closure): Add skip_on_incompatible_target_ and
9572         found_incompatible_target_ fields.  Add
9573         skip_on_incompatible_target parameter to constructor.  Change all
9574         callers.  Add methods skip_on_incompatible_target,
9575         clear_skip_on_incompatible_target, found_incompatible_target, and
9576         set_found_incompatible_target.
9577         (read_input_script): Add dirindex parameter.  Change all callers.
9578         If parser finds an incompatible target, requeue Read_symbols
9579         task.
9580         (script_set_symbol): Clear skip_on_incompatible_target in
9581         closure.
9582         (script_add_assertion, script_parse_option): Likewise.
9583         (script_start_sections, script_add_phdr): Likewise.
9584         (script_check_output_format): New function.
9585         * script.h (read_input_script): Update declaration.
9586         * script-c.h (script_check_output_format): Declare.
9587         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9588         (ignore_cmd): Remove OUTPUT_FORMAT.
9589         * fileread.cc (Input_file::Input_file): Add explicit this.
9590         (Input_file::will_search_for): New function.
9591         (Input_file::open): Add pindex parameter.  Change all callers.
9592         * fileread.h (class Input_file): Add input_file_argument method.
9593         Declare will_search_for.  Update declarations.
9594         * object.cc (make_elf_object): Add punconfigured parameter.
9595         Change all callers.
9596         * object.h (class Object): Make input_file public.  Add
9597         searched_for method.
9598         (make_elf_object): Update declaration.
9599         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
9600         restart search.
9601         * dirsearch.h (class Dirsearch): Update declaration.
9602         * options.h (class General_options): Add --warn-search-mismatch.
9603         * parameters.cc (Parameters::is_compatible_target): New function.
9604         * parameters.h (class Parameters): Declare is_compatible_target.
9605         * workqueue.cc (Workqueue::add_blocker): New function.
9606         * workqueue.h (class Workqueue): Declare add_blocker.
9607
9608         * fileread.cc (Input_file::open): Remove options parameter.
9609         Change all callers.
9610         (Input_file::open_binary): Likewise.
9611         * script.cc (read_input_script): Likewise.
9612         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
9613         options parameter from constructor.  Change all callers.
9614         (class Read_script): Likewise.
9615         * fileread.h (class Input_file): Update declarations.
9616         * script.h (read_input_script): Update declaration.
9617
9618 2009-03-10  Nick Clifton  <nickc@redhat.com>
9619
9620         * po/es.po: New Spanish translation.
9621
9622 2009-03-06  Cary Coutant  <ccoutant@google.com>
9623
9624         * options.cc (parse_short_option): Keep dash_z from registering itself.
9625
9626 2009-03-03  Ian Lance Taylor  <iant@google.com>
9627
9628         PR 9918
9629         * target-reloc.h (relocate_section): Pass output_section to
9630         relocate.
9631         * i386.cc (Target_i386::should_apply_static_reloc): Add
9632         output_section parameter.  Change all callers.
9633         (Target_i386::Relocate::relocate): Add output_section parameter.
9634         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9635         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9636         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9637         * testsuite/two_file_shared.sh: New script.
9638         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9639         (check_DATA): Add two_file_shared.dbg.
9640         (two_file_shared.dbg): New target.
9641         * testsuite/Makefile.in: Rebuild.
9642
9643 2009-03-01  Ian Lance Taylor  <iant@google.com>
9644
9645         * configure.ac: Check for byteswap.h.
9646         * configure: Rebuild.
9647         * config.in: Rebuild.
9648
9649 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
9650
9651         * layout.cc (Layout::find_or_add_kept_section): New function.
9652         (Layout::add_comdat): Removed.
9653         * layout.h (struct Kept_section): Move out of class Layout.
9654         Remove trailing underscores from field names.  Add group_sections
9655         field.  Rename group_ field to is_group.  Change all uses.
9656         (class Layout): Declare find_or_add_kept_section, not add_comdat.
9657         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9658         comdat_groups_ field.
9659         (Sized_relobj::include_section_group): Use
9660         find_or_add_kept_section and Kept_section::group_sections.
9661         (Sized_relobj::include_linkonce_section): Likewise.
9662         * object.cc (class Sized_relobj): Don't define Comdat_group or
9663         Comdat_group_table.  Remove find_comdat_group and
9664         add_comdat_group.  Remove comdat_groups_ field.
9665         * plugin.cc (include_comdat_group): Use
9666         Layout::find_or_add_kept_section.
9667
9668 2009-02-28  Ian Lance Taylor  <iant@google.com>
9669
9670         * README: --gc-sections and map files are now supported.  Document
9671         some build requirements.
9672
9673         PR 6992
9674         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9675         relocatable link set the value of the section symbol to zero.
9676         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9677         relocatable link don't include the section address in the local
9678         symbol value.
9679
9680 2009-02-27  Ian Lance Taylor  <iant@google.com>
9681
9682         PR 6811
9683         * options.h (class Search_directory): Add is_system_directory.
9684         (class General_options): Declare is_in_system_directory.
9685         * options.cc (get_relative_sysroot): Make static.
9686         (get_default_sysroot): Make static.
9687         (General_optoins::is_in_system_directory): New function.
9688         * fileread.cc (Input_file::is_in_system_directory): New function.
9689         * fileread.h (class Input_file): Declare is_in_system_directory.
9690         * object.h (class Object): Add is_in_system_directory.
9691         (class Input_objects): Remove system_library_directory_ field.
9692         * object.cc (Input_objects::add_object): Don't set
9693         system_library_directory_.
9694         (input_objects::found_in_system_library_directory): Remove.
9695         * symtab.cc (Symbol_table::write_globals): Remove input_objects
9696         parameter.  Change all callers.
9697         (Symbol_table::sized_write_globals): Likewise.
9698         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9699         Call Object::is_in_system_directory.
9700         * symtab.h (class Symbol_table): Update declarations.
9701
9702         PR 5990
9703         * descriptors.h (Open_descriptor): Add is_on_stack field.
9704         * descriptors.cc (Descriptors::open): If the descriptor is on the
9705         top of the stack, remove it.  Initialize is_on_stack field.
9706         (Descriptors::release): Only add pod to stack if it is not on the
9707         stack already.
9708         (Descriptors::close_some_descriptor): Clear stack_next and
9709         is_on_stack fields.
9710
9711         PR 7091
9712         * output.cc (Output_section::find_starting_output_address): Rename
9713         from starting_output_address; add PADDR parameter; change return
9714         type.
9715         * output.h (class Output_section): Declare
9716         find_starting_output_address instead of starting_output_address.
9717         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9718         section symbol for which we can't find a merge section.
9719
9720         PR 9836
9721         * symtab.cc (Symbol_table::add_from_object): If the visibility is
9722         hidden or internal, force the symbol to be local.
9723         * resolve.cc (Symbol::override_visibility): Define.
9724         (Symbol::override_base): Use override_visibility.
9725         (Symbol_table::resolve): Likewise.
9726         (Symbol::override_base_with_special): Likewise.
9727         (Symbol_table::override_with_special): If the visibility is hidden
9728         or internal, force the symbol to be local.
9729         * symtab.h (class Symbol): Add set_visibility and
9730         override_visibility.
9731         * testsuite/ver_test_1.sh: New file.
9732         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9733         (check_DATA): Add ver_test_1.syms.
9734         (ver_test_1.syms): New target.
9735         * testsuite/Makefile.in: Rebuild.
9736
9737 2009-02-25  Cary Coutant  <ccoutant@google.com>
9738
9739         * layout.cc (Layout::choose_output_section): Don't rename sections
9740         when using a linker script that has a SECTIONS clause.
9741         * Makefile.in: Regenerate.
9742
9743         * testsuite/Makefile.am (script_test_5.sh): New test case.
9744         * testsuite/Makefile.in: Regenerate.
9745         * testsuite/script_test_5.cc: New file.
9746         * testsuite/script_test_5.sh: New file.
9747         * testsuite/script_test_5.t: New file.
9748
9749 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
9750
9751         * archive.cc (Archive::include_member): Update calls to add_symbols.
9752         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9753         the Layout argument.
9754         * dynobj.h (do_add_symbols): Add the Layout argument.
9755         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9756         Layout argument.
9757         * object.h (Object::add_symbols): Add the Layout argument.
9758         (Object::do_add_symbols): Add the Layout argument.
9759         (Sized_relobj::do_add_symbols): Add the Layout argument.
9760         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9761         Unify the two versions.
9762         (Add_plugin_symbols): Remove.
9763         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9764         (Sized_pluginobj::do_add_symbols): Unify the two versions.
9765         (Add_plugin_symbols): Remove.
9766         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9767         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9768         (Add_symbols::run): Make it work with Pulginobj.
9769
9770 2009-02-06  Ian Lance Taylor  <iant@google.com>
9771
9772         * object.cc (Sized_relobj::do_layout): Make info message start
9773         with lower case letter.
9774
9775 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
9776
9777         * binary.cc: Fix file comment.
9778
9779         * options.h (enum Incremental_disposition): Define.
9780         (class General_options): Add new options: --incremental,
9781         --incremental_changed, --incremental_unchanged,
9782         --incremental_unknown.  Add incremental_disposition_ and
9783         implicit_incremental_ fields.
9784         (General_options::incremental_disposition): New function.
9785         (class Position_dependent_options): Add incremental_disposition
9786         option.
9787         (Position_dependent_options::copy_from_options): Set incremental
9788         dispositions.
9789         * options.cc (General_options::parse_incremental_changed): New
9790         function.
9791         (General_options::parse_incremental_unchanged): New function.
9792         (General_options::parse_incremental_unknown): New function.
9793         (General_options::General_options): Initialize new fields
9794         incremental_disposition_ and implicit_incremental_.
9795         (General_options::finalize): Check for uasge of --incremental-*
9796         without --incremental.
9797
9798 2009-02-06  Chris Demetriou  <cgd@google.com>
9799
9800         * gold.h (gold_undefined_symbol): Change to take only a Symbol
9801         pointer and to report location as the file name associated with
9802         the symbol.
9803         (gold_undefined_symbol_at_location): New function to replace the
9804         old gold_undefined_symbol functionality.
9805         * target-reloc.h (relocate_section): Update to use
9806         gold_undefined_symbol_at_location.
9807         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9808         Call gold_undefined_symbol function rather than gold_error.
9809         * errors.h (Errors::undefined_symbol): Take location as a
9810         string, rather than calculating it from a relocation.
9811         * errors.cc (Errors::fatal): Print "fatal error:" before the
9812         formatted message.
9813         (Errors::error, Errors::error_at_location): Print "error: "
9814         before the formatted message.
9815         (Errors::undefined_symbol): Take location as a string, rather
9816         than calculating it from a relocation.
9817         (gold_undefined_symbol_at_location): New function akin to
9818         old gold_undefined_symbol, calculates location from relocation.
9819         (gold_undefined_symbol): Change to take only a Symbol pointer
9820         and to report location as the file name associated with the symbol.
9821         * testsuite/debug_msg.sh: Update for changed error messages.
9822         * testsuite/undef_symbol.sh: Likewise.
9823
9824 2009-02-04  Duncan Sands  <baldrick@free.fr>
9825
9826         PR 9812
9827         * reduced_debug_output.h
9828         (Output_reduced_debug_abbrev_section::failed): Use format for
9829         gold_warning.
9830         (Output_reduced_debug_info_section::faild): Likewise.
9831
9832 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
9833
9834         * script.cc (Lazy_demangler): New class.
9835         (Version_script_info::get_symbol_version_helper): Demangle a
9836         symbol only once.
9837
9838 2009-01-29  Cary Coutant  <ccoutant@google.com>
9839
9840         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9841         to __tls_get_addr.
9842         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9843
9844 2009-01-28  Ian Lance Taylor  <iant@google.com>
9845
9846         * version.cc (version_string): Bump to 1.9.
9847
9848         * gold.h: Include <cstring> and <stdint.h>.
9849         * version.cc: Include <cstdio>.
9850         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9851         warning.
9852         * reduced_debug_output.cc (insert_into_vector): Rename from
9853         Insert_into_vector; change all callers.  Use Swap_unaligned to
9854         avoid aliasing issue; remove union since it is unnecessary.
9855
9856 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
9857
9858         * Makefile.am (CCFILES): Add gc.cc.
9859         (HFILES): Add gc.h.
9860         * Makefile.in: Regenerate.
9861         * gold.cc (Gc_runner): New class.
9862         (queue_initial_tasks): Call garbage collection related tasks
9863         when corresponding options are invoked.
9864         (queue_middle_gc_tasks): New function.
9865         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9866         processed early before laying out sections during garbage collection.
9867         * gold.h (queue_middle_gc_tasks): New function.
9868         (is_prefix_of): Move from "layout.cc".
9869         * i386.cc (Target_i386::gc_process_relocs): New function.
9870         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9871         * main.cc (main): Create object of class "Garbage_collection".
9872         * object.cc (Relobj::copy_symbols_data): New function.
9873         (Relobj::is_section_name_included): New function.
9874         (Sized_relobj::do_layout): Allow this function to be called twice
9875         during garbage collection and defer layout of section during the
9876         first call.
9877         * object.h (Relobj::get_symbols_data): New function.
9878         (Relobj::is_section_name_included): New function.
9879         (Relobj::copy_symbols_data): New function.
9880         (Relobj::set_symbols_data): New function.
9881         (Relobj::get_relocs_data): New function.
9882         (Relobj::set_relocs_data): New function.
9883         (Relobj::is_output_section_offset_invalid): New pure virtual function.
9884         (Relobj::gc_process_relocs): New function.
9885         (Relobj::do_gc_process_relocs): New pure virtual function.
9886         (Relobj::sd_): New data member.
9887         (Sized_relobj::is_output_section_offset_invalid): New function.
9888         (Sized_relobj::do_gc_process_relocs): New function.
9889         * options.h (General_options::gc_sections): Modify to not be a no-op.
9890         (General_options::print_gc_sections): New option.
9891         * plugin.cc (Plugin_finish::run): Remove function call to
9892         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
9893         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9894         * reloc.cc (Read_relocs::run): Add task to process relocs and
9895         determine unreferenced sections when doing garbage collection.
9896         (Gc_process_relocs): New class.
9897         (Sized_relobj::do_gc_process_relocs): New function.
9898         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9899         sections that are garbage collected.
9900         * reloc.h (Gc_process_relocs): New class.
9901         * sparc.cc (Target_sparc::gc_process_relocs): New function.
9902         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9903         symbols whose corresponding sections are garbage collected.
9904         (Symbol_table::Symbol_table): Add new parameter for the garbage
9905         collection object.
9906         (Symbol_table::gc_mark_undef_symbols): New function.
9907         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9908         (Symbol_table::gc_mark_dyn_syms): New function.
9909         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9910         as garbage.
9911         (Symbol_table::add_from_object): Likewise.
9912         (Symbol_table::add_from_relobj): When building shared objects, do not
9913         treat externally visible symbols as garbage.
9914         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9915         table information for static and relocatable links.
9916         * symtab.h (Symbol_table::set_gc): New function.
9917         (Symbol_table::gc): New function.
9918         (Symbol_table::gc_mark_undef_symbols): New function.
9919         (Symbol_table::gc_mark_symbol_for_shlib): New function.
9920         (Symbol_table::gc_mark_dyn_syms): New function.
9921         (Symbol_table::gc_): New data member.
9922         * target.h (Sized_target::gc_process_relocs): New pure virtual
9923         function.
9924         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9925         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9926
9927 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
9928
9929         * options.h (General_options::gc_sections): Define as a no-op for now.
9930         (General_options::no_keep_memory): Ditto.
9931         (General_options::Bshareable): Define.
9932         * options.cc (General_options::finalize): Honor -Bshareable.
9933
9934 2009-01-20  Andreas Schwab  <schwab@suse.de>
9935
9936         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9937         read the value in the contents, since we don't use it.  Use the
9938         template endianness when writing.
9939         (Relocate::relocate): Use it for R_PPC_REL16_HA.
9940
9941 2009-01-19  Andreas Schwab  <schwab@suse.de>
9942
9943         * configure.tgt (powerpc64-*): Fix targ_obj.
9944
9945 2009-01-15  Ian Lance Taylor  <iant@google.com>
9946
9947         * object.cc (Sized_relobj::write_local_symbols): Don't write out
9948         local symbols when stripping all symbols.
9949
9950 2009-01-14  Cary Coutant  <ccoutant@google.com>
9951
9952         * output.cc (Output_reloc): Add explicit instantiations.
9953
9954 2009-01-14  Cary Coutant  <ccoutant@google.com>
9955
9956         * archive.cc (Archive::get_elf_object_for_member): Remove call
9957         to File_read::claim_for_plugin.
9958         * descriptors.cc (Descriptors::open): Remove reference to
9959         is_claimed.
9960         (Descriptors::claim_for_plugin): Remove.
9961         * descriptors.h (Descriptors::claim_for_plugin): Remove.
9962         (Descriptors::is_claimed): Remove.
9963         (claim_descriptor_for_plugin): Remove.
9964         * fileread.cc (File_read::claim_for_plugin): Remove.
9965         * fileread.h (File_read::claim_for_plugin): Remove.
9966         (File_read::descriptor): Reopen descriptor if necessary.
9967         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
9968         (Plugin_manager::all_symbols_read): Add task parameter. Change
9969         all callers.
9970         (Plugin_manager::get_input_file): New function.
9971         (Plugin_manager::release_input_file): New function.
9972         (Pluginobj::Pluginobj): Add filesize parameter and initialize
9973         corresponding data member.
9974         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9975         and pass to base constructor. Change all callers.
9976         (get_input_file, release_input_file): New functions.
9977         (make_sized_plugin_object): Add filesize parameter. Change all callers.
9978         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9979         (Plugin_manager::all_symbols_read): Add task parameter.
9980         (Plugin_manager::get_input_file): New function.
9981         (Plugin_manager::release_input_file): New function.
9982         (Plugin_manager::task_): New data member.
9983         (Pluginobj::Pluginobj): Add filesize parameter.
9984         (Pluginobj::filename): New function.
9985         (Pluginobj::descriptor): New function.
9986         (Pluginobj::filesize): New function.
9987         (Pluginobj::filesize_): New data member.
9988         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9989         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9990         File_read::claim_for_plugin; use Object::unlock to unlock the file.
9991
9992         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9993         with archive libraries.
9994         * testsuite/Makefile.in: Regenerate.
9995         * testsuite/plugin_test.c (struct sym_info): New type.
9996         (get_input_file, release_input_file): New static variables.
9997         (onload): Capture new transfer vector entries.
9998         (claim_file_hook): Stop reading at end of file according to filesize.
9999         Factor out parsing of readelf output into separate function.
10000         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10001         APIs and get the source file name from the symbol table.  Convert
10002         source file name to corresponding object file name.  Print info
10003         message when adding new input files.
10004         (parse_readelf_line): New function.
10005         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10006         * testsuite/plugin_test_2.sh: Likewise.
10007         * testsuite/plugin_test_3.sh: Likewise.
10008         * testsuite/plugin_test_4.sh: New test case.
10009
10010 2009-01-07  Ian Lance Taylor  <iant@google.com>
10011
10012         * version.cc (version_string): Bump to 1.8.
10013
10014 2008-12-23  Cary Coutant  <ccoutant@google.com>
10015
10016         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10017         * plugin.cc (Plugin_manager::finish): Rename as
10018         layout_deferred_objects.  Move cleanup to separate function.
10019         (Plugin_manager::cleanup): New function.
10020         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10021         separately.
10022         * plugin.h (Plugin_manager::finish): Rename as
10023         layout_deferred_objects.
10024         (Plugin_manager::cleanup): New function.
10025         (Plugin_manager::cleanup_done): New field.
10026
10027 2008-12-23  Cary Coutant  <ccoutant@google.com>
10028
10029         * plugin.cc (is_visible_from_outside): New function.
10030         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10031         so we don't return "IR only" status for exported symbols or -r links.
10032
10033         * testsuite/Makefile.am (plugin_test_3): New test case.
10034         * testsuite/Makefile.in: Regenerate.
10035         * testsuite/plugin_test_3.sh: New file.
10036
10037 2008-12-22  Cary Coutant  <ccoutant@google.com>
10038
10039         * object.cc (Sized_relobj::layout_section): New function.
10040         (Sized_relobj::do_layout): Defer layout of input sections until after
10041         plugin has provided replacement files.
10042         (Sized_relobj::do_layout_deferred_sections): New function.
10043         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10044         (Relobj::layout_deferred_sections): New function.
10045         (Relobj::do_layout_deferred_sections): New function.
10046         (Sized_relobj::do_layout_deferred_sections): New function.
10047         (Sized_relobj::layout_section): New function.
10048         (Sized_relobj::Deferred_layout): New structure.
10049         (Sized_relobj::deferred_layout_): New field.
10050         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10051         Change all callers.  Layout deferred sections.
10052         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10053         references.
10054         (Plugin_hook::run): Move code from do_plugin_hook inline.
10055         (Plugin_hook::do_plugin_hook): Remove.
10056         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10057         (Plugin_manager::finish): Renamed, was cleanup.
10058         (Plugin_manager::should_defer_layout): New function.
10059         (Plugin_manager::add_deferred_layout_object): New function.
10060         (Plugin_manager::Deferred_layout_list): New type.
10061         (Plugin_manager::deferred_layout_objects_): New field.
10062         (Plugin_hook::do_plugin_hook): Remove.
10063
10064 2008-12-17  Ian Lance Taylor  <iant@google.com>
10065
10066         * options.h (class General_options): Add --no case for
10067         --export-dynamic.
10068
10069 2008-12-16  Cary Coutant  <ccoutant@google.com>
10070
10071         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10072         vector.
10073         (Plugin_manager::claim_file): Create plugin object even if
10074         plugin did not call the add_symbols callback.
10075         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10076         asking for more symbols than were added.
10077         * testsuite/Makefile.am (plugin_test_1): Add test case with
10078         no global symbols.
10079         (empty.syms): New target.
10080         * testsuite/Makefile.in: Regenerate.
10081         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10082         message. Don't call add_symbols if no globals.
10083         (all_symbols_read_hook): Don't provide replacement for empty
10084         claimed file.
10085
10086 2008-12-12  Ian Lance Taylor  <iant@google.com>
10087
10088         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10089         r_type == 0 for a local symbol with r_sym == 0.
10090         (scan_relocatable_relocs): Pass r_sym to
10091         local_non_section_strategy.
10092         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10093         r_sym parameter.
10094
10095         * configure.ac: Update test for TLS descriptors: they are
10096         supported as of glibc 2.9.
10097         * configure: Rebuild.
10098
10099 2008-12-11  Ian Lance Taylor  <iant@google.com>
10100
10101         PR 7091
10102         * target-reloc.h (Default_scan_relocatable_relocs): For each
10103         function, map r_type == 0 to RELOC_DISCARD.
10104
10105 2008-12-10  Cary Coutant  <ccoutant@google.com>
10106
10107         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10108         object to override a kept COMDAT group from a plugin object.
10109
10110 2008-12-09  Ian Lance Taylor  <iant@google.com>
10111
10112         PR 7088
10113         * yyscript.y (file_cmd): Handle INPUT.
10114
10115         * testsuite/initpri1.c: Change all declarations to be full
10116         prototypes by adding void, to avoid compiler warnings.
10117
10118 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10119
10120         * options.cc (General_options::parse_plugin_opt): New.
10121         (General_options::add_plugin): The argument now is just the filename.
10122         (General_options::add_plugin_option): New.
10123         * options.h (plugin_opt): New.
10124         (add_plugin): Change argument name.
10125         (add_plugin_option): New.
10126         * plugin.cc (Plugin::load): Don't parse the plugin option.
10127         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10128         (Plugin::add_option): New.
10129         (Plugin::args_): Change type.
10130         (Plugin::filename_): New.
10131         (Plugin_manager::add_plugin_option): New.
10132         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10133         * testsuite/Makefile.in: Regenerate.
10134
10135 2008-12-05  Cary Coutant  <ccoutant@google.com>
10136
10137         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10138         Handle --strip-lto-sections option.
10139         * options.h (strip_lto_sections): New option.
10140
10141 2008-12-01  Cary Coutant  <ccoutant@google.com>
10142
10143         * plugin.cc (ld_plugin_message): Change format parameter to const.
10144         Fix mismatch between new[] and delete.
10145
10146 2008-11-14  Cary Coutant  <ccoutant@google.com>
10147
10148         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10149         instead of -1U.
10150
10151 2008-11-05  Craig Silverstein  <csilvers@google.com>
10152
10153         * options.cc (General_options::parse_dynamic_list): New function.
10154         * options.h (General_options): New flags dynamic_list,
10155         dynamic_list_data, dynamic_list_cpp_new, and
10156         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10157         (General_options::in_dynamic_list): New function.
10158         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10159         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10160         (Lex::can_continue_name): Likewise.
10161         (yylex): Likewise.
10162         (read_script_file): New parameter script_options.
10163         (read_dynamic_list): New function.
10164         (Script_options::define_dynamic_list): New function.
10165         (dynamic_list_keyword_parsecodes): New variable.
10166         (dynamic_list_keywords): New variable.
10167         * script.h (Script_options::define_dynamic_list): New function
10168         prototype.
10169         (read_dynamic_list): New function prototype.
10170         * symtab.cc (strprefix): New macro.
10171         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10172         dynamic_list_data, dynamic_list_cpp_new, and
10173         dynamic_list_cpp_typeinfo.
10174         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10175         (dynamic_list_expr): New rule.
10176         (dynamic_list_nodes): Likewise.
10177         (dynamic_list_node): Likewise.
10178         * testsuite/Makefile.am (dynamic_list): New test.
10179         * testsuite/Makefile.in: Regenerated.
10180         * testsuite/dynamic_list.t: New file.
10181         * testsuite/dynamic_list.sh: New file.
10182
10183 2008-11-05  Craig Silverstein  <csilvers@google.com>
10184
10185         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10186         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10187         (t11_last): Likewise.
10188         * testsuite/ver_test_6.c (main): Likewise.
10189
10190 2008-10-07  Cary Coutant  <ccoutant@google.com>
10191
10192         * options.c (General_options::finalize): Add check for -static and
10193         -shared.
10194         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10195         is not empty.
10196
10197 2008-10-02  Cary Coutant  <ccoutant@google.com>
10198
10199         * plugin.cc (make_sized_plugin_object): Fix conditional
10200         compilation to work when not all targets are enabled.
10201
10202 2008-09-29  Cary Coutant  <ccoutant@google.com>
10203
10204         * archive.cc (Archive::get_file_and_offset): Use filename instead
10205         of name to get library path.
10206         (Archive::include_member): Unlock external member of a thin archive.
10207
10208         * testsuite/Makefile.am (TEST_AR): New variable.
10209         (thin_archive_test_1): New test.
10210         (thin_archive_test_2): New test.
10211         * testsuite/Makefile.in: Regenerate.
10212         * testsuite/thin_archive_main.cc: New file.
10213         * testsuite/thin_archive_test_1.cc: New file.
10214         * testsuite/thin_archive_test_2.cc: New file.
10215         * testsuite/thin_archive_test_3.cc: New file.
10216         * testsuite/thin_archive_test_4.cc: New file.
10217
10218 2008-09-29  Cary Coutant  <ccoutant@google.com>
10219
10220         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10221         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10222         instead of -1U.
10223         (Sized_relobj::do_finalize_local_symbols): Likewise.
10224         (Sized_relobj::map_to_kept_section): Likewise.
10225         * object.h (Sized_relobj::invalid_address): New constant.
10226         (Sized_relobj::do_output_section_offset): Check for invalid_address
10227         and return -1ULL.
10228         * output.cc (Output_reloc::local_section_offset): Use constant
10229         invalid_address instead of -1U.
10230         (Output_reloc::get_address): Likewise.
10231         (Output_section::output_address): Change -1U to -1ULL.
10232         * output.h (Output_reloc::invalid_address): New constant.
10233         * reloc.cc (Sized_relobj::write_sections): Use constant
10234         invalid_address instead of -1U.
10235         (Sized_relobj::relocate_sections): Likewise.
10236         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10237         values for merge sections.
10238         * target-reloc.h (relocate_for_relocatable): Use constant
10239         invalid_address instead of -1U.
10240
10241 2008-09-19  Cary Coutant  <ccoutant@google.com>
10242
10243         Add plugin functionality for link-time optimization (LTO).
10244         * configure.ac (plugins): Add --enable-plugins option.
10245         * configure: Regenerate.
10246         * config.in: Regenerate.
10247         * Makefile.am (LIBDL): New variable.
10248         (CCFILES): Add plugin.cc.
10249         (HFILES): Add plugin.h.
10250         (ldadd_var): Add LIBDL.
10251         * Makefile.in: Regenerate.
10252
10253         * archive.cc: Include "plugin.h".
10254         (Archive::setup): Don't preread archive symbols when using a plugin.
10255         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10256         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10257         files.
10258         (Archive::include_member): Add symbols from plugin objects.
10259         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10260         * descriptors.cc (Descriptors::open): Check for file descriptors
10261         abandoned by plugins.
10262         (Descriptors::claim_for_plugin): New function.
10263         * descriptors.h (Descriptors::claim_for_plugin): New function.
10264         (Open_descriptor::is_claimed): New field.
10265         (claim_descriptor_for_plugin): New function.
10266         * fileread.cc (File_read::claim_for_plugin): New function.
10267         * fileread.h (File_read::claim_for_plugin): New function.
10268         (File_read::descriptor): New function.
10269         * gold.cc: Include "plugin.h".
10270         (queue_initial_tasks): Add task to call plugin hooks for generating
10271         new object files.
10272         * main.cc: Include "plugin.h".
10273         (main): Load plugin libraries.
10274         * object.h (Pluginobj): Declare.
10275         (Object::pluginobj): New function.
10276         (Object::do_pluginobj): New function.
10277         (Object::set_target): New function.
10278         * options.cc: Include "plugin.h".
10279         (General_options::parse_plugin): New function.
10280         (General_options::General_options): Initialize plugins_ field.
10281         (General_options::add_plugin): New function.
10282         * options.h (Plugin_manager): Declare.
10283         (General_options): Add --plugin option.
10284         (General_options::has_plugins): New function.
10285         (General_options::plugins): New function.
10286         (General_options::add_plugin): New function.
10287         (General_options::plugins_): New field.
10288         * plugin.cc: New file.
10289         * plugin.h: New file.
10290         * readsyms.cc: Include "plugin.h".
10291         (Read_symbols::do_read_symbols): Check for archive before checking
10292         for ELF file.  Call plugin hooks to claim files.
10293         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10294         from a real object file; force override when processing replacement
10295         files.
10296         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10297         (Symbol::init_base_object): Likewise.
10298         (Symbol::init_base_output_data): Likewise.
10299         (Symbol::init_base_output_segment): Likewise.
10300         (Symbol::init_base_constant): Likewise.
10301         (Symbol::init_base_undefined): Likewise.
10302         (Symbol::output_section): Assert that object is not a plugin.
10303         (Symbol_table::add_from_pluginobj): New function.
10304         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10305         undefined.
10306         (Symbol_table::sized_write_globals): Likewise.
10307         (Symbol_table::add_from_pluginobj): Instantiate template.
10308         * symtab.h (Sized_pluginobj): Declare.
10309         (Symbol::in_real_elf): New function.
10310         (Symbol::set_in_real_elf): New function.
10311         (Symbol::in_real_elf_): New field.
10312         (Symbol_table::add_from_pluginobj): New function.
10313
10314         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10315         (LIBDL): New variable.
10316         (LDADD): Add LIBDL.
10317         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10318         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10319         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10320         (MOSTLYCLEANFILES): Likewise.
10321         * testsuite/Makefile.in: Regenerate.
10322         * testsuite/plugin_test.c: New file.
10323         * testsuite/plugin_test_1.sh: New file.
10324         * testsuite/plugin_test_2.sh: New file.
10325
10326 2008-09-16  Ian Lance Taylor  <iant@google.com>
10327
10328         * target-reloc.h (relocate_section): Check whether a symbol is
10329         defined by the ABI before reporting an undefined symbol error.
10330         * target.h (Target::is_defined_by_abi): Make parameter const.
10331         (Target::do_is_defined_by_abi): Likewise.
10332         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10333         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10334         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10335         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10336         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10337         * testsuite/Makefile.in: Rebuild.
10338
10339         * fileread.cc (make_view): Add casts to avoid warning.
10340
10341 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10342
10343         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10344         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10345
10346 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10347
10348         * options.h (General_options::output_is_executable): New.
10349         (General_options::output_is_pie): New.
10350         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10351         for shared libraries.
10352         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10353
10354 2008-09-11  Chris Demetriou  <cgd@google.com>
10355
10356         * options.h (origin): New -z option.
10357         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10358         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10359         in DT_FLAGS_1.
10360
10361 2008-09-05  Cary Coutant  <ccoutant@google.com>
10362
10363         * fileread.cc (File_read::make_view): Add check for attempt to map
10364         beyond end of file.
10365
10366 2008-09-05  Cary Coutant  <ccoutant@google.com>
10367
10368         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10369         explicit instantiations.
10370
10371 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10372
10373         PR gold/6858
10374         * options.cc (General_options::finalize): Allow undefined symbols
10375         in shlibs if linking -shared.
10376
10377         PR gold/6859
10378         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10379         symbols as not needing a dynsym entry.
10380
10381 2008-08-20  Craig Silverstein  <csilvers@google.com>
10382
10383         * fileread.cc (File_read::open): Do not lock the file unless it
10384         was successfully opened.
10385
10386 2008-08-14  Cary Coutant  <ccoutant@google.com>
10387
10388         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10389         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10390         * testsuite/tls_test.cc (struct int128): 128-bit struct
10391         for testing TLS relocs with non-zero addend.
10392         (v12): New TLS variable.
10393         (t12): New test.
10394         (t_last): Add check for v12.
10395         * testsuite/tls_test.h (t12): New function.
10396         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10397
10398 2008-08-13  Ian Lance Taylor  <iant@google.com>
10399
10400         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10401         set tls_segment_ or relro_segment_.
10402         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10403         when appropriate.
10404         * output.h (Output_section::clear_is_relro): New function.
10405         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10406         sections specially even when output_data_ is empty.
10407         (Output_segment::maximum_alignment): When first section is relro,
10408         only force alignment for PT_LOAD segments.
10409         * script.cc (script_data_segment_align): New function.
10410         (script_data_segment_relro_end): New function.
10411         * script-c.h (script_data_segment_align): Declare.
10412         (script_data_segment_relro_end): Declare.
10413         * script-sections.h (class Script_sections): Declare
10414         data_segment_align and data_segment_relro_end.  Add fields
10415         segment_align_index_ and saw_relro_end_.
10416         * script-sections.cc (class Sections_element): Add set_is_relro
10417         virtual function.  Add new bool* parameter to place_orphan_here.
10418         Add get_output_section virtual function.
10419         (class Output_section_definition): Add set_is_relro.  Add new
10420         bool* parameter to place_orphan_here.  Add get_output_section.
10421         Add is_relro_ field.
10422         (Output_section_definition::Output_section_definition): Initialize
10423         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10424         and is_relro_ fields.
10425         (Output_section_definition::place_orphan_here): Add is_relro
10426         parameter.
10427         (Output_section_definition::set_section_addresses): Set relro for
10428         output section.
10429         (Output_section_definition::alternate_constraint): Likewise.
10430         (class Orphan_output_section): Add new bool* parameter to
10431         place_orphan_here.  Add get_output_section.
10432         (Orphan_output_section::place_orphan_here): Add is_relro
10433         parameter.
10434         (Script_sections::Script_sections): Initialize
10435         data_segment_align_index_ and saw_relro_end_.
10436         (Script_sections::data_segment_align): New function.
10437         (Script_sections::data_segment_relro_end): New function.
10438         (Script_sections::place_orphan): Set or clear is_relro.
10439         (Script_sections::set_section_addresses): Force alignment of first
10440         TLS section.
10441         * yyscript.y (exp): Call script_data_segment_align and
10442         script_data_segment_relro_end.
10443         * testsuite/relro_script_test.t: New file.
10444         * testsuite/relro_test.cc (using_script): Declare.
10445         (t1, t2): Test using_script.
10446         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10447         (relro_script_test_SOURCES): Define.
10448         (relro_script_test_DEPENDENCIES): Define.
10449         (relro_script_test_LDFLAGS): Define.
10450         (relro_script_test_LDADD): Define.
10451         (relro_script_test.so): New target.
10452         * testsuite/Makefile.in: Rebuild.
10453
10454 2008-08-06  Cary Coutant <ccoutant@google.com>
10455
10456         * archive.cc (Archive::total_archives, Archive::total_members)
10457         (Archive::total_members_loaded): New variables.
10458         (Archive::setup): Add parameter.  Add option to preread
10459         archive symbols.
10460         (Archive::read_armap): Add counter.
10461         (Archive::get_file_and_offset): New function.
10462         (Archive::get_elf_object_for_member): New function.
10463         (Archive::read_all_symbols): New function.
10464         (Archive::read_symbols): New function.
10465         (Archive::add_symbols): Add counters.
10466         (Archive::include_all_members): Use armap to find members if it's
10467         already built.
10468         (Archive::include_member): Skip reading symbols if already read.
10469         Factored code into Archive::get_file_and_offset and
10470         Archive::get_elf_object_for_member.  Changed call to
10471         Mapfile::report_include_archive_member.
10472         (Archive::print_stats): New function.
10473         * archive.h: Declare Object and Read_symbols_data classes.
10474         (Archive::Archive): Add initializers for new members.
10475         (Archive::setup): Add parameter.
10476         (Archive::print_stats): New function.
10477         (Archive::total_archives, Archive::total_members)
10478         (Archive::total_members_loaded): New variables.
10479         (Archive::get_file_and_offset): New function.
10480         (Archive::get_elf_object_for_member): New function.
10481         (Archive::read_all_symbols): New function.
10482         (Archive::read_symbols): New function.
10483         (Archive::Archive_member): New class.
10484         (Archive::members_): New member.
10485         (Archive::num_members_): New member.
10486         * main.cc: Include archive.h.
10487         (main): Call Archive::print_stats.
10488         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10489         archive parameter; member_name is now the fully-decorated name.
10490         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10491         * options.h: (General_options): Add --preread-archive-symbols option.
10492         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10493         Archive::setup.
10494
10495 2008-08-04  Ian Lance Taylor  <iant@google.com>
10496
10497         * symtab.h (Symbol::use_plt_offset): New function.
10498         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10499         * powerpc.cc (Relocate::relocate): Likewise.
10500         * sparc.cc (Relocate::relocate): Likewise.
10501         * x86_64.cc (Relocate::relocate): Likewise.
10502         * testsuite/weak_plt.sh: New test.
10503         * testsuite/weak_plt_main.cc: New test.
10504         * testsuite/weak_plt_shared.cc: New test.
10505         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10506         (check_PROGRAMS): Add weak_plt.
10507         (check_DATA): Add weak_plt_shared.so.
10508         (weak_plt_main_pic.o, weak_plt): New targets.
10509         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10510         * testsuite/Makefile.in: Rebuild.
10511
10512         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10513         gcctestdir/ld.
10514         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10515         * testsuite/Makefile.in: Rebuild.
10516
10517 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10518
10519         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10520         * Makefile.in: Regenerate.
10521         * po/POTFILES.in: Regenerate.
10522
10523 2008-07-29  Ian Lance Taylor  <iant@google.com>
10524
10525         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10526         symbols before other symbols.
10527         * testsuite/script_test_2.cc (test_addr): Declare.
10528         (test_addr_alias): Declare.
10529         (main): Check that test_addr and test_addr_alias have the right
10530         values.
10531         * testsuite/script_test_2.t: Define test_addr_alias and
10532         test_addr.
10533
10534 2008-07-24  Ian Lance Taylor  <iant@google.com>
10535
10536         PR 5990
10537         * descriptors.cc: New file.
10538         * descriptors.h: New file.
10539         * gold-threads.h (class Hold_optional_lock): New class.
10540         * fileread.cc: Include "descriptors.h".
10541         (File_read::~File_read): Release descriptor rather than closing
10542         it.
10543         (File_read::open) [file]: Call open_descriptor rather than open.
10544         Set is_descriptor_opened_.
10545         (File_read::open) [memory]: Assert that descriptor is not open.
10546         (File_read::reopen_descriptor): New function.
10547         (File_read::release): Release descriptor.
10548         (File_read::do_read): Make non-const.  Reopen descriptor.
10549         (File_read::read): Make non-const.
10550         (File_read::make_view): Reopen descriptor.
10551         (File_read::do_readv): Likewise.
10552         * fileread.h (class File_read): Add is_descriptor_opened_ field.
10553         Update declarations.
10554         * layout.cc: Include "descriptors.h".
10555         (Layout::create_build_id): Use open_descriptor rather than open.
10556         * output.cc: Include "descriptors.h".
10557         (Output_file::open): Use open_descriptor rather than open.
10558         * archive.cc (Archive::const_iterator): Change Archive to be
10559         non-const.
10560         (Archive::begin, Archive::end): Make non-const.
10561         (Archive::count_members): Likewise.
10562         * archive.h (class Archive): Update declarations.
10563         * object.h (Object::read): Make non-const.
10564         * Makefile.am (CCFILES): Add descriptors.cc.
10565         (HFILES): Add descriptors.h.
10566         * Makefile.in: Rebuild.
10567
10568         PR 6716
10569         * gold.h: Always include <clocale>.  Add Solaris workarounds
10570         following code in binutils/sysdep.h.
10571
10572         PR 6048
10573         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10574         this->eh_frame_hdr_ is NULL before using it.
10575
10576         * dynobj.cc (Versions::Versions): Update comment.
10577
10578         * dynobj.cc (Versions::Versions): If there is an soname, use it as
10579         the base version name.
10580
10581         * stringpool.cc (Stringpool_template::add_with_length): Set key to
10582         array size plus one.
10583         (Stringpool_template::set_string_offsets): Subtract one from key
10584         before using it as an array index.
10585         (Stringpool_template::get_offset_with_length): Likewise.
10586         (Stringpool_template::write_to_buffer): Likewise.
10587         * stringpool.h (Stringpool_template::get_offset_from_key):
10588         Likewise.
10589
10590 2008-07-23  Ian Lance Taylor  <iant@google.com>
10591
10592         PR 6658
10593         * object.h (Merged_symbol_value::value): Do our best to handle a
10594         negative addend.
10595
10596         PR 6647
10597         * script.cc (Version_script_info::get_versions): Don't add empty
10598         version tag to return value.
10599         (Version_script_info::get_symbol_version_helper): Change return
10600         type to bool.  Add pversion parameter.  Change all callers.
10601         (script_register_vers_node): Don't require a non-NULL tag.
10602         * script.h (class Version_script_info): Update declarations.
10603         (Version_script_info::get_symbol_version): Change return type to
10604         bool.  Add version parameter.  Change all callers.
10605         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10606         handling.  Handle an empty version from a version script.
10607         (Symbol_table::define_special_symbol): Likewise.
10608         * testsuite/ver_test_10.script: New file.
10609         * testsuite/ver_test_10.sh: New file.
10610         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10611         (check_DATA): Add ver_test_10.syms.
10612         (ver_test_10.syms, ver_test_10.so): New target.
10613         * testsuite/Makefile.in: Rebuild.
10614
10615 2008-07-23  Simon Baldwin  <simonb@google.com>
10616
10617         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10618         to zero for undefined symbols from dynamic libraries.
10619
10620 2008-07-23  Ian Lance Taylor  <iant@google.com>
10621
10622         * symtab.cc (Symbol_table::resolve): Remove version parameter.
10623         Change all callers.
10624         * symtab.h (class Symbol_table): Update declaration.
10625         * testsuite/ver_test_9.cc: New file.
10626         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10627         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10628         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10629         (ver_test_9.so, ver_test_9.o): New targets.
10630         * testsuite/Makefile.in: Rebuild.
10631
10632 2008-07-22  Ian Lance Taylor  <iant@google.com>
10633
10634         * options.h (class General_options): Define --check-sections.
10635         * layout.cc (Layout::set_segment_offsets): Handle
10636         --check-sections.
10637
10638         * options.h (class General_options): Define -n/--nmagic and
10639         -N/--omagic.
10640         * options.cc (General_options::finalize): For -n/--nmagic or
10641         -N/--omagic, set -static.
10642         * layout.cc (Layout::attach_allocated_section_to_segment): If
10643         -N/--omagic, don't put read-only and read-write sections in
10644         different segments.
10645         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10646         finding a read-only segment.
10647         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10648         don't set the minimum segment alignment to the common page size,
10649         and don't set the file offset to the address modulo the page size.
10650         * script-sections.cc (Script_sections::create_segments): If
10651         -n/--omagic, don't put read-only and read-write sections in
10652         different segments.
10653
10654         * cref.cc: New file.
10655         * cref.h: New file.
10656         * options.h (class General_options): Add --print-symbol-counts.
10657         * main.cc (main): Issue defined symbol report if requested.
10658         * archive.cc (Archive::interpret_header): Make into a const member
10659         function.
10660         (Archive::add_symbols): Call Input_objects::archive_start and
10661         archive_stop.
10662         (Archive::const_iterator): Define new class.
10663         (Archive::begin, Archive::end): New functions.
10664         (Archive::include_all_members): Rewrite to use iterator.
10665         (Archive::count_members): New function.
10666         * archive.h (class Archive): Update declarations.
10667         (Archive::filename): New function.
10668         * object.cc: Include "cref.h".
10669         (Sized_relobj::Sized_relobj): Initialize defined_count_.
10670         (Sized_relobj::do_get_global_symbol_counts): New function.
10671         (Input_objects::add_object): Add object to cross-referencer.
10672         (Input_objects::archive_start): New function.
10673         (Input_objects::archive_stop): New function.
10674         (Input_objects::print_symbol_counts): New function.
10675         * object.h: Declare Cref and Archive.
10676         (Object::get_global_symbol_counts): New function.
10677         (Object::do_get_global_symbol_counts): New pure virtual function.
10678         (class Sized_relobj): Add defined_count_ field.  Update
10679         declarations.
10680         (class Input_objects): Add cref_ field.  Update constructor.
10681         Update declarations.
10682         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10683         defined_count_.
10684         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10685         symbol counts.
10686         (Sized_dynobj::do_get_global_symbol_counts): New function.
10687         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10688         defined_count_.  Update declarations.  Define Symbols typedef.
10689         * symtab.cc (Symbol_table::add_from_relobj): Add defined
10690         parameter.  Change all callers.
10691         (Symbol_table::add_from_dynobj): Add sympointers and defined
10692         parameters.  Change all callers.
10693         * symtab.h (class Symbol_table): Update declarations.
10694         * Makefile.am (CCFILES): Add cref.cc.
10695         (HFILES): Add cref.h.
10696         * Makefile.in: Rebuild.
10697
10698 2008-07-22  Simon Baldwin  <simonb@google.com>
10699
10700         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10701         to zero when writing undefined symbols.
10702
10703 2008-07-22  Ian Lance Taylor  <iant@google.com>
10704
10705         * output.cc (Output_section::add_input_section): Don't try to
10706         merge empty merge sections.
10707
10708 2008-07-21  Craig Silverstein  <csilvers@google.com>
10709
10710         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10711         Include symbol version in error message.
10712
10713 2008-07-20  Chris Demetriou  <cgd@google.com>
10714
10715         * configure.ac (gold_cv_c_random_seed): New configured variable.
10716         (RANDOM_SEED_CFLAGS): New substituted variable.
10717         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10718         * configure: Rebuild.
10719         * Makefile.in: Likewise.
10720         * testsuite/Makefile.in: Likewise.
10721
10722 2008-07-18  Ian Lance Taylor  <iant@google.com>
10723
10724         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10725         where we see NAME/NULL and NAME/VERSION  as separate symbols.
10726         * testsuite/ver_test_main.cc (main): Call t4.
10727         (t4, t4_2a): Define.
10728         * testsuite/ver_test_2.cc (t4_2): Define.
10729         * testsuite/ver_test_2.script: Put t4_2a in VER2.
10730         * testsuite/ver_test_4.cc (t4_2a): Define.
10731         * testsuite/ver_test_4.script: Put t4_2a in VER2.
10732         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10733
10734 2008-07-17  Ian Lance Taylor  <iant@google.com>
10735
10736         * dynobj.cc (Versions::add_def): If we give an error about a
10737         missing version, go ahead and create the version anyhow.
10738
10739 2008-07-10  Ian Lance Taylor  <iant@google.com>
10740
10741         Handle output sections with more than 0x7fffffff bytes.
10742         * object.h (class Relobj): Change map_to_output_ to
10743         output_sections_, and just keep a section pointer.  Change all
10744         uses.  Move comdat group support to Sized_relobj.
10745         (Relobj::is_section_specially_mapped): Remove.
10746         (Relobj::output_section): Remove poff parameter.  Change all
10747         callers.
10748         (Relobj::output_section_offset): New function.
10749         (Relobj::set_section_offset): Rewrite.
10750         (Relobj::map_to_output): Remove.
10751         (Relobj::output_sections): New function.
10752         (Relobj::do_output_section_offset): New pure virtual function.
10753         (Relobj::do_set_section_offset): Likewise.
10754         (class Sized_relobj): Add section_offsets_ field.  Add comdat
10755         group support from Relobj.  Update declarations.
10756         (Sized_relobj::get_output_section_offset): New function.
10757         (Sized_relobj::do_output_section_offset): New function.
10758         (Sized_relobj::do_set_section_offset): New function.
10759         * object.cc (Relobj::output_section_address): Remove.
10760         (Sized_relobj::Sized_relobj): Initialize new fields.
10761         (Sized_relobj::include_section_group): Cast find_kept_object to
10762         Sized_relobj.
10763         (Sized_relobj::include_linkonce_section): Likewise.
10764         (Sized_relobj::do_layout): Use separate arrays for output section
10765         and output offset.
10766         (Sized_relobj::do_count_local_symbols): Change map_to_output to
10767         output_sections.
10768         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10769         output_sections and section_offsets.
10770         (Sized_relobj::write_local_symbols): Likewise.
10771         (map_to_kept_section): Compute output address directly.
10772         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10773         output_sections and section_offsets.
10774         (Sized_relobj::write_sections): Likewise.
10775         (Sized_relobj::relocate_sections): Likewise.
10776         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10777         * output.h (class Output_reloc): Update declarations.  Change
10778         u2_.relobj to Sized_relobj*.
10779         (class Output_data_reloc): Change add functions to use
10780         Sized_relobj*.
10781         * output.cc (Output_reloc::Output_reloc): Change relobj to
10782         Sized_relobj*.
10783         (Output_reloc::local_section_offset): Change return type to
10784         Elf_Addr.  Use get_output_section_offset.
10785         (Output_reloc::get_address): Likewise.
10786         (Output_section::is_input_address_mapped): Don't call
10787         is_section_specially_mapped.
10788         (Output_section::output_offset): Likewise.
10789         (Output_section::output_address): Likewise.
10790         (Output_section::starting_output_address): Likewise.
10791         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10792         parameter to Sized_relobj*.
10793         (Copy_relocs::need_copy_reloc): Likewise.
10794         (Copy_relocs::save): Likewise.
10795         * copy-relocs.h (class Copy_relocs): Update declarations.
10796         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10797         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
10798         * target-reloc.h (relocate_for_relocatable): Change
10799         offset_in_output_section type to Elf_Addr.  Change code that uses
10800         it as well.
10801         * layout.cc (Layout::layout): Always set *off.
10802         * mapfile.cc (Mapfile::print_input_section): Use
10803         output_section_offset.
10804         * i386.cc (Target_i386::copy_reloc): Change object parameter to
10805         Sized_relobj*.
10806         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10807         * sparc.cc (Target_sparc::copy_reloc): Likewise.
10808         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10809
10810 2008-07-03  Ian Lance Taylor  <iant@google.com>
10811
10812         * layout.cc (Layout::include_section): Do not discard unrecognized
10813         SHT_STRTAB sections.
10814
10815 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
10816
10817         * script.cc (Lex::can_continue_name): Make '?' allowable in
10818         version-script names.
10819         * testsuite/version_script.map: Change glob pattern to use '?'
10820
10821 2008-06-30  Manish Singh  <yosh@gimp.org>
10822
10823         PR 6585
10824         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10825         Correct typo.
10826
10827 2008-06-30  Ian Lance Taylor  <iant@google.com>
10828
10829         PR 6660
10830         PR 6682
10831         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10832         versions]: Don't try to read the value in the contents, since we
10833         don't use it.  Use the template endianness when writing.
10834
10835 2008-06-25  Cary Coutant  <ccoutant@google.com>
10836
10837         * fileread.cc (File_read::make_view): Assert on zero-length view.
10838         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10839         symbol table when there are no symbols to read.
10840
10841 2008-06-23  Craig Silverstein  <csilvers@google.com>
10842
10843         * version.cc (version_string): Bump to 1.7
10844
10845 2008-06-18  Craig Silverstein  <csilvers@google.com>
10846
10847         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10848         constant 0xFFFF to type Valtype.
10849         (Powerpc_relocate_functions::rel16_ha): Likewise.
10850
10851 2008-06-17  Ian Lance Taylor  <iant@google.com>
10852
10853         * output.h (Output_section::Input_section): Initialize p2align_ to
10854         zero for Output_section_data constructors.
10855         (Output_section::Input_section::addralign): If not an input
10856         section, return the alignment of the Output_section_data.
10857         * testsuite/copy_test.cc: New file.
10858         * testsuite/copy_test_1.cc: New file.
10859         * testsuite/copy_test_2.cc: New file.
10860         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10861         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10862         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10863         (copy_test_1_pic.o, copy_test_1.so): New targets.
10864         (copy_test_2_pic.o, copy_test_2.so): New targets.
10865         * testsuite/Makefile.in: Rebuild.
10866
10867         * script-sections.cc (Script_sections::place_orphan): Initialize
10868         local variable exact.
10869
10870 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
10871
10872         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10873
10874 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
10875             David S. Miller  <davem@davemloft.net>
10876
10877         * powerpc.cc: New file.
10878         * Makefile.am (TARGETSOURCES): Add powerpc.cc
10879         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10880         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10881         * Makefile.in: Rebuild.
10882
10883 2008-06-09  Ian Lance Taylor  <iant@google.com>
10884
10885         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10886         <exception>.
10887         (throwing, orig_terminate): New static variables.
10888         (terminate_handler): New static function.
10889         (t2): Set terminate handler.
10890
10891 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
10892
10893         PR 6584
10894         * binary.cc (Binary_to_elf::sized_convert): Fix .data
10895         alignment.
10896
10897 2008-05-30  Cary Coutant  <ccoutant@google.com>
10898
10899         * archive.cc (Archive::include_all_members) Correct to step
10900         over symbol table and extended name table in thin archives.
10901
10902 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
10903
10904         PR 6407
10905         * target-reloc.h (relocate_for_relocatable): Fix new_offset
10906         calculation.
10907
10908 2008-05-28  Caleb Howe  <cshowe@google.com>
10909
10910         * reduced_debug_output.cc: New file.
10911         * reduced_debug_output.h: New file.
10912         * options.h (class General_options): Add --strip-debug-non-line.
10913         * options.cc (General_options::finalize): Add strip_debug_non_line
10914         to the strip heirarchy.
10915         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10916         fields.
10917         * layout.cc: Include "reduced_debug_output.h".
10918         (Layout::Layout): Initialize new fields.
10919         (line_only_debug_sections): New static array.
10920         (is_lines_only_debug_sections): New static inline function.
10921         (Layout::include_section): Handle --strip-debug-non-line.
10922         (Layout::make_output_section): If --strip-debug-non-line, build
10923         new output sections for .debug_abbrev and .debug_info.
10924         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10925         gold.  Warn about possible overflow.
10926         (read_signed_LEB_128): Likewise.
10927         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10928         (read_signed_LEB_128): Declare.
10929         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10930         (HFILES): Add reduced_debug_output.h.
10931         * Makefile.in: Rebuild.
10932
10933 2008-05-21  Ian Lance Taylor  <iant@google.com>
10934
10935         * mapfile.cc: New file.
10936         * mapfile.h: New file.
10937         * options.h (class General_options): Add -M/--print-map and -Map.
10938         * options.cc (General_options::finalize): Make -M equivalent to
10939         -Map -.
10940         * main.cc: Include <cstdio> and "mapfile.h".
10941         (main): Open mapfile if requested.
10942         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
10943         constructor.  Change caller.
10944         (queue_initial_tasks): Add mapfile parameter.  Change caller.
10945         (queue_middle_tasks): Likewise.
10946         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10947         declarations.
10948         * archive.cc: Include "mapfile.h".
10949         (Archive::add_symbols): Add mapfile parameter.  Change all
10950         callers.  Pass mapfile, symbol, and reason to include_member.
10951         (Archive::include_all_members): Add mapfile parameter.  Change all
10952         callers.
10953         (Archive::include_member): Add mapfile, sym, and why parameters.
10954         Change all callers.  Report inclusion to map file.
10955         * archive.h: Include "fileread.h".
10956         (class Archive): Update declarations.
10957         (Archive::file): New const method.
10958         (class Add_archive_symbols): Add mapfile_ field.  Update
10959         constructor.  Change all callers.
10960         * readsyms.h (class Read_symbols): Likewise.
10961         (class Finish_group): Likewise.
10962         (class Read_script): Likewise.
10963         * common.cc: Include "mapfile.h".
10964         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
10965         all callers.
10966         (Symbol_table::do_allocate_commons): Likewise.
10967         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
10968         symbol allocation to mapfile.
10969         * common.h (class Allocate_commons_task): Add mapfile_ field.
10970         Update constructor.  Change all callers.
10971         * symtab.h (class Symbol_table): Update declarations.
10972         * layout.cc: Include "mapfile.h".
10973         (Layout_task_runner::run): Print information to mapfile.
10974         (Layout::create_gold_note): Change Output_data_fixed_space to
10975         Output_data_zero_fill.
10976         (Layout::create_build_id): Likewise.
10977         (Layout::print_to_mapfile): New function.
10978         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
10979         constructor.  Change caller.
10980         (class Layout): Declare print_to_mapfile.
10981         * output.cc (Output_section::Input_section::print_to_mapfile): New
10982         function.
10983         (Output_section::add_input_section): If producing a map, always
10984         add to input_sections_ list.
10985         (Output_section::do_print_to_mapfile): New function.
10986         (Output_segment::print_sections_to_mapfile): New function.
10987         (Output_segment::print_section_list_to_mapfile): New function.
10988         * output.h: Include "mapfile.h".
10989         (Output_data::print_to_mapfile): New function.
10990         (Output_data::do_print_to_mapfile): New virtual function.
10991         (Output_segment_headers::do_print_to_mapfile): New function.
10992         (Output_file_header::do_print_to_mapfile): New function.
10993         (Output_data_const::do_print_to_mapfile): New function.
10994         (class Output_data_const_buffer): Add map_name_ field.  Update
10995         constructor.  Change all callers.  Add do_print_to_mapfile
10996         function.
10997         (class Output_data_fixed_space): Likewise.
10998         (class Output_data_space): Likewise.
10999         (class Output_data_zero_fill): New class.
11000         (Output_data_strtab::do_print_to_mapfile): New function.
11001         (Output_data_reloc_base::do_print_to_mapfile): New function.
11002         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11003         (Output_data_group::do_print_to_mapfile): New function.
11004         (Output_data_got::do_print_to_mapfile): New function.
11005         (Output_data_dynamic::do_print_to_mapfile): New function.
11006         (Output_symtab_xindex::do_print_to_mapfile): New function.
11007         (class Output_section): Declare do_print_to_mapflie.  Declare
11008         print_to_mapfile in Input_section.
11009         (class Output_segment): Declare new functions.
11010         * object.h (Sized_relobj::symbol_count): New function.
11011         * script-sections.cc
11012         (Output_section_element_dot_assignment::set_section_addresses):
11013         Change Output_data_fixed_space to Output_data_zero_fill.
11014         (Output_data_expression::do_print_to_mapfile): New function.
11015         * script.cc (read_input_script): Add mapfile parameter.  Change
11016         all callers.
11017         * script.h (read_input_script): Update declaration.
11018         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11019         (Eh_frame::do_print_to_mapfile): New function.
11020         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11021         (Output_merge_string::do_print_to_mapfile): New function.
11022         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11023         function.
11024         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11025         function.
11026         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11027         function.
11028         * Makefile.am (CCFILES): Add mapfile.cc.
11029         (HFILES): Add mapfile.h.
11030         * Makefile.in: Rebuild.
11031
11032 2008-05-19  Ian Lance Taylor  <iant@google.com>
11033
11034         * options.h (class General_options): Add -z relro.
11035         * layout.cc (Layout::Layout): Initialize relro_segment_.
11036         (Layout::add_output_section_data): Return the output section.
11037         (Layout::make_output_section): Rcognize relro sections and mark
11038         them appropriately.
11039         (Layout::attach_allocated_section_to_segment): Put relro sections
11040         in a PT_GNU_RELRO segment.
11041         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11042         section as relro.
11043         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11044         PT_TLS segments.
11045         (Layout::linkonce_mapping): Map d.rel.ro.local to
11046         .data.rel.ro.local.
11047         (Layout::output_section_name): Us .data.rel.ro.local for any
11048         section which begins with that.
11049         * layout.h (class Layout): Update add_output_section_data
11050         declaration.  Add relro_segment_ field.
11051         * output.cc (Output_section::Output_section): Initialize is_relro_
11052         and is_relro_local_ fields.
11053         (Output_segment::add_output_section): Group relro sections.
11054         (Output_segment::is_first_section_relro): New function.
11055         (Output_segment::maximum_alignment): If there is a relro section,
11056         align the segment to the common page size.
11057         (Output_segment::set_section_addresses): Track whether we are
11058         looking at relro sections.  If the last section is a relro
11059         section, align to the common page size.
11060         (Output_segment::set_section_list_addresses): Add in_relro
11061         parameter.  Change all callers.  Align to the page size when
11062         moving from relro to non-relro section.
11063         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11064         segment.
11065         * output.h (class Output_section): Add is_relro_ and
11066         is_relro_local_ fields.
11067         (Output_section::is_relro): New function.
11068         (Output_section::set_is_relro): New function.
11069         (Output_section::is_relro_local): New function.
11070         (Output_section::set_is_relro_local): New function.
11071         (class Output_segment): Update declarations.
11072         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11073         * sparc.cc (Target_sparc::got_section): Likewise.
11074         * x86_64.cc (Target_x86_64::got_section): Likewise.
11075         * testsuite/relro_test_main.cc: New file.
11076         * testsuite/relro_test.cc: New file.
11077         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11078         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11079         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11080         (relro_test.so, relro_test_pic.o): New targets.
11081         * testsuite/Makefile.in: Rebuild.
11082
11083 2008-05-16  Ian Lance Taylor  <iant@google.com>
11084
11085         * output.cc (Output_segment::add_output_section): Remove front
11086         parameter.
11087         * output.h (class Output_segment): Remove
11088         add_initial_output_section and overloaded add_output_section.
11089         Update declaration of remaining add_output_section.
11090         * layout.cc (Layout::create_interp): Call add_output_section
11091         rather than add_initial_output_section.
11092         (Layout::finish_dynamic_section): Likewise.
11093
11094         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11095         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11096         know the dynamic type.
11097         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11098         field.  Initialize it in constructor.
11099         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11100         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11101         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11102         reloc.
11103
11104         * output.cc (Output_reloc::get_address): Change return type to
11105         Elf_Addr.
11106         * output.h (class Output_reloc): Update get_address declaration.
11107         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11108         for section addresses.
11109
11110 2008-05-09  Ian Lance Taylor  <iant@google.com>
11111
11112         PR 6493
11113         * gold.cc (gold_nomem): Use return value of write.
11114
11115 2008-05-08  Ian Lance Taylor  <iant@google.com>
11116
11117         * symtab.c (Symbol::init_base_output_data): Add version
11118         parameter.  Change all callers.
11119         (Symbol::init_base_output_segment): Likewise.
11120         (Symbol::init_base_constant): Likewise.
11121         (Symbol::init_base_undefined): Likewise.
11122         (Sized_symbol::init_output_data): Likewise.
11123         (Sized_symbol::init_output_segment): Likewise.
11124         (Sized_symbol::init_constant): Likewise.
11125         (Sized_symbol::init_undefined): Likewise.
11126         (Symbol_table::do_define_in_output_data): If the new symbol has a
11127         version, mark it as the default.
11128         (Symbol_table::do_define_in_output_segment): Likewise.
11129         (Symbol_table::do_define_as_constant): Likewise.
11130         * symtab.h (class Symbol): Update declarations.
11131         (class Sized_symbol): Likewise.
11132         * resolve.cc (Symbol::override_version): New function.
11133         (Symbol::override_base): Call override_version.
11134         (Symbol::override_base_with_special): Likewise.
11135         * testsuite/ver_script_8.script: New file.
11136         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11137         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11138         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11139         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11140
11141 2008-05-06  Ian Lance Taylor  <iant@google.com>
11142
11143         PR 6049
11144         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11145         functions.
11146         (class General_options): Remove existing --undefined, and add
11147         --no-undefined instead.  Add new --undefined as synonym for -u.
11148         * archive.cc (Archive::add_symbols): Check whether symbol was
11149         named with -u.
11150         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11151         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11152         all uses.  Add IS_UNDEFINED.  Update declarations to split
11153         different versions of init_base.  Declare init_base_undefined.
11154         (Symbol::is_defined): Handle IS_UNDEFINED.
11155         (Symbol::is_undefined): Likewise.
11156         (Symbol::is_weak_undefined): Call is_undefined.
11157         (Symbol::is_absolute): Handle IS_CONSTANT.
11158         (class Sized_symbol): Update declarations to split different
11159         versions of init.  Declare init_undefined.
11160         (class Symbol_table): Declare new functions.
11161         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11162         Change all callers.
11163         (Symbol::init_base_output_data): Likewise.
11164         (Symbol::init_base_output_segment): Likewise.
11165         (Symbol::init_base_constant): Likewise.
11166         (Symbol::init_base_undefined): New function.
11167         (Sized_symbol::init_object): Rename from init.  Change all
11168         callers.
11169         (Sized_symbol::init_output_data): Likewise.
11170         (Sized_symbol::init_output_segment): Likewise.
11171         (Sized_symbol::init_constant): Likewise.
11172         (Sized_symbol::init_undefined): New function.
11173         (Symbol_table::add_undefined_symbols_from_command_line): New
11174         function.
11175         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11176         function.
11177         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11178         (Symbol::output_section): Likewise.
11179         (Symbol::set_output_section): Likewise.
11180         (Symbol_table::sized_finalize_symbol): Likewise.
11181         (Symbol_table::sized_write_globals): Likewise.
11182         * resolve.cc (Symbol_table::should_override): Likewise.
11183         (Symbol::override_base_with_special): Likewise.
11184
11185         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11186         symbol, change it to have default visibility.
11187         * testsuite/protected_1.cc: New file.
11188         * testsuite/protected_2.cc: New file.
11189         * testsuite/protected_3.cc: New file.
11190         * testsuite/protected_main_1.cc: New file.
11191         * testsuite/protected_main_2.cc: New file.
11192         * testsuite/protected_main_3.cc: New file.
11193         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11194         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11195         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11196         (protected_1.so): New target.
11197         (protected_1_pic.o, protected_2_pic.o): New targets.
11198         (protected_3_pic.o): New target.
11199         (check_PROGRAMS): Add protected_2.
11200         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11201         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11202         * testsuite/Makefile.in: Rebuild.
11203
11204         * options.h (DEFINE_var): Add set_user_set_##varname__.
11205         (DEFINE_bool_alias): New macro.
11206         (class General_options): Define -Bstatic using DEFINE_bool_alias
11207         rather than DEFINE_special.  Add --undefined as an alias for -z
11208         defs.
11209         * options.cc (General_options::parse_Bstatic): Remove.
11210
11211         * options.h (class General_options): Add --fatal-warnings.
11212         * main.cc (main): Implement --fatal-warnings.
11213         * errors.h (Errors::warning_count): New function.
11214
11215         * options.h (class General_options): Add -Bsymbolic-functions.
11216         * symtab.h (Symbol::is_preemptible): Check for
11217         -Bsymbolic-functions.
11218
11219 2008-05-05  Ian Lance Taylor  <iant@google.com>
11220
11221         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11222         as noVARNAME rather than no-VARNAME.
11223         (class General_options): Add option -z combreloc.
11224         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11225         get_address.
11226         (Output_reloc::sort_before) [SHT_REL]: New function.
11227         (Output_reloc::sort_before) [SHT_RELA]: New function.
11228         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11229         Sort_relocs_comparison.
11230         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11231         parameter.  Change all callers.
11232         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11233         sort_relocs parameter.  Change all callers.
11234         * output.cc (Output_reloc::get_address): New function, broken out
11235         of write_rel.
11236         (Output_reloc::write_rel): Call it.
11237         (Output_reloc::compare): New function.
11238         (Output_data_reloc_base::do_write): Optionally sort relocs.
11239
11240         * configure.ac: If targ_extra_obj is set, link it in.
11241         * configure.tgt: Initialize all variables.
11242         (x86_64*): Set targ_extra_obj and targ_extra_size.
11243         * configure: Rebuild.
11244
11245         * object.cc (Sized_relobj::include_section_group): Adjust section
11246         indexes read from group data.  Build vector to pass to
11247         layout_group.
11248         * layout.cc (Layout::layout_group): Add flags and shndxes
11249         parameters.  Remove contents parameter.  Change caller.  Update
11250         explicit instantiations.
11251         * layout.h (class Layout): Update layout_group declaration.
11252         * output.cc (Output_data_group::Output_data_group): Add flags and
11253         input_shndxes parameters.  Remove contents parameter.  Change
11254         caller.
11255         (Output_data_group::do_write): Change input_sections_ to
11256         input_shndxes_.
11257         * output.h (class Output_data_group): Update constructor
11258         declaration.  Rename input_sections_ to input_shndxes_.
11259         * testsuite/many_sections_test.cc: Add template.
11260
11261 2008-04-30  Cary Coutant  <ccoutant@google.com>
11262
11263         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11264
11265         * layout.cc (Layout::include_section): Refactored check for debug
11266         info section.
11267         (Layout::add_comdat): Add new parameters.  Change type
11268         of signature parameter.  Add object and shndx to signatures table.
11269         (Layout::find_kept_object): New function.
11270         * layout.h: Include <cstring>.
11271         (Layout::is_debug_info_section): New function.
11272         (Layout::add_comdat): Add new parameters.
11273         (Layout::find_kept_object): New function.
11274         (Layout::Kept_section): New struct.
11275         (Layout::Signatures): Change type of map range.
11276         * object.cc (Relobj::output_section_address): New function.
11277         (Sized_relobj::include_section_group): Add new parameters.  Change
11278         calls to Layout::add_comdat.  Change to build table of kept comdat
11279         groups and table mapping discarded sections to kept sections.
11280         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11281         (Sized_relobj::do_layout): Change calls to include_section_group and
11282         include_linkonce_section.
11283         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11284         value to zero when section is discarded.
11285         (Sized_relobj::map_to_kept_section): New function.
11286         * object.h (Relobj::output_section_address): New function.
11287         (Relobj::Comdat_group): New type.
11288         (Relobj::find_comdat_group): New function.
11289         (Relobj::Comdat_group_table): New type.
11290         (Relobj::Kept_comdat_section): New type.
11291         (Relobj::Kept_comdat_section_table): New type.
11292         (Relobj::add_comdat_group): New function.
11293         (Relobj::set_kept_comdat_section): New function.
11294         (Relobj::get_kept_comdat_section): New function.
11295         (Relobj::comdat_groups_): New field.
11296         (Relobj::kept_comdat_sections_): New field.
11297         (Symbol_value::input_value): Update comment.
11298         (Sized_relobj::map_to_kept_section) New function.
11299         (Sized_relobj::include_linkonce_section): Add new parameter.
11300         * target-reloc.h (Comdat_behavior): New type.
11301         (get_comdat_behavior): New function.
11302         (relocate_section): Add code to map a discarded section to the
11303         corresponding kept section when applying a relocation.
11304
11305 2008-04-30  Craig Silverstein  <csilvers@google.com>
11306
11307         * dwarf_reader.cc (next_generation_count): New static var.
11308         (Addr2line_cache_entry): New struct.
11309         (addr2line_cache): New static var.
11310         (Dwarf_line_info::one_addr2line): Added caching.
11311         (Dwarf_line_info::clear_addr2line_cache): New function.
11312         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11313         cache-size parameter.
11314         (Dwarf_line_info::one_addr2line_cache): New function.
11315         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11316         new cache-size argument to one_addr2line(), and clear cache.
11317
11318 2008-04-28  Cary Coutant  <ccoutant@google.com>
11319
11320         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11321         R_386_PC8 relocations.
11322
11323 2008-04-23  Ian Lance Taylor  <iant@google.com>
11324
11325         * object.cc (Sized_relobj::include_section_group): Check for
11326         invalid section group.
11327
11328         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11329         header size.
11330
11331         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11332         than read for file header.
11333         * archive.cc (Archive::include_member): Likewise.
11334
11335 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11336
11337         * aclocal.m4: Regenerate.
11338         * configure: Regenerate.
11339
11340 2008-04-19  Ian Lance Taylor  <iant@google.com>
11341
11342         * version.cc (version_string): Bump to 1.6.
11343
11344         * testsuite/Makefile.am (many_sections_r_test): New target.
11345         (many_sections_r_test_SOURCES): Remove.
11346         (many_sections_r_test_DEPENDENCIES): Remove.
11347         (many_sections_r_test_LDFLAGS): Remove.
11348         (many_sections_r_test_LDADD): Remove.
11349
11350         * object.cc (Sized_relobj::do_add_symbols): Always pass
11351         local_symbol_count_ to add_from_relobj.
11352
11353         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11354         every thousand variables.
11355         * testsuite/Makefile.in: Rebuild.
11356
11357         * object.cc (Xindex::initialize_symtab_xindex): New function.
11358         (Xindex::read_symtab_xindex): New function.
11359         (Xindex::sym_xindex_to_shndx): New function.
11360         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11361         available.
11362         (Sized_relobj::do_initialize_xindex): New function.
11363         (Sized_relobj::do_read_symbols): Adjust section links.
11364         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11365         parameter.  Change all callers.
11366         (Sized_relobj::include_section_group): Adjust section links and
11367         symbol section indexes.
11368         (Sized_relobj::do_layout): Adjust section links.
11369         (Sized_relobj::do_count_local_symbols): Adjust section links and
11370         symbol section indexes.
11371         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11372         ordinary and special symbols.
11373         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11374         dynsym_xindex parameters.  Change all callers.  Adjust section
11375         links.  Use SHN_XINDEX when needed.
11376         (Sized_relobj::get_symbol_location_info): Adjust section links.
11377         Don't get fooled by special symbols.
11378         * object.h (class Xindex): Define.
11379         (class Object): Add xindex_ parameter.  Declare virtual functoin
11380         do_initialize_xindex.
11381         (Object::adjust_sym_shndx): New function.
11382         (Object::set_xindex): New protected function.
11383         (class Symbol_value): Add is_ordinary_shndx_ field.
11384         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11385         (Symbol_value::value): Assert ordinary section.
11386         (Symbol_value::initialize_input_to_output_map): Likewise.
11387         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11388         Change all callers.
11389         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11390         all callers.
11391         (class Sized_relobj): Update declarations.
11392         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11393         parameter.  Change all callers.
11394         (Sized_relobj::adjust_shndx): New function.
11395         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11396         field.
11397         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11398         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11399         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11400         (Sized_dynobj::read_dynsym_section): Adjust section links.
11401         (Sized_dynobj::read_dynamic): Likewise.
11402         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11403         section links.
11404         (Sized_dynobj::do_initialize_xindex): New function.
11405         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11406         do_initialize_xindex.
11407         (Sized_dynobj::adjust_shndx): New function.
11408         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11409         dynsym_xindex_ fields.
11410         (Layout::finalize): Add a call to set_section_indexes before
11411         creating the symtab sections.
11412         (Layout::set_section_indexes): Don't do anything if the section
11413         already has a section index.
11414         (Layout::create_symtab_sections): Add shnum parameter.  Change
11415         caller.  Create .symtab_shndx section if needed.
11416         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11417         caller.
11418         (Layout::allocated_output_section_count): New function.
11419         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11420         needed.
11421         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11422         fields.  Update declarations.
11423         (Layout::symtab_xindex): New function.
11424         (Layout::dynsym_xindex): New function.
11425         (class Write_symbols_task): Add layout_ field.
11426         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11427         Change caller.
11428         * output.cc (Output_section_headers::Output_section_headers): Add
11429         shstrtab_section parameter.  Change all callers.
11430         (Output_section_headers::do_sized_write): Store overflow values
11431         for section count and section string table section index in
11432         section header zero.
11433         (Output_file_header::do_sized_write): Check for overflow of
11434         section count and section string table section index.
11435         (Output_symtab_xindex::do_write): New function.
11436         (Output_symtab_xindex::endian_do_write): New function.
11437         * output.h (class Output_section_headers): Add shstrtab_section_.
11438         Update declarations.
11439         (class Output_symtab_xindex): Define.
11440         (Output_section::has_out_shndx): New function.
11441         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11442         field.
11443         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11444         Change all callers.
11445         (Sized_symbol::init): Likewise.
11446         (Symbol::output_section): Check for ordinary symbol.
11447         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11448         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11449         callers.
11450         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11451         Change all callers.  Simplify handling of symbols from sections
11452         not included in the link.
11453         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11454         distinction.
11455         (Weak_alias_sorter::operator()): Assert that symbols are
11456         ordinary.
11457         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11458         distinction.
11459         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11460         parameters.  Change all callers.
11461         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11462         symbol distinction.  Use SHN_XINDEX when needed.
11463         (Symbol_table::write_section_symbol): Add symtab_xindex
11464         parameter.  Change all callers.
11465         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11466         SHN_XINDEX when needed.
11467         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11468         declarations.
11469         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11470         (Symbol::is_defined): Check is_ordinary.
11471         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11472         (Symbol::is_absolute, Symbol::is_common): Likewise.
11473         (class Sized_symbol): Update declarations.
11474         (class Symbol_table): Update declarations.
11475         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11476         parameters.  Change all callers.
11477         (Sized_symbol::override): Likewise.
11478         (Symbol_table::override): Likewise.
11479         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11480         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11481         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11482         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11483         to be in an ordinary section.
11484         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11485         object and is_ordinary parameters.  Change all callers.
11486         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11487         Change all callers.  Don't add undefined or non-ordinary symbols
11488         to reloc_map_.
11489         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11490         Change all callers.
11491         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11492         declarations.
11493         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11494         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11495         (Sized_relobj::relocate_sections): Likewise.
11496         * target-reloc.h (scan_relocs): Adjust section symbol index.
11497         (scan_relocatable_relocs): Likewise.
11498         * i386.cc (Scan::local): Check for ordinary symbols.
11499         * sparc.cc (Scan::local): Likewise.
11500         * x86_64.cc (Scan::local): Likewise.
11501         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11502         to symbol_section_and_value.
11503         * testsuite/many_sections_test.cc: New file.
11504         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11505         (check_PROGRAMS): Add many_sections_test.
11506         (many_sections_test_SOURCES): Define.
11507         (many_sections_test_DEPENDENCIES): Define.
11508         (many_sections_test_LDFLAGS): Define.
11509         (BUILT_SOURCES): Add many_sections_define.h.
11510         (many_sections_define.h): New target.
11511         (BUILT_SOURCES): Add many_sections_check.h.
11512         (many_sections_check.h): New target.
11513         (check_PROGRAMS): Add many_sections_r_test.
11514         (many_sections_r_test_SOURCES): Define.
11515         (many_sections_r_test_DEPENDENCIES): Define.
11516         (many_sections_r_test_LDFLAGS): Define.
11517         (many_sections_r_test_LDADD): Define.
11518         (many_sections_r_test.o): New target.
11519         * testsuite/Makefile.in: Rebuild.
11520
11521 2008-04-17  Cary Coutant  <ccoutant@google.com>
11522
11523         * errors.cc (Errors::info): New function.
11524         (gold_info): New function.
11525         * errors.h (Errors::info): New function.
11526         * gold.h (gold_info): New function.
11527         * object.cc (Input_objects::add_object): Print trace output.
11528         * options.cc (options::parse_set): New function.
11529         (General_options::parse_wrap): Deleted.
11530         (General_options::General_options): Deleted initializer.
11531         * options.h (options::String_set): New typedef.
11532         (options::parse_set): New function.
11533         (DEFINE_set): New macro.
11534         (General_options::wrap): Changed to use DEFINE_set. Changed
11535         callers of any_wrap_symbols and is_wrap_symbol.
11536         (General_options::trace, General_options::trace_symbol):
11537         New options.
11538         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11539         (General_options::wrap_symbols_): Deleted.
11540         * symtab.cc (Symbol_table::add_from_object): Print trace output.
11541
11542 2008-04-17  David S. Miller  <davem@davemloft.net>
11543
11544         * options.cc (General_options::parse_V): New function.
11545         * options.h: Add entries for -V and -Qy.
11546
11547 2008-04-17  Ian Lance Taylor  <iant@google.com>
11548
11549         * common.cc (Symbol_table::allocate_commons): Remove options
11550         parameter.  Change caller.
11551         (Symbol_table::do_allocate_commons): Remove options parameter.
11552         Change caller.  Just call do_allocate_commons_list twice.
11553         (Symbol_table::do_allocate_commons_list): New function, broken out
11554         of do_allocate_commons.
11555         * common.h (class Allocate_commons_task): Remove options_ field.
11556         Update constructor.
11557         * symtab.cc (Symbol_table::Symbol_table): Initialize
11558         tls_commons_.
11559         (Symbol_table::add_from_object): Put TLS common symbols on
11560         tls_commons_ list.
11561         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11562         which are IN_OUTPUT_DATA.
11563         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
11564         allocate_commons and do_allocate_commons declarations.  Declare
11565         do_allocate_commons_list.
11566         * gold.cc (queue_middle_tasks): Update creation of
11567         Allocate_commons_task to not pass options.
11568         * testsuite/Makefile.am (INCLUDES): Add -I.. .
11569         (TLS_TEST_C_FLAGS): New variable.
11570         (tls_test_c_pic.o): New target.
11571         (tls_test_shared.so): Link in tls_test_c_pic.o.
11572         (tls_test_c_pic_ie.o): New target.
11573         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11574         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11575         (tls_test_c.o): New target.
11576         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11577         (tls_pic_test_LDADD): Likewise.
11578         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11579         (tls_shared_gd_to_ie_test_LDADD): Likewise.
11580         (tls_test_c_gnu2.o): New target.
11581         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11582         tls_test_c_gnu2.o.
11583         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11584         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11585         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11586         * testsuite/tls_test.cc: Include "config.h".
11587         (t_last): Call t11_last.
11588         * testsuite/tls_test.h (t11, t11_last): Declare.
11589         * testsuite/tls_test_c.c: New file.
11590         * testsuite/tls_test_main.cc (thread_routine): Call t11.
11591         * configure.ac: Check for OpenMP support.
11592         * configure, config.in, Makefile.in: Rebuild.
11593         * testsuite/Makefile.in: Rebuild.
11594
11595 2008-04-16  Cary Coutant  <ccoutant@google.com>
11596
11597         * i386.cc (Target_i386::define_tls_base_symbol): New function.
11598         (Target_i386::tls_base_symbol_defined_): New field.
11599         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11600         (Target_i386::Scan::global): Likewise.
11601         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11602         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11603         (Target_x86_64::tls_base_symbol_defined_): New field.
11604         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11605         (Target_x86_64::Scan::global): Likewise.
11606
11607 2008-04-16  Cary Coutant  <ccoutant@google.com>
11608
11609         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11610         (Symbol::needs_plt_entry): Allow weak undefined symbols.
11611         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11612         building shared libraries.
11613         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11614         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11615         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11616         * testsuite/Makefile.in: Rebuild.
11617         * testsuite/weak_undef.h: New file.
11618         * testsuite/weak_undef_file1.cc: Add extra test cases.
11619         * testsuite/weak_undef_file2.cc: Likewise.
11620         * testsuite/weak_undef_test.cc: Likewise.
11621
11622 2008-04-16  David S. Miller  <davem@davemloft.net>
11623
11624         * sparc.cc (Target_sparc::Scan): Change from struct to class.
11625         Add issued_non_pic_error_ field.  Declare check_non_pic.
11626         (Target_sparc::Scan::check_non_pic): New function.
11627         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11628         (Target_sparc::Scan::global): Likewise.
11629
11630         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11631         * configure: Rebuild.
11632
11633         * options.h (DEFINE_enable): New macro.
11634         (new_dtags): New enable option.
11635         (initfirst, interpose, loadfltr, nodefaultlib,
11636         nodelete, nodlopen, nodump): New -z options.
11637         * layout.cc (Layout:finish_dynamic_section): If new
11638         dtags enabled, emit DT_RUNPATH.  Also, emit a
11639         DT_FLAGS_1 containing any specified -z flags.
11640
11641 2008-04-16  Ian Lance Taylor  <iant@google.com>
11642
11643         * copy-relocs.cc: New file.
11644         * copy-relocs.h: New file.
11645         * reloc.cc: Remove Copy_relocs code.
11646         * reloc.h: Likewise.
11647         * reloc-types.h (struct Reloc_types) [both versions]: Add
11648         get_reloc_addend_noerror.
11649         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11650         variants of add_global which take an addend which must be zero.
11651         * i386.cc: Include "copy-relocs.h".
11652         (class Target_i386): Change type of copy_relocs_ to variable,
11653         update initializer.
11654         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11655         Change all callers.
11656         (Target_i386::do_finalize_sections): Change handling of
11657         copy_relocs_.
11658         * sparc.cc: Include "copy-relocs.h".
11659         (class Target_sparc): Change type of copy_relocs_ to variable,
11660         update initializer.
11661         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11662         Change all callers.
11663         (Target_sparc::do_finalize_sections): Change handling of
11664         copy_relocs_.
11665         * x86_64.cc: Include "copy-relocs.h".
11666         (class Target_x86_64): Change type of copy_relocs_ to variable,
11667         update initializer.
11668         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11669         class.  Change all callers.
11670         (Target_x86_64::do_finalize_sections): Change handling of
11671         copy_relocs_.
11672         * Makefile.am (CCFILES): Add copy-relocs.cc.
11673         (HFILES): Add copy-relocs.h.
11674
11675         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11676
11677         * testsuite/script_test_4.sh: Permit leading zeroes.
11678
11679 2008-04-15  Ian Lance Taylor  <iant@google.com>
11680
11681         * script-sections.cc (Script_sections::create_segments): Use
11682         header_size_adjustment even when there is enough room for the
11683         headers.
11684         * testsuite/script_test_4.sh: New file.
11685         * testsuite/script_test_4.t: New file.
11686         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11687         (check_DATA): Add script_test_4.stdout.
11688         (MOSTLYCLEANFILES): Likewise.
11689         (script_test_4): New target.
11690         (script_test_4.stdout): New target.
11691         * testsuite/Makefile.in: Rebuild.
11692
11693         * sparc.cc: Add definitions for Output_data_plt_sparc class
11694         constants.
11695
11696 2008-04-14  David S. Miller  <davem@davemloft.net>
11697
11698         * sparc.cc: New file.
11699         * Makefile.am (TARGETSOURCES): Add sparc.cc
11700         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11701         * configure.tgt: Document targ_extra_size and
11702         targ_extra_big_endian.  Add entries for sparc-* and
11703         sparc64-*.
11704         * configure.ac: Handle targ_extra_size and
11705         targ_extra_big_endian.
11706         * Makefile.in: Rebuild.
11707         * configure: Likewise.
11708         * po/POTFILES.in: Likewise.
11709         * po/gold.pot: Likewise.
11710
11711 2008-04-14  Ian Lance Taylor  <iant@google.com>
11712
11713         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11714         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11715         in the name/type/flags to section mapping.  Don't call
11716         allocate_output_section.
11717         (Layout::choose_output_section): Change parameter from adjust_name
11718         to is_input_section.  Don't permit input sections after sections
11719         are attached to segments.  Don't call allocate_output_section.
11720         (Layout::layout_eh_frame): Call update_flags_for_input_section,
11721         not write_enable_output_section.
11722         (Layout::make_output_section): Don't push to
11723         unattached_section_list_ nor call attach_to_segment.  Call
11724         attach_section_to_segment if sections are attached.
11725         (Layout::attach_sections_to_segments): New function.
11726         (Layout::attach_section_to_segment): New function.
11727         (Layout::attach_allocated_section_to_segment): Rename from
11728         attach_to_segment.  Remove flags parameter.
11729         (Layout::allocate_output_section): Remove function.
11730         (Layout::write_enable_output_section): Remove function.
11731         * layout.h (class Layout): Update for above changes.  Add new
11732         field sections_are_attached_.
11733         * output.h (Output_section::update_flags_for_input_section): New
11734         function.
11735         * output.cc (Output_section::add_input_section): Call
11736         update_flags_for_input_section.
11737         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11738
11739 2008-04-11  Cary Coutant  <ccoutant@google.com>
11740
11741         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11742         thought unnecessary.
11743         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11744
11745 2008-04-11  Ian Lance Taylor  <iant@google.com>
11746
11747         * output.h (class Output_section_data): Remove inline definition
11748         of set_addralign.
11749         * output.cc (Output_section_data::set_addralign): New function.
11750
11751 2008-04-11  Cary Coutant  <ccoutant@google.com>
11752
11753         Add support for TLS descriptors for i386 and x86_64.
11754         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11755         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11756         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11757         GOT_TYPE_TLS_DESC.
11758         (Target_i386::got_mod_index_entry): Remove unnecessary code.
11759         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11760         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
11761         relocations.
11762         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11763         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11764         Fix problem with initial-exec relocations.
11765         (Target_i386::Relocate::relocate_tls): Likewise.
11766         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11767         relaxation.
11768         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11769         support for section-plus-offset dynamic table entries.
11770         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11771         (Output_data_dynamic::Dynamic_entry): Add support for
11772         section-plus-offset dynamic table entries.
11773         (Output_data_dynamic::Classification): Likewise.
11774         (Output_data_dynamic::classification_): Renamed offset_.
11775         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11776         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11777         (Target_x86_64::make_plt_section): New function.
11778         (Target_x86_64::reserve_tlsdesc_entries): New function.
11779         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11780         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11781         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11782         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11783         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11784         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11785         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11786         add extra PLT entry for TLS descriptors.
11787         (Output_data_plt_x86_64::got_): New field.
11788         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11789         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11790         fields.
11791         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11792         descriptors.
11793         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11794         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11795         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11796         R_386_TLS_DESC_CALL relocations.
11797         (Target_x86_64::Scan::global): Likewise.
11798         (Target_x86_64::do_finalize_sections): Add dynamic table entries
11799         for TLS descriptors.
11800         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11801         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11802         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11803         GD-to-IE relaxation.
11804         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11805         and TLS_DESCRIPTORS.
11806         * Makefile.in: Rebuild.
11807         * configure: Rebuild.
11808         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11809         (tls_test_shared2.so): New target.
11810         (tls_shared_gd_to_ie_test_SOURCES): New variable.
11811         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11812         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11813         (tls_shared_gd_to_ie_test_LDADD): New variable.
11814         (tls_shared_gnu2_gd_to_ie_test): New target.
11815         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11816         New targets.
11817         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11818         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11819         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11820         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11821         (tls_shared_gnu2_test): New target.
11822         (tls_test_gnu2_shared.so): New target.
11823         (tls_shared_gnu2_test_SOURCES): New variable.
11824         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11825         (tls_shared_gnu2_test_LDFLAGS): New variable.
11826         (tls_shared_gnu2_test_LDADD): New variable.
11827         * testsuite/Makefile.in: Rebuild.
11828         * testsuite/Makefile.
11829
11830 2008-04-11  Ian Lance Taylor  <iant@google.com>
11831
11832         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11833         justsyms.t.
11834         * testsuite/Makefile.in: Rebuild.
11835
11836         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11837         long.
11838         * testsuite/script_test_2.cc (main): Adjust test.
11839
11840 2008-04-11  David S. Miller  <davem@davemloft.net>
11841             Ian Lance Taylor  <iant@google.com>
11842
11843         * options.h (General_options): Add entries for '-Y' and
11844         '-relax'.
11845         * options.cc (General_options:finalize): If -Y was used, add those
11846         entries to the library path instead of the default "/lib" and
11847         "/usr/lib".
11848
11849 2008-04-11  David S. Miller  <davem@davemloft.net>
11850
11851         * testsuite/justsyms.t: Start at 0x100.
11852         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11853         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11854         long.
11855         * testsuite/script_test_2.cc: Adjust string and section length
11856         checks.
11857
11858 2008-04-09  Ian Lance Taylor  <iant@google.com>
11859
11860         PR gold/5996
11861         * script-sections.cc (Sections_element::allocate_to_segment): Add
11862         orphan parameter.
11863         (Output_section_definition::allocate_to_segment): Likewise.
11864         (Orphan_output_section::allocate_to_segment): Likewise.
11865         (Script_sections::attach_sections_using_phdrs_clause): Don't
11866         propagate non-PT_LOAD segments to orphan sections.
11867         * testsuite/Makefile.am (script_test_3.stdout): Generate using
11868         readelf rather than objdump.
11869         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
11870         .interp section and PT_INTERP segment are the same size.
11871         * testsuite/Makefile.in: Rebuild.
11872
11873         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11874         aliases for symbols defined in the same object.
11875         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11876         (weak_alias_test_SOURCES): New variable.
11877         (weak_alias_test_DEPENDENCIES): New variable.
11878         (weak_alias_test_LDFLAGS): New variable.
11879         (weak_alias_test_LDADD): New variable.
11880         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11881         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11882         (weak_alias_test_3.o): New target.
11883         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11884         * testsuite/weak_alias_test_main.cc: New file.
11885         * testsuite/weak_alias_test_1.cc: New file.
11886         * testsuite/weak_alias_test_2.cc: New file.
11887         * testsuite/weak_alias_test_3.cc: New file.
11888
11889 2008-04-08  Ian Lance Taylor  <iant@google.com>
11890
11891         * options.h (class General_options): Add --noinhibit-exec option.
11892         * main.cc (main): Check --noinhibit-exec.
11893
11894         * options.h (class General_options): Define --wrap as a special
11895         option.  Add wrap_symbols_ field.
11896         (General_options::any_wrap_symbols): New function.
11897         (General_options::is_wrap_symbol): New function.
11898         * options.cc (General_options::parse_wrap): New function.
11899         (General_options::General_options): Initialize wrap_symbols_.
11900         * symtab.cc (Symbol_table::wrap_symbol): New function.
11901         (Symbol_table::add_from_object): Handle --wrap.
11902         * symtab.h (class Symbol_table): Declare wrap_symbol.
11903         * target.h (Target::wrap_char): New function.
11904         (Target::Target_info): Add wrap_char field.
11905         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11906         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11907         * testsuite/testfile.cc (Target_test::test_target_info):
11908         Likewise.
11909
11910         * errors.cc (Errors::undefined_symbol): Mention symbol version if
11911         there is one.
11912
11913         * layout.h (class Layout): Add added_eh_frame_data_ field.
11914         * layout.cc (Layout::Layout): Initialize new field.
11915         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11916         output section until we find a section we merged successfully.
11917         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11918         that the size be non-zero.
11919
11920         * merge.cc (Object_merge_map::get_output_offset): Remove inline
11921         qualifier.
11922
11923 2008-04-08  Craig Silverstein  <csilvers@google.com>
11924
11925         * configure.ac: Export new conditional variable HAVE_ZLIB.
11926         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11927         on HAVE_ZLIB.
11928         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11929         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11930
11931 2008-04-07  Ian Lance Taylor  <iant@google.com>
11932
11933         * version.cc (version_string): Set to "1.5".
11934
11935         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11936         Add issued_non_pic_error_ field.  Declare check_non_pic.
11937         (Target_x86_64::Scan::check_non_pic): New function.
11938         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11939         (Target_x86_64::Scan::global): Likewise.
11940
11941         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11942         addend parameter.  Change caller.  Handle merge sections.
11943         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11944         Address to Addend.  Don't add in the result of
11945         local_section_offset, pass down the addend and use the returned
11946         value.
11947         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11948         Update declarations of local_section_offset and symbol_value.
11949         * testsuite/two_file_test_1.cc (t18): New function.
11950         * testsuite/two_file_test_2.cc (f18): New function.
11951         * testsuite/two_file_test_main.cc (main): Call t18.
11952         * testsuite/two_file_test.h (t18, f18): Declare.
11953
11954         * configure.ac: Don't test for objdump, c++filt, or readelf.
11955         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11956         conditionals.
11957         (TEST_READELF): New variable.
11958         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11959         (check_PROGRAMS): Add two_file_strip_test.
11960         (two_file_strip_test): New target.
11961         (check_PROGRAMS): Add two_file_same_shared_strip_test.
11962         (two_file_same_shared_strip_test_SOURCES): New variable.
11963         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11964         (two_file_same_shared_strip_test_LDFLAGS): New variable.
11965         (two_file_same_shared_strip_test_LDADD): New variable.
11966         (two_file_shared_strip.so): New target.
11967         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11968         (ver_test_5.syms, ver_test_7.syms): Likewise.
11969         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11970         (strip_test_3.stdout): Use TEST_OBJDUMP.
11971         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11972
11973 2008-04-04  Cary Coutant  <ccoutant@google.com>
11974
11975         * symtab.h (Symbol::is_weak_undefined): New function.
11976         (Symbol::is_strong_undefined): New function.
11977         (Symbol::is_absolute): New function.
11978         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11979         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11980         absolute symbols.
11981         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11982         (weak_undef_test): New target.
11983         * testsuite/Makefile.in: Rebuild.
11984         * testsuite/weak_undef_file1.cc: New file.
11985         * testsuite/weak_undef_file2.cc: New file.
11986         * testsuite/weak_undef_test.cc: New file.
11987
11988 2008-04-03  Craig Silverstein  <csilvers@google.com>
11989
11990         * compressed_output.h (class Output_compressed_section): Use
11991         unsigned buffer.
11992         * compressed_output.cc (zlib_compress): Use unsigned buffers,
11993         add zlib header.
11994         (zlib_compressed_suffix): Removed.
11995         (Output_compressed_section::set_final_data_size): Use unsigned
11996         buffers.
11997         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11998         Fix linker invocation.
11999         (flagstest_o_specialfile_and_compress_debug_sections):
12000         Likewise.
12001         * testsuite/Makefile.in: Regenerated.
12002
12003 2008-04-02  David S. Miller  <davem@davemloft.net>
12004
12005         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12006         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12007
12008 2008-04-02  Craig Silverstein  <csilvers@google.com>
12009
12010         * TODO: New file.
12011
12012 2008-04-02  Ian Lance Taylor  <iant@google.com>
12013
12014         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12015         parameters.  Update for new key type to views_.  Change all
12016         callers.
12017         (File_read::read): Adjust for byteshift in returned view.
12018         (File_read::add_view): New function, broken out of
12019         find_and_make_view.
12020         (File_read::make_view): New function, broken out of
12021         find_and_make_view.
12022         (File_read::find_or_make_view): Add offset and aligned
12023         parameters.  Rewrite accordingly.  Change all callers.
12024         (File_read::get_view): Add offset and aligned parameters.  Adjust
12025         for byteshift in return value.
12026         (File_read::get_lasting_view): Likewise.
12027         * fileread.h (class File_read): Update declarations.
12028         (class File_read::View): Add byteshift_ field.  Add byteshift to
12029         constructor.  Add byteshift method.
12030         * archive.h (Archive::clear_uncached_views): New function.
12031         (Archive::get_view): Add aligned parameter.  Change all callers.
12032         * object.h (Object::get_view): Add aligned parameter.  Change all
12033         callers.
12034         (Object::get_lasting_view): Likewise.
12035
12036         * fileread.cc (File_read::release): Don't call clear_views if
12037         there are multiple objects.
12038         * fileread.h (File_read::clear_uncached_views): New function.
12039         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12040         on the archive.
12041
12042 2008-03-31  Cary Coutant  <ccoutant@google.com>
12043
12044         Add thin archive support.
12045         * archive.cc (Archive::armagt): New const.
12046         (Archive::setup): Remove task parameter and calls to unlock.
12047         (Archive::unlock_nested_archives): New function.
12048         (Archive::read_header): Add nested_off parameter. Change
12049         all callers.
12050         (Archive::interpret_header): Likewise.
12051         (Archive::include_all_members): Change to handle thin
12052         archives.
12053         (Archive::include_member): Likewise.
12054         * archive.h (Archive::Archive): Add new parameters and
12055         initializers.
12056         (Archive::armagt): New const.
12057         (Archive::setup): Remove task parameter.
12058         (Archive::unlock_nested_archives): New function.
12059         (Archive::read_header): Add nested_off parameter.
12060         (Archive::interpret_header): Likewise.
12061         (Archive::Nested_archive_table): New typedef.
12062         (Archive::is_thin_archive_): New field.
12063         (Archive::nested_archives_): New field.
12064         (Archive::options_): New field.
12065         (Archive::dirpath_): New field.
12066         (Archive::task_): New field.
12067         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12068         for thin archives.  Pass additional parameters to
12069         Archive::Archive.  Unlock the archive file after calling
12070         Archive::setup.
12071
12072 2008-03-29  Ian Lance Taylor  <iant@google.com>
12073
12074         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12075         version symbol to be local.
12076         * testsuite/ver_test_4.sh: New file.
12077         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12078         (check_DATA): Add ver_test_4.syms.
12079         (ver_test_4.syms): New target.
12080         * testsuite/Makefile.in: Rebuild.
12081
12082         * output.cc
12083         (Output_section::Input_section_sort_entry::has_priority): New
12084         function.
12085         (Output_section::Input_section_sort_entry::match_file_name): New
12086         function.
12087         (Output_section::Input_section_sort_entry::match_section_name):
12088         Remove.
12089         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12090         Remove.
12091         (Output_section::Input_section_sort_entry::match_section_file):
12092         Remove.
12093         (Output_section::Input_section_sort_compare::operator()): Rewrite
12094         using new Input_section_sort_entry functions.  Sort crtbegin and
12095         crtend first.  Sort sections with no priority before sections with
12096         a priority.
12097         * testsuite/initpri1.c (d3): Check j != 4.
12098         (cd5): New constructor/destructor function.
12099         (main): Check j != 2.
12100
12101         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12102         new symbol when resolving, don't call set_is_default.
12103         * testsuite/ver_test_7.cc: New file.
12104         * testsuite/ver_test_7.sh: New file.
12105         * testsuite/Makefile.am (ver_test_7.so): New target.
12106         (ver_test_7.o): New target.
12107         (check_SCRIPTS): Add ver_test_7.sh.
12108         (check_DATA): Add ver_test_7.syms.
12109         (ver_test_7.syms): New target.
12110
12111 2008-03-28  Ian Lance Taylor  <iant@google.com>
12112
12113         * layout.cc (Layout::layout): If we see an input section with a
12114         name that needs sorting, set the must_sort flag for the output
12115         section.
12116         (Layout::make_output_section): If the name of the output section
12117         indicates that it might require sorting, set the may_sort flag.
12118         * output.h (Output_section::may_sort_attached_input_sections): New
12119         function.
12120         (Output_section::set_may_sort_attached_input_sections): New
12121         function.
12122         (Output_section::must_sort_attached_input_sections): New
12123         function.
12124         (Output_section::set_must_sort_attached_input_sections): New
12125         function.
12126         (class Output_section): Declare Input_section_sort_entry.  Define
12127         Input_section_sort_compare.  Declare
12128         sort_attached_input_sections.  Add new fields:
12129         may_sort_attached_input_sections_,
12130         must_sort_attached_input_sections_,
12131         attached_input_sections_are_sorted_.
12132         * output.cc (Output_section::Output_section): Initialize new
12133         fields.
12134         (Output_section::add_input_section): Add an entry to
12135         input_sections_ if may_sort or must_sort are true.
12136         (Output_section::set_final_data_size): Call
12137         sort_attached_input_sections if necessary.
12138         (Output_section::Input_section_sort_entry): Define new class.
12139         (Output_section::Input_section_sort_compare::operator()): New
12140         function.
12141         (Output_section::sort_attached_input_sections): New function.
12142         * configure.ac: Check whether the compiler supports constructor
12143         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12144         * testsuite/initpri1.c: New file.
12145         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12146         CONSTRUCTOR_PRIORITY.
12147         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12148         (initpri1_LDFLAGS): New variable.
12149         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12150
12151 2008-03-27  Ian Lance Taylor  <iant@google.com>
12152
12153         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12154         * testsuite/common_test_1.c: New file.
12155         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12156         (common_test_1_SOURCES): New variable.
12157         (common_test_1_DEPENDENCIES): New variable.
12158         (common_test_1_LDFLAGS): New variable.
12159
12160         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12161         and commons_ correctly when NAME/VERSION does not override
12162         NAME/NULL.
12163         * testsuite/ver_test_6.c: New file.
12164         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12165         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12166         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12167
12168 2008-03-26  Ian Lance Taylor  <iant@google.com>
12169
12170         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12171         of an undefined symbol from a version script.
12172         * testsuite/Makefile.am (ver_test_5.so): New target.
12173         (ver_test_5.o): New target.
12174         (check_SCRIPTS): Add ver_test_5.sh.
12175         (check_DATA): Add ver_test_5.syms.
12176         (ver_test_5.syms): New target.
12177         * testsuite/ver_test_5.cc: New file.
12178         * testsuite/ver_test_5.script: New file.
12179         * testsuite/ver_test_5.sh: New file.
12180         * Makefile.in, testsuite/Makefile.in: Rebuild.
12181
12182         PR gold/5986
12183         Fix problems building gold with gcc 4.3.0.
12184         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12185         (gold_error_at_location, gold_warning_at_location): Use it.
12186         * configure.ac: Check whether we can compile and use a template
12187         function with a printf attribute.
12188         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12189         when jumping over bytes.
12190         * object.cc: Instantiate Object::read_section_data.
12191         * debug.h: Include <cstring>
12192         * dwarf_reader.cc: Include <algorithm>
12193         * main.cc: Include <cstring>.
12194         * options.cc: Include <cstring>.
12195         * output.cc: Include <cstring>.
12196         * script.cc: Include <cstring>.
12197         * script.h: Include <string>.
12198         * symtab.cc: Include <cstring> and <algorithm>.
12199         * target-select.cc: Include <cstring>.
12200         * version.cc: Include <string>.
12201         * testsuite/testmain.cc: Include <cstdlib>.
12202         * configure, config.in: Rebuild.
12203
12204 2008-03-25  Ian Lance Taylor  <iant@google.com>
12205
12206         * options.cc: Include "../bfd/bfdver.h".
12207         (options::help): Print bug reporting address.
12208
12209         * version.cc (print_version): Adjust output for current value of
12210         BFD_VERSION_STRING.
12211
12212         * NEWS: New file.
12213
12214         * options.cc (options::help): Print list of supported targets.
12215         * target-select.h: Include <vector>.
12216         (class Target_selector): Make machine_, size_, and is_big_endian_
12217         fields const.  Add bfd_name_ and instantiated_target_ fields.
12218         (Target_selector::Target_selector): Add bfd_name parameter.
12219         (Target_selector::recognize): Make non-virtual, call
12220         do_recognize.
12221         (Target_selector::recognize_by_name): Make non-virtual, call
12222         do_recognize_by_name.
12223         (Target_selector::supported_names): New function.
12224         (Target_selector::bfd_name): New function.
12225         (Target_selector::do_instantiate_target): New pure virtual
12226         function.
12227         (Target_selector::do_recognize): New virtual function.
12228         (Target_selector::do_recognize_by_name): New virtual function.
12229         (Target_selector::instantiate_target): New private function.
12230         (supported_target_names): Declare.
12231         * target-select.cc (Target_selector::Target_selector): Update for
12232         new parameter and fields.
12233         (select_target_by_name): Check that the name matches before
12234         calling recognize_by_name.
12235         (supported_target_names): New function.
12236         * i386.cc (class Target_selector_i386): Update Target_selector
12237         constructor call.  Remove recognize and recognize_by_name.  Add
12238         do_instantiate_target.
12239         * x86_64.cc (class Target_selector_x86_64): Likewise.
12240         * testsuite/testfile.cc (class Target_selector_test): Update for
12241         changes to Target_selector.
12242
12243         * README: Rewrite, with some notes on unsupported features.
12244
12245 2008-03-24  Cary Coutant  <ccoutant@google.com>
12246
12247         * i386.cc (Target_i386::Got_type): New enum declaration.
12248         (Target_i386::Scan::local): Updated callers of Output_data_got
12249         member functions.
12250         (Target_i386::Scan::global): Likewise.
12251         (Target_i386::Relocate::relocate): Likewise.
12252         (Target_i386::Relocate::relocate_tls): Likewise.
12253         * object.h (Got_offset_list): New class.
12254         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12255         (Sized_relobj::local_got_offset): Likewise.
12256         (Sized_relobj::set_local_got_offset): Likewise.
12257         (Sized_relobj::local_has_tls_got_offset): Removed.
12258         (Sized_relobj::local_tls_got_offset): Removed.
12259         (Sized_relobj::set_local_tls_got_offset): Removed.
12260         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12261         * output.cc (Output_data_got::add_global): Added got_type parameter.
12262         (Output_data_got::add_global_with_rel): Likewise.
12263         (Output_data_got::add_global_with_rela): Likewise.
12264         (Output_data_got::add_global_pair_with_rel): New function.
12265         (Output_data_got::add_global_pair_with_rela): New function.
12266         (Output_data_got::add_local): Added got_type parameter.
12267         (Output_data_got::add_local_with_rel): Likewise.
12268         (Output_data_got::add_local_with_rela): Likewise.
12269         (Output_data_got::add_local_pair_with_rel): New function.
12270         (Output_data_got::add_local_pair_with_rela): New function.
12271         (Output_data_got::add_global_tls): Removed.
12272         (Output_data_got::add_global_tls_with_rel): Removed.
12273         (Output_data_got::add_global_tls_with_rela): Removed.
12274         (Output_data_got::add_local_tls): Removed.
12275         (Output_data_got::add_local_tls_with_rel): Removed.
12276         (Output_data_got::add_local_tls_with_rela): Removed.
12277         * output.h (Output_data_got::add_global): Added got_type parameter.
12278         (Output_data_got::add_global_with_rel): Likewise.
12279         (Output_data_got::add_global_with_rela): Likewise.
12280         (Output_data_got::add_global_pair_with_rel): New function.
12281         (Output_data_got::add_global_pair_with_rela): New function.
12282         (Output_data_got::add_local): Added got_type parameter.
12283         (Output_data_got::add_local_with_rel): Likewise.
12284         (Output_data_got::add_local_with_rela): Likewise.
12285         (Output_data_got::add_local_pair_with_rel): New function.
12286         (Output_data_got::add_local_pair_with_rela): New function.
12287         (Output_data_got::add_global_tls): Removed.
12288         (Output_data_got::add_global_tls_with_rel): Removed.
12289         (Output_data_got::add_global_tls_with_rela): Removed.
12290         (Output_data_got::add_local_tls): Removed.
12291         (Output_data_got::add_local_tls_with_rel): Removed.
12292         (Output_data_got::add_local_tls_with_rela): Removed.
12293         * resolve.cc (Symbol::override_base_with_special): Removed
12294         reference to has_got_offset_ field.
12295         * symtab.cc (Symbol::init_fields): Replaced initialization
12296         of got_offset_ with got_offsets_.  Removed initialization
12297         of has_got_offset_
12298         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12299         (Symbol::got_offset): Likewise.
12300         (Symbol::set_got_offset): Likewise.
12301         (Symbol::has_tls_got_offset): Removed.
12302         (Symbol::tls_got_offset): Removed.
12303         (Symbol::set_tls_got_offset): Removed.
12304         (Symbol::got_offset_): Removed.
12305         (Symbol::tls_mod_got_offset_): Removed.
12306         (Symbol::tls_pair_got_offset_): Removed.
12307         (Symbol::got_offsets_): New field.
12308         (Symbol::has_got_offset): Removed.
12309         (Symbol::has_tls_mod_got_offset): Removed.
12310         (Symbol::has_tls_pair_got_offset): Removed.
12311         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12312         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12313         member functions.
12314         (Target_x86_64::Scan::global): Likewise.
12315         (Target_x86_64::Relocate::relocate): Likewise.
12316         (Target_x86_64::Relocate::relocate_tls): Likewise.
12317
12318 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12319
12320         * yyscript.y: Fix spelling error in comment.
12321
12322 2008-03-24  Ian Lance Taylor  <iant@google.com>
12323
12324         * options.h (class General_options): Define build_id option.
12325         * layout.h (class Layout): Declare write_build_id, create_note,
12326         create_build_id.  Add build_id_note_ member.
12327         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12328         "libiberty.h", "md5.h", "sha1.h".
12329         (Layout::Layout): Initialize eh_frame_data_,
12330         eh_frame_hdr_section_, and build_id_note_.
12331         (Layout::finalize): Call create_build_id.
12332         (Layout::create_note): New function, broken out of
12333         Layout::create_gold_note.
12334         (Layout::create_gold_note): Call create_note.
12335         (Layout::create_build_id): New function.
12336         (Layout::write_build_id): New function.
12337         (Close_task_runner::run): Call write_build_id.
12338
12339         * x86_64.cc: Correct license to GPLv3.
12340
12341 2008-03-23  Ian Lance Taylor  <iant@google.com>
12342
12343         * options.cc: Include "demangle.h".
12344         (parse_optional_string): New function.
12345         (parse_long_option): Handle takes_optional_argument.
12346         (parse_short_option): Update dash_z initializer.  Handle
12347         takes_optional_argument.
12348         (General_options::General_options): Initialize do_demangle_.
12349         (General_options::finalize): Set do_demangle_.  Handle demangling
12350         style.
12351         * options.h (parse_optional_string): Declare.
12352         (struct One_option): Add optional_arg field.  Update constructor.
12353         Update call constructor calls.  Add takes_optional_argument
12354         function.
12355         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12356         (DEFINE_optional_string): Define.
12357         (General_options::demangle): Change from DEFINE_bool to
12358         DEFINE_optional_string.
12359         (General_options::no_demangle): New function.
12360         (General_options::do_demangle): New function.
12361         (General_options::set_do_demangle): New function.
12362         (General_options::execstack_status_): Move definition to end of
12363         class definition.
12364         (General_options::static_): Likewise.
12365         (General_options::do_demangle_): New field.
12366         * object.cc (big_endian>::get_symbol_location_info): Call
12367         Options::do_demangle, not Options::demangle.
12368         * symtab.cc (demangle): Likewise.
12369
12370 2008-03-22  Ian Lance Taylor  <iant@google.com>
12371
12372         * gold.h: Include <cstddef> and <sys/types.h>
12373         * options.h: Include <cstring>.
12374
12375 2008-03-21  Ian Lance Taylor  <iant@google.com>
12376
12377         * Added source code to GNU binutils.