* dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
[external/binutils.git] / gold / ChangeLog
1 2013-03-21  Alan Modra  <amodra@gmail.com>
2
3         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
4         comparison warning.
5         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
6         uninitialized" warning.
7
8 2013-03-20  Alan Modra  <amodra@gmail.com>
9
10         * symtab.h (Symbol::clear_version): New function.
11         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
12         is_needed by weak references.  Clear version for symbols defined
13         in as-needed objects that are not needed.
14
15 2013-03-15  Alan Modra  <amodra@gmail.com>
16
17         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
18         static and public.  Add report_err param.  Return false for data refs.
19         (Target_powerpc::rela_dyn_section): New overloaded function.
20         (Target_powerpc::plt_, iplt_): Elucidate.
21         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
22         (Output_data_plt_powerpc::do_write): Don't write .iplt.
23         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
24         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
25         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
26         push_branch and make_plt_entry for ifunc syms when
27         reloc_needs_plt_for_ifunc.
28         (Target_powerpc::Relocate::relocate): Don't use plt entry value
29         for ifunc unless reloc_needs_plt_for_ifunc.
30
31 2013-03-15  Alan Modra  <amodra@gmail.com>
32
33         * gc.h (gc_process_relocs): Don't look through function descriptors.
34         * icf.cc (get_section_contents): Do so here instead.
35
36 2013-03-13  Alan Modra  <amodra@gmail.com>
37
38         * powerpc.cc (is_branch_reloc): Forward declare.
39         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
40         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
41         false for 64-bit, true for 32-bit non-branch relocs.
42         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
43         * testsuite/Makefile.am (icf_test): Use linker map file instead of
44         nm output.
45         (icf_safe_test): Generate linker map file as well as nm output.
46         (icf_safe_so_test): Likewise.
47         * testsuite/Makefile.in: Regenerate.
48         * testsuite/icf_test.sh: Parse linker map file to determine
49         section folding.
50         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
51         * testsuite/icf_safe_so_test.sh: Likewise.
52         (X86_32_or_ARM_specific_safe_fold): Merge into..
53         (arch_specific_safe_fold): ..this.
54         (X86_64_specific_safe_fold): Delete unused function.
55
56 2013-03-12  Alan Modra  <amodra@gmail.com>
57
58         * gc.h (gc_process_relocs): Look through function descriptors
59         to determine shndx, symvalue and addend used by ICF.  Tidy
60         variable duplication.
61
62 2013-03-11  Alan Modra  <amodra@gmail.com>
63
64         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
65         * layout.cc (Layout_task_runner::run): ..to here.
66         * symtab.h (struct Symbol_location): Extract from..
67         (class Symbol_table): ..here.
68         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
69         * target.h (class Target): Add function_location and
70         do_function_location functions.
71         (class Sized_target): Add do_function_location.
72         * object.h (class Sized_relobj_file): Move find_shdr..
73         (class Object): ..to here.
74         * object.cc: Likewise.  Update to suit.  Instantiate.
75         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
76         * powerpc.cc (class Powerpc_dynobj): New.
77         (Target_powerpc::do_function_location): New function.
78         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
79         (Powerpc_dynobj::do_read_symbols): New function.
80         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
81
82 2013-03-08  Ian Lance Taylor  <iant@google.com>
83
84         * options.cc (General_options::string_to_object_format): Accept
85         "default".
86
87 2013-03-08  Alan Modra  <amodra@gmail.com>
88
89         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
90         pointer to Post_fde.
91         (struct Post_fde): Move definition to here..
92         * ehframe.cc (struct Post_fde): ..from here.
93         (Cie::write): Don't alloc Post_fde.
94         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
95
96 2013-03-07  Alan Modra  <amodra@gmail.com>
97
98         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
99         relocation referencing .LC0.
100         * testsuite/discard_locals_test.sh: Remove FIXMEs.
101
102 2013-03-07  Alan Modra  <amodra@gmail.com>
103
104         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
105         always_inline.  Add assembly for powerpc to avoid GOT.
106
107 2013-03-07  Alan Modra  <amodra@gmail.com>
108
109         * testsuite/script_test_10.sh: Don't test .bss section
110         header number.
111
112 2013-03-06  Alan Modra  <amodra@gmail.com>
113
114         * powerpc.cc (class Powerpc_relobj): Move some member functions.
115         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
116         all callers.  Handle folded sections.
117         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
118         to Powerpc_relobj.
119         (Global_symbol_visitor_opd::operator()): Likewise.
120
121 2013-03-04  Alan Modra  <amodra@gmail.com>
122
123         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
124         * testsuite/Makefile.in: Regenerate.
125
126 2013-03-01  Cary Coutant  <ccoutant@google.com>
127
128         Add dwp support for v2 DWARF package file format.
129         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
130         tu_length parameter.  Adjust all callers.
131         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
132         * dwp.cc: Include dwarf.h.
133         (Section_bounds): New struct type.
134         (Unit_set): New struct type.
135         (Dwo_file::Dwo_file): Initialize new data member.
136         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
137         Combine and rename to...
138         (Dwo_file::read_unit_index): ...this.
139         (Dwo_file::sized_read_compunit_index)
140         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
141         (Dwo_file::sized_read_unit_index): ...this.
142         (Dwo_file::copy_section): Remove section_name, is_str_offsets
143         parameters; add section_id parameter.
144         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
145         (Dwo_file::add_unit_set): ...this.
146         (Dwo_file::shndx_map_): Remove.
147         (Dwo_file::sect_offsets_): New data member.
148         (Dwp_output_file::Dwp_output_file): Initialize new data members.
149         (Dwp_output_file::add_section): Rename to...
150         (Dwp_output_file::add_contribution): ...this.
151         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
152         (Dwp_output_file::add_tu_set): Likewise.
153         (Dwp_output_file::Contribution): New type.
154         (Dwp_output_file::Section::contributions): New data member.
155         (Dwp_output_file::Cu_or_tu_set): Remove.
156         (Dwp_output_file::Section::Section): New ctor.
157         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
158         (Dwp_output_file::Dwp_index::Section_table): New type.
159         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
160         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
161         parameter.
162         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
163         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
164         (Dwp_output_file::Dwp_index::section_table): New member function.
165         (Dwp_output_file::Dwp_index::section_table_end): New member function.
166         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
167         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
168         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
169         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
170         (Dwp_output_file::Dwp_index::section_table_): New data member.
171         (Dwp_output_file::Dwp_index::section_mask_): New data member.
172         (Dwp_output_file::add_output_section): New member function.
173         (Dwp_output_file::write_new_section): New member function.
174         (Dwp_output_file::write_contributions): New member function.
175         (Dwp_output_file::section_id_map_): New data member.
176         (class Dwo_id_info_reader): Remove.
177         (class Unit_reader): New class.
178         (get_dwarf_section_name): New function.
179         (Dwo_file::read_executable): Adjust initializations of class data.
180         (Dwo_file::read): Add support for v2 package file format.
181         (Dwo_file::read_unit_index): Likewise.
182         (Dwo_file::sized_read_unit_index): Likewise.
183         (Dwo_file::copy_section): Likewise.
184         (Dwo_file::add_unit_set): Likewise.
185         (Dwp_output_file::add_output_section): Likewise.
186         (Dwp_output_file::add_contribution): Likewise.
187         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
188         for empty slot.
189         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
190         file format.
191         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
192         slot.
193         (Dwp_output_file::initialize): Remove unused function.
194         (Dwp_output_file::finalize): Add support for v2 package file format.
195         (Dwp_output_file::write_index): Likewise.
196         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
197         function prototype.
198
199 2013-03-01  Cary Coutant  <ccoutant@google.com>
200
201         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
202         function into class definition in header file.
203         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
204         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
205         New function.
206         (Dwarf_info_reader::check_buffer): Move here from .cc file.
207
208 2013-02-28  Alan Modra  <amodra@gmail.com>
209
210         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
211         * target.cc (Target::do_plt_fde_location): New function.
212         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
213         accessor function, and constructor param.
214         (struct Post_fde, Post_fdes): Declare.
215         (Cie::write): Add post_fdes param.
216         * ehframe.cc (Fde::write): Use plt_fde_location.
217         (struct Post_fde): Define.
218         (Cie::write): Stash FDEs added post merge mapping.
219         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
220         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
221         (Eh_frame::do_sized_write): Arrange to write post map FDES after
222         other FDEs.
223         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
224         (Target_powerpc::has_glink): New function.
225         (Target_powerpc::do_relax): Add eh_frame info for stubs.
226         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
227         glink_eh_frame_fde_32, default_fde): New data.
228         (Stub_table::eh_frame_added_): New var.
229         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
230         Make const.
231         (Stub_table::add_eh_frame): New function.
232         (Output_data_glink::add_eh_frame): New function.
233         (Target_powerpc::make_glink_section): Call add_eh_frame.
234
235 2013-02-15  Ian Lance Taylor  <iant@google.com>
236
237         * options.h (DEFINE_uint64_alias): Define.
238         (class General_options): Add -Ttext-segment as an alias for
239         -Ttext.
240
241 2013-02-15  Alan Modra  <amodra@gmail.com>
242
243         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
244         (Stub_table::do_write): ..here, two places.
245         (Stub_table::plt_call_size): Use it here too.
246
247 2013-02-11  Ian Lance Taylor  <iant@google.com>
248
249         * descriptors.cc (Descriptors::close_all): New function.
250         * descriptors.h (class Descriptors): Declare close_all.
251         (close_all_descriptors): New inline function.
252         * plugin.cc: Include "descriptors.h".
253         (Plugin_manager::cleanup): Call close_all_descriptors.
254
255 2013-02-06  Alan Modra  <amodra@gmail.com>
256
257         * README: Update coding style link.
258
259 2013-01-28  Cary Coutant  <ccoutant@google.com>
260
261         * dwp.cc (File_list): New typedef.
262         (Dwo_name_info_reader): New class.
263         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
264         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
265         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
266         (Dwo_file::read_executable): New function.
267         (Dwo_file::read): Move common setup code to ...
268         (Dwo_file::make_object): ... here.
269         (dwp_options): Add --exec/-e.
270         (usage): Likewise.
271         (main): Likewise.
272
273 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
274
275         * layout.cc (Layout::layout): Check for option text_reorder.
276         (Layout::make_output_section): Ditto.
277         * options.h (text_reorder): New option.
278         * output.cc (Input_section_sort_compare): Remove special ordering
279         of section names.
280         (Output_section::
281          Input_section_sort_section_name_special_ordering_compare::
282          operator()): New function.
283         (Output_section::sort_attached_input_sections): Use new sort function
284         for .text.
285         * output.h (Input_section_sort_section_name_special_ordering_compare):
286         New struct.
287         * testsuite/Makefile.am (text_section_grouping): Test option
288         --no-text-reorder
289         * testsuite/Makefile.in: Regenerate.
290         * testsuite/text_section_grouping.sh: Check order of functions without
291         default text reordering.
292
293 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
294
295         * options.h (General_options): Change default to true for new_dtags.
296
297 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
298
299         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
300         when enable_new_dtags is false.  Only add DT_RUNPATH when
301         enable_new_dtags is true.
302
303 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
304
305         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
306         used in declaration and definition consistent.
307         (Target_powerpc::symval_for_branch): Ditto.
308
309 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
310
311         * testsuite/plugin_final_layout.cc: Fix comment.
312
313 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
314
315         * layout.cc (Layout::layout): Do not do default sorting for
316         text sections when section ordering is specified.
317         (make_output_section): Ditto.
318         * testsuite/plugin_final_layout.cc: Name the function sections
319         to catch reordering issues.
320
321 2013-01-15  Alan Modra  <amodra@gmail.com>
322
323         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
324         plt-thread-safe.
325
326 2013-01-15  Alan Modra  <amodra@gmail.com>
327
328         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
329         * testsuite/Makefile.in: Regenerate.
330
331 2013-01-14  Alan Modra  <amodra@gmail.com>
332
333         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
334         * testsuite/Makefile.in: Regenerate.
335
336 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
337
338         PR bfd/14430
339         Fix mingw gold build with plugins enabled
340         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
341         * configure.ac: Export DLOPEN_LIBS and add headers check.
342         * plugin.cc: Handle non-dlfcn case.
343         * Makefile.in: Regenerate.
344         * config.in: Regenerate.
345         * configure: Regenerate.
346         * testsuite/Makefile.in: Regenerate.
347
348 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
349
350         * output.h (sort_attached_input_sections): Change to be public.
351         * script-sections.cc
352         (Output_section_definition::set_section_addresses): Sort
353         attached input sections according to section order before linker
354         script assigns section addresses.
355         (Orphan_output_section::set_section_addresses): Sort
356         attached input sections according to section order before linker
357         script assigns section addresses.
358         * Makefile.am (final_layout.sh): Use a simple linker script to
359         check if section ordering still works.
360         * Makefile.in: Regenerate.
361
362 2013-01-09  Ben Cheng  <bccheng@google.com>
363
364         * arm.cc (Target_arm::attributes_accept_div): New function.
365         (Target_arm::attributes_forbid_div): New function.
366         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
367         attribute using the same new functions as what bfd/elf32_arm.c
368         does.
369
370 2013-01-07  Cary Coutant  <ccoutant@google.com>
371
372         PR gold/14993
373         * output.cc (Output_section::add_input_section): For incremental
374         updates, don't track input sections that are allocated from patch
375         space.
376
377 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
378             Ian Lance Taylor  <iant@google.com>
379
380         PR gold/14897
381         * configure.ac (--enable-ld): Removed.
382         (install_as_default): Set to yes only for --enable-gold=default
383         or --disable-ld.
384         * configure: Regenerated.
385
386 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
387
388         * options.h (General_options): Add -fuse-ld= for GCC linker
389         option compatibility.
390
391 2013-01-04  Cary Coutant  <ccoutant@google.com>
392
393         * configure.ac: Fix typo restoring CXXFLAGS.
394         * configure: Regenerate.
395
396 2013-01-04  Cary Coutant  <ccoutant@google.com>
397
398         * testsuite/Makefile.am (CXXLINK_S): New macro.
399         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
400         * testsuite/Makefile.in: Regenerate.
401
402 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
403
404         * version.cc (print_version): Update copyright year to 2013.
405
406 2012-12-20  Ian Lance Taylor  <iant@google.com>
407
408         * layout.cc (Layout::special_ordering_of_input_section): New
409         function.
410         (Layout::layout): If input section requires special ordering, must
411         sort input sections.
412         (Layout::make_output_section): May sort .text input sections.
413         (Layout::is_section_name_prefix_grouped): Remove.
414         * layout.h (class Layout): Declare
415         special_ordering_of_input_section.  Don't declare
416         is_section_name_prefix_grouped.
417         * output.cc (Output_section::add_input_section): Revert last
418         change.
419         (Output_section::Input_section_sort::match_file_name): Don't crash
420         if called on output section data.
421         (Output_section::Input_section_sort_compare): Sort based on
422         special ordering.
423         (Output_section::Input_section_sort_section_order_index_compare):
424         Revert last patch.
425         (Output_section::sort_attached_input_sections): Likewise.
426
427 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
428
429         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
430         * layout.h (Layout::is_section_name_prefix_grouped): New function.
431         * output.cc (Output_section::add_input_section): Check if section
432         name contains special prefix.  Keep input sections to sort such
433         sections.
434         (Output_section::Input_section_sort_section_order_index_compare
435          ::operator()): Group sections according to prefixes.
436         (Output_section::sort_attached_input_sections): Add condition to
437         Input_section_entry constructor call.
438         * testsuite/Makefile.am (text_section_grouping): New test.
439         * testsuite/Makefile.in: Regenerate.
440         * testsuite/text_section_grouping.cc: New file.
441         * testsuite/text_section_grouping.sh: New file.
442
443 2012-12-17  Nick Clifton  <nickc@redhat.com>
444
445         * Makefile.am: Add copyright notice.
446         * NEWS: Likewise.
447         * README: Likewise.
448         * configure.ac: Likewise.
449         * ftruncate.c: Likewise.
450         * Makefile.in: Regenerate.
451
452 2012-12-14  Cary Coutant  <ccoutant@google.com>
453
454         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
455         --no-as-needed flag.
456         (exception_separate_shared_12_test): Likewise.
457         (incremental_copy_test): Likewise.
458         * testsuite/Makefile.in: Regenerate.
459
460 2012-12-14  Cary Coutant  <ccoutant@google.com>
461
462         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
463         (Dwp_output_file::Dwp_index::enter_set): Add assert.
464
465 2012-12-12  Alan Modra  <amodra@gmail.com>
466
467         * powerpc.cc (class Track_tls): New.
468         (class Relocate, class Scan): Inherit Track_tls.
469         (Target_powerpc::Scan::local, global): Track tls optimization
470         and avoid creating plt entry for __tls_get_addr if all uses
471         are optimized away.
472         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
473
474 2012-12-12  Alan Modra  <amodra@gmail.com>
475
476         * options.h (General_options): Add --toc-sort/--no-toc-sort.
477         Replace no_toc_optimize with toc_optimize.
478         * output.h (Output_section::input_sections): Provide non-const variant.
479         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
480         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
481         accessors.
482         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
483         (class Sort_toc_sections): New.
484         (Target_powerpc::do_finalize_sections): Sort toc sections.
485         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
486
487 2012-12-10  Roland McGrath  <mcgrathr@google.com>
488
489         * testsuite/binary_unittest.cc (read_all): New function.
490         (Sized_binary_test): Use it instead of ::read.
491         * fileread.cc (do_read): Don't assume pread always reads the whole
492         amount in a single call.
493
494 2012-12-10  Alan Modra  <amodra@gmail.com>
495
496         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
497         Set EM_PPC64 or EM_PPC here.
498         (Target_selector_powerpc::do_recognize): Delete.
499
500 2012-12-10  Alan Modra  <amodra@gmail.com>
501
502         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
503         stub_table_.
504         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
505
506 2012-12-07  Roland McGrath  <mcgrathr@google.com>
507
508         * testsuite/binary_unittest.cc (Sized_binary_test):
509         Use open_descriptor rather than ::open.
510
511 2012-12-07  Alan Modra  <amodra@gmail.com>
512
513         * powerpc.cc (Stub_table::do_write): Delete redundant Address
514         typedef and invalid_address constant.
515         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
516         instantiate constants.
517
518 2012-12-06  Roland McGrath  <mcgrathr@google.com>
519
520         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
521         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
522         * aclocal.m4: Regenerate.
523         * configure: Regenerate.
524         * Makefile.in: Regenerate.
525         * testsuite/Makefile.in: Regenerate.
526
527 2012-12-07  Alan Modra  <amodra@gmail.com>
528
529         * options.h (General_options): Add no_toc_optimize.
530         * powerpc.cc (ok_lo_toc_insn): New function.
531         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
532
533 2012-12-06  Alan Modra  <amodra@gmail.com>
534
535         * options.h (General_options): Add plt_align, plt_static_chain,
536         plt_thread_safe.  Update stub_group_size help text.
537         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
538         for new plt_thread_safe_ var.
539         (use_plt_offset): Correct comments.
540         (Target_powerpc::do_relax): Look for thread creation symbols to
541         determine default plt_thread_safe value.  Clear plt call stubs
542         as well as branch stubs each iteration.
543         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
544         insn constants.
545         (l, hi, ha, write_insn): Move earlier.
546         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
547         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
548         plt stubs too.
549         (Stub_table::update_size): Adjust.
550         (Stub_table::prev_size, set_prev_size): Delete.
551         (Stub_table::stub_align): Let --plt-align affect result.
552         (Stub_table::plt_call_size): Calculate sizes for various stubs.
553         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
554         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
555         (Stub_table::do_write): Support more stub variants.
556
557 2012-12-04  Alan Modra  <amodra@gmail.com>
558
559         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
560         (Target_powerpc::do_define_standard_symbols): New function.
561
562 2012-12-03  Alan Modra  <amodra@gmail.com>
563
564         * output.h: Formatting, whitespace.
565
566 2012-12-03  Alan Modra  <amodra@gmail.com>
567
568         * layout.h (Layout::get_executable_sections): Declare.
569         * layout.cc (Layout::get_executable_sections): New function.
570         * arm.cc (Target_arm::group_sections): Use it.
571         (Arm_output_section::group_sections): Delete now redundant test.
572         * output.cc (Output_reloc::Output_reloc): Add is_relative.
573         param to handle relative relocs.
574         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
575         (Output_data_reloc::add_absolute): Adjust.
576         (Output_data_reloc::add_relative): New function.
577         (Output_data::reset_data_size): New function.
578         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
579         (Output_section::set_addralign): New function.
580         (Output_section::checkpoint_set_addralign): New function.
581         (Output_section::clear_section_offsets_need_adjustment): New function.
582         (Output_section::input_sections): Make public.
583         * powerpc.cc (class Output_data_brlt_powerpc): New.
584         (class Stub_table, class Stub_control): New.
585         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
586         stub_table_, set_stub_table, stub_table): New vectors and accessor
587         functions.
588         (Target_powerpc::do_may_relax, do_relax, push_branch,
589         new_stub_table, stub_tables, brlt_section, group_sections,
590         add_branch_lookup_table, find_branch_lookup_table,
591         write_branch_lookup_table, make_brlt_section): New functions.
592         (Target_powerpc::struct Sort_sections, class Branch_info): New.
593         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
594         branch_info_): New vars.
595         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
596         make call stubs here.
597         (Output_data_glink): Remove all call stub handling from this class.
598         (Target_powerpc::Scan::local, global): Save interesting branch
599         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
600         (Target_powerpc::do_finalize_sections): Only make reg save/restore
601         functions on final link.
602         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
603         Handle long branch destinations too.
604         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
605         do_plt_address_for_local): Adjust lookup of plt call stubs.
606
607 2012-11-30  Alan Modra  <amodra@gmail.com>
608
609         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
610         relocs against protected symbols when building 32-bit shared libs.
611
612 2012-11-30  Alan Modra  <amodra@gmail.com>
613
614         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
615         param.  Call got_section() to make .got.  Update all callers
616         and their callers and so on.
617
618 2012-11-30  Alan Modra  <amodra@gmail.com>
619
620         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
621         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
622         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
623         value if it already exists.
624
625 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
626
627         PR gold/14858
628         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
629
630 2012-11-14  Roland McGrath  <mcgrathr@google.com>
631
632         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
633         than bfc instruction for data sandboxing.
634
635 2012-11-08  Alan Modra  <amodra@gmail.com>
636
637         * po/POTFILES.in: Regenerate.
638
639 2012-11-05  Alan Modra  <amodra@gmail.com>
640
641         * configure.ac: Apply 2012-09-10 change to config.in here.
642         * configure: Regenerate.
643
644 2012-11-05  Alan Modra  <amodra@gmail.com>
645
646         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
647         (struct Opd_ent): Use "Address" rather than "Offset".
648         (Output_data_got_powerpc::got_base_offset): Return Valtype.
649         (Target_powerpc::got_section): Make public.
650         (Target_powerpc::scan_relocs): Move code setting symbols..
651         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
652         Create _SDA_BASE_ only when referenced.
653
654 2012-11-02  Roland McGrath  <mcgrathr@google.com>
655
656         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
657         from last change.
658
659 2012-11-01  Roland McGrath  <mcgrathr@google.com>
660
661         * target.h (Sized_target::relocate_relocs): Use Elf_Off
662         for offset_in_output_section parameter.
663         (Sized_target::relocate_special_relocatable): Likewise.
664         * arm.cc (Target_arm::relocate_relocs): Likewise.
665         (Target_arm::relocate_special_relocatable): Likewise.
666         * i386.cc (Target_i386::relocate_relocs): Likewise.
667         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
668         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
669         * target-reloc.h (relocate_relocs): Likewise.
670         * testsuite/testfile.cc (Target_test): Likewise.
671         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
672         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
673
674         * system.h: Move inclusion of <clocale> to after <libintl.h> in
675         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
676
677         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
678         parameter, which is unused in the [!F_SETFD] case.
679
680         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
681         SYMNDX to off_t before comparing it to this->data_size().
682         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
683         * incremental.cc (Output_section_incremental_inputs::do_write):
684         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
685
686         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
687
688 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
689
690         * gold.cc (Target_arm::do_adjust_elf_header): Add the
691         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
692         in EABI_VER5.
693
694 2012-10-29  Cary Coutant  <ccoutant@google.com>
695
696         * dwp.cc (usage): Add file and exit status parameters;
697         add --help and --version options.
698         (print_version): New function.
699         (main): Add --help and --version options.
700
701 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
702
703         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
704         final_layout_sequence.txt.
705         * testsuite/Makefile.in: Regenerated.
706
707 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
708
709         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
710         COMPILE generated by automake.
711         (LINK1): Likewise.
712         (CXXCOMPILE1): Likewise.
713         (CXXLINK1): Likewise.
714         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
715         (LINK): Likewise.
716         (CXXCOMPILE): Likewise.
717         (CXXLINK): Likewise.
718         * testsuite/Makefile.in: Regenerated.
719
720 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
721
722         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
723         on bad fwrite return.
724
725 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
726
727         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
728         on val.
729
730 2012-10-23  Cary Coutant  <ccoutant@google.com>
731
732         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
733         * testsuite/Makefile.in: Regenerate.
734         * testsuite/dwp_test.h: New source file.
735         * testsuite/dwp_test_1.cc: New source file.
736         * testsuite/dwp_test_1.s: New source file.
737         * testsuite/dwp_test_1.sh: New source file.
738         * testsuite/dwp_test_1b.cc: New source file.
739         * testsuite/dwp_test_1b.s: New source file.
740         * testsuite/dwp_test_2.cc: New source file.
741         * testsuite/dwp_test_2.s: New source file.
742         * testsuite/dwp_test_2.sh: New source file.
743         * testsuite/dwp_test_main.cc: New source file.
744         * testsuite/dwp_test_main.s: New source file.
745
746 2012-10-23  Cary Coutant  <ccoutant@google.com>
747
748         * dwp.h: New header file.
749         * dwp.cc: New source file.
750         * gold.h: Move shared declarations to system.h.
751         * system.h: New header file.
752         * Makefile.am: Add dwp.
753         * Makefile.in: Regenerate.
754
755 2012-10-23  Cary Coutant  <ccoutant@google.com>
756
757         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
758         Dwarf_info_reader::read_from_pointer.
759         (Dwarf_pubnames_table::read_header): Likewise.
760         (Dwarf_pubnames_table::next_name): Likewise.
761         (Dwarf_die::read_attributes): Likewise.
762         (Dwarf_die::skip_attributes): Likewise.
763         (Dwarf_info_reader::read_from_pointer): New function template.
764         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
765         (Dwarf_pubnames_table): Likewise.
766         (Dwarf_info_reader::read_from_pointer): New function template.
767         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
768         Dwarf_pubnames_table ctor.
769
770 2012-10-23  Cary Coutant  <ccoutant@google.com>
771
772         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
773         abbrev_shndx.
774         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
775         abbrev_shndx_.
776         (Dwarf_info_reader::set_abbrev_shndx): New method.
777         (Dwarf_info_reader::abbrev_shndx_): New data member.
778
779 2012-10-23  Cary Coutant  <ccoutant@google.com>
780
781         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
782         from object, not parameters.
783         (Dwarf_info_reader::parse): Likewise.
784         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
785         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
786         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
787         methods.
788
789 2012-10-23  Cary Coutant  <ccoutant@google.com>
790
791         * fileread.cc (Input_file::Input_file): New constructor.
792         * fileread.h (class Input_file): Add new constructor.
793
794 2012-10-18  Alan Modra  <amodra@gmail.com>
795
796         PR gold/14727
797         * object.cc (Relobj::is_section_name_included): Also match
798         .sdata personality section.
799
800 2012-10-18  Alan Modra  <amodra@gmail.com>
801
802         * target-reloc.h (class Default_comdat_behavior): New, package up..
803         (get_comdat_behaviour): ..this.
804         (relocate_section): Add Relocate_comdat_behavior template arg,
805         adjust code to suit.
806         * arm.cc (Target_arm::relocate_section): Adjust to suit.
807         (Target_arm::scan_reloc_section): Likewise.
808         * i386.cc (Target_i386::relocate_section): Likewise.
809         * sparc.cc (Target_sparc::relocate_section): Likewise.
810         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
811         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
812         * powerpc.cc (class Relocate_comdat_behavior): New.
813         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
814         gold::relocate_section with new template arg.
815
816 2012-10-18  Alan Modra  <amodra@gmail.com>
817
818         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
819         dynamic relocs for GOT_TPREL got entries, without symbol if
820         resolving locally.
821         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
822         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
823         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
824
825 2012-10-17  Alan Modra  <amodra@gmail.com>
826
827         PR gold/14726
828         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
829
830 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
831
832         * layout.cc (Layout::include_section): Keep sections marked
833         SHF_EXCLUDE when doing relocatable links.
834
835 2012-10-16  Alan Modra  <amodra@gmail.com>
836
837         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
838         (Target_powerpc::do_finalize_sections): Call it.
839         (Output_data_save_res): New class and supporting functions.
840         (Target_powerpc::symval_for_branch): Only look up .opd entry for
841         normal symbols defined in object files.
842
843 2012-10-12  Alan Modra  <amodra@gmail.com>
844
845         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
846         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
847         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
848         section if scan_opd_relocs not yet called.
849         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
850
851 2012-10-12  Alan Modra  <amodra@gmail.com>
852
853         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
854         add_local_ifunc_entry): Revert last change.
855         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
856
857 2012-10-05  Alan Modra  <amodra@gmail.com>
858
859         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
860         do_plt_address_for_global): New functions.
861         (Output_data_got_powerpc::do_write): Don't segfault when linking
862         statically.
863         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
864         add_local_ifunc_entry): Return true on adding entry..
865         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
866         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
867         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
868         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
869         set up symbols here.
870         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
871         syms here.  Do so even when no .iplt.  Don't segfault when linking
872         statically.
873         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
874         new variants without reloc param.
875         (Glink_sym_ent::Glink_sym_ent): Likewise.
876         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
877         reloc when refs will resolve to plt call stub.
878         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
879         R_PPC_PLTREL24 to resolve locally.
880         (Target_powerpc::Scan::global): Correct ifunc handling.
881         (Target_powerpc::Relocate::relocate): Correct local sym glink
882         lookup.  Don't destroy "value" when we have a plt call stub,
883         and when checking plt call validity.
884         (Target_powerpc::do_dynsym_value): Simplify.
885
886 2012-10-05  Alan Modra  <amodra@gmail.com>
887
888         * i386.cc (Output_data_plt_i386::address_for_global,
889         address_for_local): Add plt offset to returned value.  Adjust uses.
890         * sparc.cc (Output_data_plt_sparc::address_for_global,
891         address_for_local): Likewise.
892         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
893         address_for_local): Likewise.
894         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
895         address_for_local): Likewise.
896         * target.h (Target::plt_address_for_global, plt_address_for_local):
897         Update comment.
898         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
899         (Output_data_got::Got_entry::write): Nor here.
900         * output.h: Comment fix.
901
902 2012-10-02  Jiong Wang  <jiwang@tilera.com>
903
904         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
905         global_offset_table_ value for larget got.
906         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
907
908 2012-09-29  Alan Modra  <amodra@gmail.com>
909
910         * powerpc.cc (Target_powerpc::iplt_): New output section.
911         (Target_powerpc::iplt_section, make_iplt_section,
912         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
913         (Target_powerpc::make_plt_entry): Handle ifunc syms.
914         Target_powerpc::plt_entry_count): Count iplt entries too.
915         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
916         reloc section in constructor.  New params.
917         (Target_powerpc::make_plt_section): Create reloc section here instead.
918         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
919         functions.
920         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
921         (Output_data_glink::add_entry, find_entry): New functions to
922         deal with local syms.
923         (Glink_sym_ent): Add support for local syms.
924         (Output_data_glink::do_write): Handle ifunc plt entries.
925         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
926         (Target_powerpc::Scan::local, global): Handle ifunc syms.
927         (Target_powerpc::Relocate::relocate): Likewise.
928         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
929
930 2012-09-25  Alan Modra  <amodra@gmail.com>
931
932         * object.h (Sized_relobj_file::adjust_local_symbol,
933         do_adjust_local_symbol): New functions.
934         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
935         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
936         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
937         and irregular opd entry spacing.
938         (Powerpc_relobj::do_read_relocs): Add opd size checks.
939         (Global_symbol_visitor_opd): New functor.
940         (Target_powerpc::do_finalize_sections): Omit global symbols defined
941         on deleted opd entries.
942
943 2012-09-15  Jiong Wang  <jiwang@tilera.com>
944
945         * tilegx.cc: New file.
946         * Makefile.am (TARGETSOURCES): Add tilegx.cc
947         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
948         * configure.tgt: Add entries for tilegx*.
949         * configure.ac: Likewise.
950         * Makefile.in: Rebuild.
951         * configure: Likewise.
952         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
953         tilegx.
954
955 2012-09-13  Alan Modra  <amodra@gmail.com>
956
957         * target-reloc.h (scan_relocs): Call scan.local for relocs
958         against symbols in discarded sections.  Pass is_discarded
959         param.
960         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
961         Add is_discarded param.
962         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
963         is_discarded to flag opd entry as discarded.  Don't emit dyn
964         relocs on such entries.
965         (Target_powerpc::Scan::global): Similarly detect and handle
966         such opd entries.
967         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
968         opd_ent_.  Update all uses.
969         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
970         (Target_powerpc::relocate_section): Zero out discarded opd
971         entry relocs.
972
973 2012-09-12  Ian Lance Taylor  <iant@google.com>
974
975         PR gold/14570
976         * output.cc: Rename Output_data_got template parameter from size
977         to got_size for all functions.  Compile all variants of
978         Output_data_got.
979         (Output_data_got::Got_entry::write): Correct use of size for
980         symbol value.  Use local_is_tls rather than casting to
981         Sized_relobj_file.
982         * object.h (class Object): Add local_is_tls and do_local_is_tls.
983         (class Sized_relobj_file): Add do_local_is_tls.
984         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
985
986 2012-09-11  Alan Modra  <amodra@gmail.com>
987
988         PR gold/14566
989         * layout.cc (Layout::set_segment_offsets): When using
990         common-page-size alignment, ensure we are on a new max-page-size
991         page.
992         * output.cc (Output_segment::set_section_addresses): Use
993         abi_pagesize, not common_pagesize for relro boundary.
994         (Output_segment::set_offset): Likewise.
995
996 2012-09-11  Alan Modra  <amodra@gmail.com>
997
998         * output.h (Output_data_got::add_global_tls, add_local_tls,
999         add_local_tls_pair): New functions.
1000         (Output_data_got::add_local_pair_with_rel): Remove second
1001         reloc param.  Expand comment.
1002         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1003         use_plt_or_tls_offset_, similarly for constructor param.
1004         (Output_data_got::Got_entry::write): Add got_index param.
1005         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1006         add_local_tls_pair): New functions.
1007         (Output_data_got::Got_entry::write): Handle tls symbols
1008         with use_plt_or_tls_offset_ set specially.
1009         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1010         (Output_data_got::do_write): Replace iterator with index, pass
1011         index to entry write function.
1012         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1013         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1014         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1015         call.
1016         * i386.cc (Target_i386::Scan::local): Likewise.
1017         * sparc.cc (Target_sparc::Scan::local): Likewise.
1018         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1019         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1020         do_tls_offset_for_global): New functions.
1021         (Target_powerpc::Scan::local): Correct TLS relocations and got
1022         entry values.
1023         (Target_powerpc::Scan::global): Don't emit unnecessary
1024         dynamic relocations on TLS GOT entries.
1025
1026 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1027
1028         * config.in: Disable sanity check for kfreebsd.
1029
1030 2012-09-10  Sterling Augustine  <saugustine@google.com>
1031
1032         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1033         (Gdb_index::pubtypes_read): New parameter.
1034         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1035         to calls.
1036         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1037         pubtypes_object_.
1038
1039 2012-09-09  Alan Modra  <amodra@gmail.com>
1040
1041         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1042         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1043         * gc.h (gc_process_relocs): Call target gc_add_reference.
1044         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1045         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1046         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1047         unnecessary cast.
1048         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1049         to cater for when we don't need code offset.  Update use.
1050         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1051         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1052         set_opd_valid): New functions.
1053         (Target_powerpc::do_gc_add_reference): New function.
1054         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1055         stashed refs.
1056         (Target_powerpc::do_gc_mark_symbol): New function.
1057
1058 2012-09-06  Cary Coutant  <ccoutant@google.com>
1059
1060         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1061         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1062         (Dwarf_die::skip_attributes): Likewise.
1063         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1064         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1065         (main): Call it.
1066         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1067
1068 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1069
1070         * testsuite/script_test_3.t: Add .got.plt output section
1071         statement.
1072         * testsuite/script_test_4.t: Likewise.
1073
1074 2012-09-05  Alan Modra  <amodra@gmail.com>
1075
1076         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1077         update all uses and lose "enum" when using type.
1078
1079 2012-09-05  Alan Modra  <amodra@gmail.com>
1080
1081         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1082         * configure: Regenerate.
1083         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1084         (plugin_final_layout.stdout): Likewise.
1085         (memory_test): Set page sizes to 0x1000.
1086         * testsuite/Makefile.in: Regenerate.
1087         * testsuite/discard_locals_test.sh: Add FIXME comment.
1088         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1089         * testsuite/pr14265.t: Add .got output section statement.
1090         * testsuite/script_test_2.t: Likewise.
1091         * testsuite/script_test_3.t: Likewise.
1092         * testsuite/script_test_4.t: Likewise.
1093         * testsuite/script_test_5.t: Likewise.
1094         * testsuite/script_test_6.t: Likewise.
1095         * testsuite/script_test_7.t: Likewise.
1096         * testsuite/script_test_9.t: Likewise.
1097
1098 2012-09-05  Alan Modra  <amodra@gmail.com>
1099
1100         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1101         (Powerpc_relocate_functions::Status): New typedef.
1102         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1103         (Target_powerpc::Scan::local): Handle REL64.
1104         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1105         for REL32 and REL64.
1106         (Target_powerpc::symval_for_branch): New function, extracted from..
1107         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1108         checks.  Report overflow errors.
1109
1110 2012-09-05  Alan Modra  <amodra@gmail.com>
1111
1112         * object.h (Sized_relobj_file::emit_relocs): Delete.
1113         (Sized_relobj_file::emit_relocs_reltype): Delete.
1114         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1115         relocate_relocs for --emit-relocs.
1116         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1117         * output.h: Update comment.
1118         (Output_segment::first_section): New function.
1119         (Output_segment::first_section_load_address): Use first_section.
1120         * output.cc (Output_segment::first_section): New function extracted..
1121         (Output_segment::first_section_load_address): ..from here.  Delete.
1122         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1123         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1124         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1125         adjust call to target.h function.
1126         * i386.cc (Target_i386): Likewise.
1127         * sparc.cc (Target_sparc): Likewise.
1128         * x86_64.cc (Target_x86_64): Likewise.
1129         * powerpc.cc (Target_powerpc): Likewise.
1130         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1131         first tls section has section symbol for optimised local dynamic
1132         output relocs.
1133         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1134         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1135         optimised tls code.
1136         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1137         Rename to relocate_relocs.  Update error message.
1138
1139 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1140
1141         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1142         --just-symbols.
1143
1144 2012-08-31  Alan Modra  <amodra@gmail.com>
1145
1146         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1147         (Powerpc_relobj::toc_base_offset): New stub function.
1148         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1149         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1150         (Target_powerpc::Relocate::enum skip_tls): New.
1151         (Target_powerpc::call_tls_get_addr_): New var.
1152         (Target_powerpc::is_branch_reloc): Move to file scope.
1153         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1154         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1155         New functions.
1156         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1157         (powerpc_info): Correct common_pagesize for ppc64.
1158         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1159         (Powerpc_relocate_functions): Add overflow check enums and functions.
1160         Add non-shift version of rela, rela_ua.  Delete all rel public
1161         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1162         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1163         addr16_ha3, addr14 functions.
1164         (Output_data_got_powerpc::add_constant_pair): New function.
1165         (Output_data_got_powerpc::got_base_offset): Likewise.
1166         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1167         (instruction constants): Sort, add some more.
1168         (Output_data_glink::do_write): Add and use Address typedef.  Use
1169         object->toc_base_offset() stub for 64-bit.
1170         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1171         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1172         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1173         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1174         Always treat .opd relocs as against locally defined symbol.
1175         Correct condition for RELATIVE relocs.
1176         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1177         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1178         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1179         calculations.  Handle TLS relocs, and more.  Add overflow
1180         checking and adjust for Powerpc_relocate_functions changes.
1181         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1182         Reinstate --emit-relocs code with FIXME.
1183
1184 2012-08-30  Alan Modra  <amodra@gmail.com>
1185
1186         * layout.cc (Layout::set_segment_offsets): Set p_align to
1187         abi_pagesize, not common_pagesize.
1188         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1189         to determine whether file header can go in segment.
1190
1191 2012-08-30  Alan Modra  <amodra@gmail.com>
1192
1193         * output.h (Output_reloc::Output_reloc <output section>): Add
1194         is_relative param.  Adjust calls.
1195         (Output_reloc::add_output_section_relative): New functions.
1196         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1197         is_relative.
1198         (Output_reloc::symbol_value): Handle SECTION_CODE.
1199
1200 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1201
1202         * gold.cc (queue_middle_tasks): Call layout again when unique
1203         segments for sections is desired.
1204         * layout.cc (Layout::Layout): Initialize new members.
1205         (Layout::get_output_section_flags): New function.
1206         (Layout::choose_output_section): Call get_output_section_flags.
1207         (Layout::layout): Make output section for mapping to a unique segment.
1208         (Layout::insert_section_segment_map): New function.
1209         (Layout::attach_allocated_section_to_segment): Make unique segment for
1210         output sections marked so.
1211         (Layout::segment_precedes): Check for unique segments when sorting.
1212         * layout.h (Layout::Unique_segment_info): New struct.
1213         (Layout::Section_segment_map): New typedef.
1214         (Layout::insert_section_segment_map): New function.
1215         (Layout::get_output_section_flags): New function.
1216         (Layout::is_unique_segment_for_sections_specified): New function.
1217         (Layout::set_unique_segment_for_sections_specified): New function.
1218         (Layout::unique_segment_for_sections_specified_): New member.
1219         (Layout::section_segment_map_): New member.
1220         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1221         Rename is_gc_pass_one to is_pass_one.
1222         Rename is_gc_pass_two to is_pass_two.
1223         Rename is_gc_or_icf to is_two_pass.
1224         Check for which pass based on whether symbols data is present.
1225         Make it two pass when unique segments for sections is desired.
1226         * output.cc (Output_section::Output_section): Initialize new
1227         members.
1228         * output.h (Output_section::is_unique_segment): New function.
1229         (Output_section::set_is_unique_segment): New function.
1230         (Output_section::is_unique_segment_): New member.
1231         (Output_section::extra_segment_flags): New function.
1232         (Output_section::set_extra_segment_flags): New function.
1233         (Output_section::extra_segment_flags_): New member.
1234         (Output_section::segment_alignment): New function.
1235         (Output_section::set_segment_alignment): New function.
1236         (Output_section::segment_alignment_): New member.
1237         (Output_segment::Output_segment): Initialize is_unique_segment_.
1238         (Output_segment::is_unique_segment): New function.
1239         (Output_segment::set_is_unique_segment): New function.
1240         (Output_segment::is_unique_segment_): New member.
1241         * plugin.cc (allow_unique_segment_for_sections): New function.
1242         (unique_segment_for_sections): New function.
1243         (Plugin::load): Add new functions to transfer vector.
1244         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1245         * Makefile.in: Regenerate.
1246         * testsuite/plugin_final_layout.sh: Check if unique segment
1247         functionality works.
1248         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1249         are available.
1250         (allow_unique_segment_for_sections): New global.
1251         (unique_segment_for_sections): New global.
1252         (claim_file_hook): Call allow_unique_segment_for_sections.
1253         (all_symbols_read_hook): Call unique_segment_for_sections.
1254
1255 2012-08-22  Cary Coutant  <ccoutant@google.com>
1256
1257         * layout.cc (Layout::include_section): Don't assert on GROUP
1258         sections with --emit-relocs.
1259
1260 2012-08-21  Cary Coutant  <ccoutant@google.com>
1261
1262         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1263         if --export-dynamic-symbol names an undef symbol.
1264
1265 2012-08-18  Alan Modra  <amodra@gmail.com>
1266
1267         * powerpc.cc: Formatting and white space.
1268         (Powerpc_relobj): Rename got2_section_ to special_.
1269         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1270         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1271         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1272         (Target_powerpc): Add Address typedef and invalid_address.  Use
1273         throughout.
1274         (Target_powerpc::is_branch_reloc): New function.
1275         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1276         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1277         for dst_mask, value and addend.
1278         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1279         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1280         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1281         uint16_t for 24-bit offset.  Use get_output_section_offset and
1282         check return.
1283         (Target_powerpc::Scan::local): Handle more relocs.
1284         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1285         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1286         Plug in toc restoring insn after plt calls.  Translate branches
1287         to function descriptor symbols to corresponding entry point.
1288         (Target_powerpc::relocate_for_relocatable): Check return from
1289         get_output_section_offset.
1290         * symtab.h: Comment typo.
1291
1292 2012-08-14  Ian Lance Taylor  <iant@google.com>
1293
1294         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1295         unsupported_relocal_local to call unsupported_reloc_global.
1296
1297 2012-08-14  Nick Clifton  <nickc@redhat.com>
1298
1299         PR ld/14265
1300         * script-sections.cc (Sections_element::output_section_name): Add
1301         keep return parameter.
1302         (Output_section_element::match_name): Add keep return parameter.
1303         Return the value of the keep_ member.
1304         * script-sections.h (class Output_section): Update
1305         output_section_name prototype.
1306         * layout.cc (Layout::keep_input_section): New public member
1307         function.
1308         (Layout::choose_output_section): Pass keep parameter to
1309         output_section_name.
1310         * layout.h (class Layout): Add keep_input_section.
1311         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1312         sections.
1313         * testsuite/Makefile.am: Add a test.
1314         * testsuite/Makefile.in: Regenerate.
1315         * testsuite/pr14265.c: Source file for the test.
1316         * testsuite/pr14265.t: Linker script for the test.
1317         * testsuite/pr14265.sh: Shell script for the test.
1318
1319 2012-08-14  Alan Modra  <amodra@gmail.com>
1320
1321         * target.h (Target::output_section_name): New function.
1322         (Target::do_output_section_name): New function.
1323         * layout.cc (Layout::choose_output_section): Call the above.
1324         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1325
1326 2012-08-14  Alan Modra  <amodra@gmail.com>
1327
1328         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1329         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1330         for replace_constant call.
1331         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1332         (Output_data_glink::do_print_to_mapfile): New function.
1333         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1334         (Target_powerpc::Relocate::relocate): Likewise.
1335
1336 2012-08-14  Alan Modra  <amodra@gmail.com>
1337
1338         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1339         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1340         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1341         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1342         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1343         here.
1344         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1345         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1346         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1347         here.
1348         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1349         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1350
1351 2012-08-12  Alan Modra  <amodra@gmail.com>
1352
1353         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1354         (glink insn constants): Use uint32_t.
1355         (Output_data_glink::add_entry): Use insert, not [] operator.
1356
1357 2012-08-11  Alan Modra  <amodra@gmail.com>
1358
1359         * object.h (Sized_relobj_file::find_shdr): New function.
1360         (Sized_relobj_file::find_special_sections): New function.
1361         * object.cc (Sized_relobj_file::find_shdr): New function.
1362         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1363         (Sized_relobj_file::find_special_sections): New function, split out..
1364         (Sized_relobj_file::do_read_symbols): ..from here.
1365         * output.h (Output_data_got::replace_constant): New function.
1366         (Output_data_got::num_entries): New function.
1367         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1368         (Output_data_got::got_offset): Protected rather than private.
1369         (Output_data_got::replace_got_entry): New function.
1370         * output.cc (Output_data_got::replace_got_entry): New function.
1371         * powerpc.cc (class Powerpc_relobj): New.
1372         (class Powerpc_relocate_functions): Delete all psymval variants or
1373         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1374         Implement _ha functions using corresponding _hi function.
1375         (Powerpc_relobj::find_special_sections): New function.
1376         (Target_powerpc::do_make_elf_object): New function.
1377         (class Output_data_got_powerpc): New.
1378         (class Output_data_glink): New.
1379         (class Powerpc_scan_relocatable_reloc): New.
1380         Many more changes througout file.
1381
1382 2012-08-09  Nick Clifton  <nickc@redhat.com>
1383
1384         * po/vi.po: Updated Vietnamese translation.
1385
1386 2012-08-07  Ian Lance Taylor  <iant@google.com>
1387
1388         * layout.cc (Layout::add_target_dynamic_tags): If
1389         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1390         plt_rel.
1391
1392 2012-07-30  Nick Clifton  <nickc@redhat.com>
1393
1394         * po/gold.pot: Updated template.
1395         * po/es.po: Updated Spanish translation.
1396
1397 2012-07-18  Cary Coutant  <ccoutant@google.com>
1398
1399         PR gold/14344
1400         * configure.ac: Add check for -gpubnames support.
1401         * configure: Regenerate.
1402         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1403         support; force -gno-pubnames.
1404         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1405         support.
1406         (gdb_index_test_4): New test.
1407         * testsuite/Makefile.in: Regenerate.
1408         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1409         * testsuite/gdb_index_test_2.sh: Likewise.
1410         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1411         * testsuite/gdb_index_test_4.sh: New script.
1412         * testsuite/gdb_index_test_comm.sh: New script with common code;
1413         don't look for space after colon.
1414
1415 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1416
1417         * gold.cc (queue_middle_tasks): Update function order only after
1418         deferred objects due to plugins are processed.
1419
1420 2012-07-11  Ian Lance Taylor  <iant@google.com>
1421
1422         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1423         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1424         (Target_arm::scan_reloc_for_stub): Likewise.
1425         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1426         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1427         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1428         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1429         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1430
1431 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1432             Ian Lance Taylor  <iant@google.com>
1433
1434         PR gold/14309
1435         * configure.ac: Test whether std::tr1::hash<off_t> works.
1436         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1437         needed.
1438         * output.h (class Output_fill): Add virtual destructor.
1439         * configure, config.in: Rebuild.
1440
1441 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1442
1443         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1444
1445 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1446
1447         * plugin.cc (Plugin::load): Handle position independent executables.
1448
1449 2012-06-06  Cary Coutant  <ccoutant@google.com>
1450
1451         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1452         add .debug_macro.
1453         (lines_only_debug_sections): Likewise.
1454         (gdb_fast_lookup_sections): New static array.
1455         (is_gdb_debug_section): Rename formal parameter.
1456         (is_lines_only_debug_section): Likewise.
1457         (is_gdb_fast_lookup_section): New function.
1458         (Layout::include_section): Check for ".zdebug_" prefix; pass
1459         section name suffix to is_gdb_debug_section, et al.; check for
1460         fast-lookup sections when building .gdb_index.
1461         * options.h (--strip-debug-gdb): Update GDB version number.
1462
1463 2012-06-06  Cary Coutant  <ccoutant@google.com>
1464
1465         * configure.ac: Add check for fallocate.
1466         * configure: Regenerate.
1467         * config.in: Regenerate.
1468
1469         * options.h (class General_options): Add --mmap-output-file and
1470         --posix-fallocate options.
1471         * output.cc: (posix_fallocate): Remove; replace with...
1472         (gold_fallocate): New function.
1473         (Output_file::map_no_anonymous): Call gold_fallocate.
1474         (Output_file::map): Check --mmap-output-file option.
1475
1476 2012-06-05  Jing Yu  <jingyu@google.com>
1477
1478         * gold.h (textdomain): Add do {} to empty while(0).
1479         (bindtextdomain): Likewise.
1480
1481 2012-06-04  Cary Coutant  <ccoutant@google.com>
1482
1483         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1484         has_dynsym_index.
1485
1486 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1487
1488         * symtab.cc (Symbol_table::define_special_symbol):
1489         Initialize *poldsym to prevent uninitialized variable errors.
1490
1491 2012-05-23  Cary Coutant  <ccoutant@google.com>
1492
1493         * layout.cc (Layout::section_name_mapping): Add rules to handle
1494         exact match on .data.rel.ro.local or .data.rel.ro.
1495         (Layout::output_section_name): Check for exact matches.
1496
1497 2012-05-23  Cary Coutant  <ccoutant@google.com>
1498
1499         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1500         more carefully.
1501
1502 2012-05-22  Cary Coutant  <ccoutant@google.com>
1503
1504         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1505         object before exporting symbol.
1506
1507 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1508
1509         * testsuite/tls_test.cc: Include "config.h" first.
1510         * testsuite/tls_test_c.c: Likewise.
1511
1512 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1513             Nick Clifton  <nickc@redhat.com>
1514
1515         PR 14072
1516         * configure.in: Add check that sysdep.h has been included before
1517         any system header files.
1518         * configure: Regenerate.
1519         * config.in: Regenerate.
1520
1521 2012-05-14  Cary Coutant  <ccoutant@google.com>
1522
1523         * layout.cc (Layout::make_output_section): Mark .tdata section
1524         as RELRO.
1525         * testsuite/relro_test.cc: Add a TLS variable.
1526
1527 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1528
1529         PR gold/14091
1530         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1531         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1532         R_X86_64_64.
1533
1534 2012-05-08  Cary Coutant  <ccoutant@google.com>
1535
1536         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1537         (lines_only_debug_sections): Likewise.
1538
1539 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1540
1541         * nacl.cc: New file.
1542         * nacl.h: New file.
1543         * Makefile.am (CCFILES, HFILES): Add them.
1544         * Makefile.in: Regenerate.
1545         * i386.cc (Output_data_plt_i386_nacl): New class.
1546         (Output_data_plt_i386_nacl_exec): New class.
1547         (Output_data_plt_i386_nacl_dyn): New class.
1548         (Target_i386_nacl): New class.
1549         (Target_selector_i386_nacl): New class.
1550         (target_selector_i386): Use it instead of Target_selector_i386.
1551         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1552         (Target_x86_64_nacl): New class.
1553         (Target_selector_x86_64_nacl): New class.
1554         (target_selector_x86_64, target_selector_x32): Use it instead of
1555         Target_selector_x86_64.
1556         * arm.cc (Output_data_plt_arm_nacl): New class.
1557         (Target_arm_nacl): New class.
1558         (Target_selector_arm_nacl): New class.
1559         (target_selector_arm, target_selector_armbe): Use it instead of
1560         Target_selector_arm.
1561
1562         * target-select.cc (select_target): Take new Input_file* and off_t
1563         arguments, pass them on to recognize method of selector.
1564         * object.cc (make_elf_sized_object): Update caller.
1565         * parameters.cc (parameters_force_valid_target): Likewise.
1566         * incremental.cc (make_sized_incremental_binary): Likewise.
1567         * target-select.h: Update decl.
1568         (Target_selector::recognize): Take new Input_file* argument,
1569         pass it on to do_recognize.
1570         (Target_selector::do_recognize): Take new Input_file* argument.
1571         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1572         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1573         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1574         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1575
1576         * target.h (Target::Target_info): New members isolate_execinstr
1577         and rosegment_gap.
1578         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1579         * arm.cc (Target_arm::arm_info): Update initializer.
1580         * i386.cc (Target_i386::i386_info): Likewise.
1581         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1582         * sparc.cc (Target_sparc::sparc_info): Likewise.
1583         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1584         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1585         * layout.cc (Layout::attach_allocated_section_to_segment):
1586         Take new const Target* argument.  If target->isolate_execinstr(), act
1587         like --rosegment.
1588         (Layout::find_first_load_seg): Take new const Target* argument;
1589         if target->isolate_execinstr(), reject PF_X segments.
1590         (Layout::relaxation_loop_body): Update caller.
1591         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1592         reset file offset to zero when we hit LOAD_SEG, and then do a second
1593         loop over the segments before LOAD_SEG to reassign offsets after
1594         addresses have been determined.  Handle target->rosegment_gap().
1595         (Layout::attach_section_to_segment): Take new const Target* argument;
1596         pass it to attach_allocated_section_to_segment.
1597         (Layout::make_output_section): Update caller.
1598         (Layout::attach_sections_to_segments): Take new const Target* argument;
1599         pass it to attach_section_to_segment.
1600         * gold.cc (queue_middle_tasks): Update caller.
1601         * layout.h (Layout): Update method decls with new arguments.
1602
1603         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1604         Target_info pointer to use.
1605         (Target_arm::do_make_data_plt): New virtual method.
1606         (Target_arm::make_data_plt): New method that calls it.
1607         (Target_arm::make_plt_entry): Use it.
1608         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1609         for the section alignment.
1610         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1611         method.
1612         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1613         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1614         method.
1615         (Output_data_plt_arm::get_plt_entry_size): Call it.
1616         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1617         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1618         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1619         method.
1620         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1621         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1622         method instead of sizeof(plt_entry).
1623         (Output_data_plt_arm::add_entry): Likewise.
1624         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1625         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1626         than static method.
1627         (Target_arm::plt_entry_size): Likewise.
1628         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1629         Move to ...
1630         (Output_data_plt_arm_standard): ... here, new class.
1631         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1632         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1633         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1634
1635         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1636         Take additional argument for the PLT entry size.
1637         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1638         Use get_plt_entry_size method rather than plt_entry_size variable.
1639         (Output_data_plt_x86_64::reserve_slot): Likewise.
1640         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1641         (Output_data_plt_x86_64::add_entry): Likewise.
1642         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1643         (Output_data_plt_x86_64::address_for_global): Likewise.
1644         (Output_data_plt_x86_64::address_for_local): Likewise.
1645         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1646         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1647         Make method non-static.
1648         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1649         method.
1650         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1651         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1652         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1653         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1654         virtual method.
1655         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1656         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1657         virtual method.
1658         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1659         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1660         virtual method.
1661         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1662         (Output_data_plt_x86_64::plt_entry_size)
1663         (Output_data_plt_x86_64::first_plt_entry)
1664         (Output_data_plt_x86_64::plt_entry)
1665         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1666         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1667         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1668         (Output_data_plt_x86_64_standard): ... here, new class.
1669         (Target_x86_64::Target_x86_64): Take optional argument for the
1670         Target_info pointer to use.
1671         (Target_x86_64::do_make_data_plt): New virtual method.
1672         (Target_x86_64::make_data_plt): New method to call it.
1673         (Target_x86_64::init_got_plt_for_update): Use that.
1674         Call this->plt_->add_eh_frame method here.
1675         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1676         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1677         rather than static method.
1678         (Target_x86_64::plt_entry_size): Likewise.
1679         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1680         rather than plt_entry_size variable.  Move guts of PLT filling to...
1681         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1682         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1683         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1684
1685         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1686         additional argument for the section alignment.
1687         Don't do add_eh_frame_for_plt here.
1688         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1689         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1690         variable.
1691         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1692         method.
1693         (Output_data_plt_i386::get_plt_entry_size): Call it.
1694         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1695         (Output_data_plt_i386::add_eh_frame): New method to call it.
1696         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1697         method.
1698         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1699         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1700         method.
1701         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1702         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1703         method instead of plt_entry_size.
1704         (Output_data_plt_i386::plt_entry_size)
1705         (Output_data_plt_i386::plt_eh_frame_fde_size)
1706         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1707         (Output_data_plt_i386_standard): ... here, new class.
1708         (Output_data_plt_i386_exec): New class.
1709         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1710         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1711         (Output_data_plt_i386::exec_plt_entry): Move to ...
1712         (Output_data_plt_i386_exec::plt_entry): ... here.
1713         (Output_data_plt_i386_dyn): New class.
1714         (Output_data_plt_i386::first_plt_entry): Move to ...
1715         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1716         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1717         (Output_data_plt_i386_dyn::plt_entry): ... here.
1718         (Target_i386::Target_i386): Take optional argument for the Target_info
1719         pointer to use.
1720         (Target_i386::do_make_data_plt): New virtual method.
1721         (Target_i386::make_data_plt): New method to call it.
1722         (Target_i386::make_plt_section): Use that.
1723         Call this->plt_->add_eh_frame method here.
1724         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1725         rather than plt_entry_size variable.
1726         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1727         (Output_data_plt_i386::address_for_local): Likewise.
1728         (Output_data_plt_i386::do_write): Likewise.
1729         Move guts of PLT filling to...
1730         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1731         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1732         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1733         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1734
1735 2012-05-01  Cary Coutant  <ccoutant@google.com>
1736
1737         * dwarf_reader.cc (Dwarf_die::read_attributes)
1738         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1739         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1740         * reduced_debug_output.cc
1741         (Output_reduced_debug_info_section::get_die_end): Remove
1742         DW_FORM_GNU_ref_index.  Add default case.
1743
1744 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1745
1746         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1747         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1748         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1749         DW_AT_high_pc as offset from DW_AT_low_pc.
1750
1751         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1752         * testsuite/Makefile.in: Regenerate.
1753         * testsuite/gdb_index_test_3.c: New test source file.
1754         * testsuite/gdb_index_test_3.sh: New test source file.
1755
1756 2012-04-25  Ian Lance Taylor  <iant@google.com>
1757
1758         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1759         pointer.
1760         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1761         as a class, not a struct.
1762         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1763         (Target_arm::apply_cortex_a8_workaround): Likewise.
1764         * gc.h: Declare Reloc_types as a struct, not a class.
1765         * object.h: Declare Symbols_data as a struct.
1766         * reloc.h: Declare Read_relocs_data as a struct.
1767         * target.h: Declare Relocate_info as a struct.
1768
1769 2012-04-24  David S. Miller  <davem@davemloft.net>
1770
1771         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1772         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1773         and R_SPARC_WPLT30.
1774
1775 2012-04-24  Cary Coutant  <ccoutant@google.com>
1776
1777         * incremental-dump.cc (find_input_containing_global): Replace
1778         magic number with symbolic constant.
1779         (dump_incremental_inputs): Update version number.
1780         * incremental.cc (Output_section_incremental_inputs): Update version
1781         number; import symbolic constants from Incremental_inputs_reader.
1782         (Incremental_inputs::create_data_sections): Align relocations
1783         section correctly for 64-bit targets.
1784         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1785         constants; add padding.
1786         (Output_section_incremental_inputs::write_header): Add assert for
1787         header_size.
1788         (Output_section_incremental_inputs::write_input_files): Add assert
1789         for input_entry_size.
1790         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1791         add assert for object_info_size, input_section_entry_size,
1792         global_sym_entry_size.
1793         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1794         for data structure sizes; use them.
1795         (Incremental_input_entry_reader): Import symbolic constants from
1796         Incremental_inputs_reader; use them.
1797
1798 2012-04-23  David S. Miller  <davem@davemloft.net>
1799
1800         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1801         and elf_flags_set_.
1802         (Target_sparc::Target_sparc): Initialize new fields.
1803         (Target_sparc::do_make_elf_object): New function.
1804         (Target_sparc::do_adjust_elf_header): New function.
1805
1806 2012-04-23  Cary Coutant  <ccoutant@google.com>
1807
1808         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1809         CU range table of gdb index.
1810
1811 2012-04-20  David S. Miller  <davem@davemloft.net>
1812
1813         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1814         instead of false.
1815
1816 2012-04-16  David S. Miller  <davem@davemloft.net>
1817
1818         * sparc.cc (Target_sparc::got_address): New function.
1819         (Sparc_relocate_functions::gdop_hix22): New function.
1820         (Sparc_relocate_functions::gdop_lox10): New function.
1821         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1822         relocs.
1823         (Target_sparc::Scan::local): Likewise if the global symbol is not
1824         preemptible and is not IFUNC.
1825         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1826         transformations for local and non-preemptible non-IFUNC global
1827         symbols.
1828
1829         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1830         writing out 64-bit part of ranges.
1831
1832         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1833         -fpic and -fpie respectively.
1834         * Makefile.in: Regenerate.
1835
1836         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1837         (Target_sparc::Target_sparc): Initialize new field.
1838         (Target_sparc::do_plt_section_for_global): New function.
1839         (Target_sparc::do_plt_section_for_local): New function.
1840         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1841         (Target_sparc::make_plt_section): New function, broken out of
1842         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1843         (Target_sparc::make_plt_entry): Call make_plt_section.
1844         (Target_sparc::make_local_ifunc_plt_entry): New function.
1845         (Target_sparc::rela_ifunc_section): New function.
1846         (Target_sparc::plt_section): Remove const.
1847         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1848         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1849         and ifunc_count_ fields.
1850         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1851         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1852         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1853         (Output_data_plt_sparc::rela_ifunc): New function.
1854         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1855         (Output_data_plt_sparc::has_ifunc_section): New function.
1856         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1857         (Output_data_plt_sparc::address_for_global): New function.
1858         (Output_data_plt_sparc::address_for_local): New function.
1859         (Output_data_plt_sparc::plt_index_to_offset): New function.
1860         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1861         and entry_count.
1862         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1863         entry_count.
1864         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1865         R_SPARC_JMP_IREL to switch.
1866         (Target_sparc::Scan::check_non_pic): Likewise.
1867         (Target_sparc::Scan::local): Handle IFUNC symbols.
1868         (Target_sparc::Scan::local): Likewise.
1869         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1870         and plt_address_for_local.
1871         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1872         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1873
1874         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1875         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1876         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1877         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1878         global relocs too.
1879         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1880         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1881         calls.
1882         * sparc.cc (Target_sparc::Scan::global): Likewise.
1883         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1884
1885 2012-04-16  Cary Coutant  <ccoutant@google.com>
1886
1887         * archive.cc (Library_base::should_include_member): Check for
1888         --export-dynamic-symbol.
1889         * options.h (class General_options): Add --export-dynamic-symbol.
1890         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1891         --export-dynamic-symbol.
1892         (Symbol_table::gc_mark_undef_symbols): Likewise.
1893         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1894
1895 2012-04-12  David S. Miller  <davem@davemloft.net>
1896
1897         * sparc.cc (Reloc::wdisp10): New relocation method.
1898         (Reloc::h34): Likewise.
1899         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1900         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1901         R_SPARC_WDISP10.
1902         (Target_sparc::Scan::local): Likewise.
1903         (Target_sparc::Scan::global): Likewise.
1904         (Target_sparc::Relocate::relocate): Likewise.
1905
1906 2012-04-09  Cary Coutant  <ccoutant@google.com>
1907
1908         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1909         low_pc == 0.
1910
1911 2012-04-06  Ian Lance Taylor  <iant@google.com>
1912
1913         * timer.cc: #include <unistd.h>.
1914
1915 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1916
1917         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1918         * config.in: Regenerate.
1919         * configure: Regenerate.
1920
1921 2012-04-05  Nick Clifton  <nickc@redhat.com>
1922
1923         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1924         (AM_LC_MESSAGES): Add.
1925         * aclocal.m4: Regenerate.
1926         * config.in: Regenerate.
1927         * configure: Regenerate.
1928
1929 2012-03-21  Cary Coutant  <ccoutant@google.com>
1930
1931         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1932         * Makefile.in: Regenerate.
1933         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1934         (Sized_elf_reloc_mapper::symbol_section): New function.
1935         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1936         (make_elf_reloc_mapper): New function.
1937         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1938         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1939         (Dwarf_abbrev_table::do_get_abbrev): New function.
1940         (Dwarf_ranges_table::read_ranges_table): New function.
1941         (Dwarf_ranges_table::read_range_list): New function.
1942         (Dwarf_pubnames_table::read_section): New function.
1943         (Dwarf_pubnames_table::read_header): New function.
1944         (Dwarf_pubnames_table::next_name): New function.
1945         (Dwarf_die::Dwarf_die): New function.
1946         (Dwarf_die::read_attributes): New function.
1947         (Dwarf_die::skip_attributes): New function.
1948         (Dwarf_die::set_name): New function.
1949         (Dwarf_die::set_linkage_name): New function.
1950         (Dwarf_die::attribute): New function.
1951         (Dwarf_die::string_attribute): New function.
1952         (Dwarf_die::int_attribute): New function.
1953         (Dwarf_die::uint_attribute): New function.
1954         (Dwarf_die::ref_attribute): New function.
1955         (Dwarf_die::child_offset): New function.
1956         (Dwarf_die::sibling_offset): New function.
1957         (Dwarf_info_reader::check_buffer): New function.
1958         (Dwarf_info_reader::parse): New function.
1959         (Dwarf_info_reader::do_parse): New function.
1960         (Dwarf_info_reader::do_read_string_table): New function.
1961         (Dwarf_info_reader::lookup_reloc): New function.
1962         (Dwarf_info_reader::get_string): New function.
1963         (Dwarf_info_reader::visit_compilation_unit): New function.
1964         (Dwarf_info_reader::visit_type_unit): New function.
1965         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1966         Sized_elf_reloc_mapper.
1967         (Sized_dwarf_line_info::symbol_section): Remove function.
1968         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1969         (Sized_dwarf_line_info::read_line_mappings): Remove object
1970         parameter, adjust callers.
1971         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1972         * dwarf_reader.h: Include <sys/types.h>.
1973         (class Track_relocs): Remove forward declaration.
1974         (class Elf_reloc_mapper): New class.
1975         (class Sized_elf_reloc_mapper): New class.
1976         (class Dwarf_abbrev_table): New class.
1977         (class Dwarf_range_list): New class.
1978         (class Dwarf_ranges_table): New class.
1979         (class Dwarf_pubnames_table): New class.
1980         (class Dwarf_die): New class.
1981         (class Dwarf_info_reader): New class.
1982         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1983         (Sized_dwarf_line_info::symbol_section): Remove member function.
1984         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1985         base class.
1986         * gdb-index.cc: New source file.
1987         * gdb-index.h: New source file.
1988         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1989         and .debug_types sections, call Layout::add_to_gdb_index.
1990         (Sized_relobj_incr::do_section_name): Implement.
1991         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1992         return type; Implement.
1993         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1994         return type.
1995         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1996         parameter list and return type.
1997         (Sized_incr_dynobj::do_section_contents): Likewise.
1998         * layout.cc: Include gdb-index.h.
1999         (Layout::Layout): Initialize gdb_index_data_.
2000         (Layout::init_fixed_output_section): Check for .gdb_index section.
2001         (Layout::add_to_gdb_index): New function. Instantiate.
2002         * layout.h: Add forward declaration for class Gdb_index.
2003         (Layout::add_to_gdb_index): New member function.
2004         (Layout::gdb_index_data_): New data member.
2005         * main.cc: Include gdb-index.h.
2006         (main): Print statistics for gdb index.
2007         * object.cc (Object::section_contents): Move code into
2008         do_section_contents.
2009         (need_decompressed_section): Check for sections needed when building
2010         gdb index.
2011         (build_compressed_section_map): Likewise.
2012         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2013         gdb index.
2014         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2015         sections; call Layout::add_to_gdb_index.
2016         (Sized_relobj_file::do_decompressed_section_contents): Call
2017         do_section_contents directly.
2018         * object.h (Object::do_section_contents): Adjust parameter list and
2019         return type.
2020         (Object::do_decompressed_section_contents): Call do_section_contents
2021         directly.
2022         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2023         return type.
2024         * options.h (class General_options): Add --gdb-index option.
2025         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2026         list and return type.
2027         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2028         * reloc.h (Track_relocs::checkpoint): New function.
2029         (Track_relocs::reset): New function.
2030
2031         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2032         New test cases.
2033         * testsuite/Makefile.in: Regenerate.
2034         * testsuite/gdb_index_test.cc: New test source file.
2035         * testsuite/gdb_index_test_1.sh: New test source file.
2036         * testsuite/gdb_index_test_2.sh: New test source file.
2037
2038 2012-03-19  Doug Kwan  <dougkwan@google.com>
2039
2040         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2041         (Target_arm::do_finalize_sections): Remove code which defines
2042         __exidx_start and __exidx_end.  Make symbol table parameter
2043         anonymous as it is not used.
2044         * gold.cc (queue_middle_tasks): Call target hook to define any
2045         target-specific symbols.
2046         * target.h (Target::define_standard_symbols): New method.
2047         (Target::do_define_standard_symbols): Same.
2048         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2049         * testsuite/Makefile.in: Regenerate.
2050         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2051         and __exidx_end.
2052         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2053         relocations are generated for __exidx_start and __exidx_end.
2054
2055 2012-03-16  Doug Kwan  <dougkwan@google.com>
2056
2057         * testsuite/Makefile.am: Disable test initpri3b.
2058         * testsuite/Makefile.in: Regenerate.
2059
2060 2012-03-15  Doug Kwan  <dougkwan@google.com>
2061
2062         * arm.cc (Target_arm::got_section): Make .got section read-only
2063         if -z now is given.
2064
2065 2012-03-15  Ian Lance Taylor  <iant@google.com>
2066
2067         PR gold/13850
2068         * layout.cc (Layout::make_output_section): Correctly mark
2069         SHT_INIT_ARRAY, et. al., as relro.
2070
2071 2012-03-14  Doug Kwan  <dougkwan@google.com>
2072
2073         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2074         dynamic relocations for protected symbols in shared objects.
2075
2076 2012-03-13  Ian Lance Taylor  <iant@google.com>
2077
2078         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2079         keep the larger alignment.
2080
2081 2012-03-12  Cary Coutant  <ccoutant@google.com>
2082
2083         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2084         handling of DW_LNE_define_file.
2085
2086 2012-03-12  Cary Coutant  <ccoutant@google.com>
2087
2088         * reduced_debug_output.cc
2089         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2090         codes to switch.
2091
2092 2012-02-29  Cary Coutant  <ccoutant@google.com>
2093
2094         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2095
2096 2012-02-29  Cary Coutant  <ccoutant@google.com>
2097
2098         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2099         Call Object::decompressed_section_contents.
2100         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2101         New dtor.
2102         (Sized_dwarf_line_info::buffer_start_): New data member.
2103         * merge.cc (Output_merge_data::do_add_input_section): Call
2104         Object::decompressed_section_contents.
2105         (Output_merge_string::do_add_input_section): Likewise.
2106         * object.cc (need_decompressed_section): New function.
2107         (build_compressed_section_map): Decompress sections needed later.
2108         (Sized_relobj_file::do_decompressed_section_contents): New function.
2109         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2110         * object.h (Object::decompressed_section_contents): New function.
2111         (Object::discard_decompressed_sections): New function.
2112         (Object::do_decompressed_section_contents): New function.
2113         (Object::do_discard_decompressed_sections): New function.
2114         (Compressed_section_info): New type.
2115         (Compressed_section_map): Include decompressed section contents.
2116         (Sized_relobj_file::do_decompressed_section_contents): New function.
2117         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2118
2119 2012-02-16  Cary Coutant  <ccoutant@google.com>
2120
2121         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2122         * testsuite/Makefile.in: Regenerate.
2123
2124 2012-02-14  Cary Coutant  <ccoutant@google.com>
2125
2126         * options.cc (General_options::finalize): Disallow -pie and -static.
2127
2128 2012-02-03  Doug Kwan  <dougkwan@google.com>
2129
2130         * arm.cc (Arm_relocate_functions::abs8,
2131         Arm_relocate_functions::abs16): Use
2132         Bits::has_signed_unsigned_overflow32.
2133         (Arm_relocate_functions::thm_abs8): Correct range of
2134         overflow check.
2135         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2136         in assertions.
2137
2138 2012-02-02  Doug Kwan  <dougkwan@google.com>
2139
2140         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2141         position independent outputs, not just shared objects.
2142
2143 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2144
2145         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2146         * configure: Regenerated.
2147
2148 2012-01-27  Ian Lance Taylor  <iant@google.com>
2149
2150         * reloc.h (Bits): New class with static functions, copied from
2151         namespace utils in arm.cc.
2152         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2153         instead.
2154
2155 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2156
2157         * incremental.cc (write_info_blocks): Correct relocation offset.
2158
2159 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2160
2161         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2162         (Relocate::tls_gd_to_le): Likewise.
2163
2164 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2165
2166         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2167
2168 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2169
2170         * configure.ac: Check if -mcmodel=medium works.
2171         * configure: Regenerated.
2172
2173 2012-01-24  Cary Coutant  <ccoutant@google.com>
2174
2175         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2176         definition and ...
2177         (read_unsigned_LEB_128_x): ... this new function.
2178         (read_signed_LEB_128): Replaced with inline definition and ...
2179         (read_signed_LEB_128_x): ... this new function.
2180         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2181         (read_unsigned_LEB_128): Add inline definition.
2182         (read_signed_LEB_128_x): New function.
2183         (read_signed_LEB_128): Add inline definition.
2184         * testsuite/Makefile.am (leb128_unittest): New unit test.
2185         * testsuite/Makefile.in: Regenerate.
2186         * testsuite/leb128_unittest.cc: New unit test.
2187
2188 2012-01-23  Ian Lance Taylor  <iant@google.com>
2189
2190         PR gold/13617
2191         * i386.cc (Target_i386::do_code_fill): When using a jmp
2192         instruction, pad with nop instructions.
2193         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2194
2195 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2196
2197         * x86_64.cc (gc_process_relocs): Add typename on types used in
2198         template.
2199         (scan_relocs): Likewise.
2200         (relocate_section): Likewise.
2201         (apply_relocation): Likewise.
2202
2203 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2204
2205         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2206         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2207         under x32.
2208
2209 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2210
2211         * x86_64.cc: Initial support for x32.
2212
2213 2012-01-03  Cary Coutant  <ccoutant@google.com>
2214
2215         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2216         Use abstract base class for GOT.
2217         * gold/output.h (class Output_data_got_base): New abstract base class.
2218         (class Output_data_got): Derive from new base class, adjust ctors.
2219         (Output_data_got::reserve_slot): Make virtual; rename to
2220         do_reserve_slot; Adjust callers.
2221         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2222         pointer to abstract base class.
2223         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2224
2225 2011-12-18  Ian Lance Taylor  <iant@google.com>
2226
2227         * object.h (Relobj::local_symbol_value): New function.
2228         (Relobj::local_plt_offset): New function.
2229         (Relobj::local_has_got_offset): New function.
2230         (Relobj::local_got_offset): New function.
2231         (Relobj::set_local_got_offset): New function.
2232         (Relobj::do_local_symbol_value): New pure virtual function.
2233         (Relobj::do_local_plt_offset): Likewise.
2234         (Relobj::do_local_has_got_offset): Likewise.
2235         (Relobj::do_local_got_offset): Likewise.
2236         (Relobj::do_set_local_got_offset): Likewise.
2237         (Sized_relobj::do_local_has_got_offset): Rename from
2238         local_has_got_offset.
2239         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2240         (Sized_relobj::do_set_local_got_offset): Rename from
2241         set_local_got_offset.
2242         (Sized_relobj_file::do_local_plt_offset): Rename from
2243         local_plt_offset.
2244         (Sized_relobj_file::do_local_symbol_value): New function.
2245         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2246         local_plt_offset.
2247         * output.cc (Output_data_got::Got_entry::write): Change object to
2248         Relobj.  Use local_symbol_value.
2249         (Output_data_got::add_global_with_rel): Change rel_dyn to
2250         Output_data_reloc_generic*.  Use add_global_generic.
2251         (Output_data_got::add_global_with_rela): Remove.  Change all
2252         callers to use add_global_with_rel.
2253         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2254         Output_data_reloc_generic*.  Use add_global_generic.
2255         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2256         callers to use add_global_pair_with_rel.
2257         (Output_data_got::add_local): Change object to Relobj*.
2258         (Output_data_got::add_local_plt): Likewise.
2259         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2260         change rel_dyn to Output_data_reloc_generic*.  Use
2261         add_local_generic.
2262         (Output_data_got::add_local_with_rela): Remove.  Change all
2263         callers to use all_local_with_rel.
2264         (Output_data_got::add_local_pair_with_rel): Change object to
2265         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2266         add_output_section_generic.
2267         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2268         callers to use add_local_pair_with_rel.
2269         (Output_data_got::reserve_local): Change object to Relobj*.
2270         * output.h: (class Output_data_reloc_generic): Add pure virtual
2271         declarations for add_global_generic, add_local_generic,
2272         add_output_section_generic.
2273         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2274         functions for Output_data_reloc_generic.  Update declarations for
2275         changes listed in output.cc.
2276         (class Output_data_got): Change template parameter to got_size.
2277         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2278         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2279         function.
2280         (Sized_relobj_incr::do_local_plt_offset): New function.
2281         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2282         add_global_generic.
2283
2284 2011-12-17  Cary Coutant  <ccoutant@google.com>
2285
2286         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2287         * resolve.cc (Symbol_table::resolve): Likewise.
2288         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2289         arrays.
2290         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2291
2292 2011-12-16  Ian Lance Taylor  <iant@google.com>
2293
2294         * output.h (Output_data_reloc_generic::add): Only call
2295         add_dynamic_reloc if this is a dynamic reloc section.
2296
2297 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2298
2299         PR gold/13505
2300         * target-reloc.h (apply_relocation): Replace <64, false> with
2301         <size, big_endian>.
2302
2303 2011-11-25  Nick Clifton  <nickc@redhat.com>
2304
2305         * po/it.po: New Italian translation.
2306
2307 2011-11-17  Sterling Augustine  <saugustine@google.com>
2308
2309         * script.cc (script_include_directive): Implement.
2310         (read_script_file): New local variables name and search_path. Update
2311         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2312         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2313         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2314
2315 2011-11-11  Sterling Augustine  <saugustine@google.com>
2316
2317         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2318         (file_or_sections_cmd): Likewise.
2319
2320 2011-11-11  Doug Kwan  <dougkwan@google.com>
2321
2322         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2323         if --just-symbols is given.
2324
2325 2011-11-10  Doug Kwan  <dougkwan@google.com>
2326
2327         PR gold/13362
2328         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2329         when processing data relocs.
2330         * reloc.h (Relocate_functions::rel_unaligned): New method.
2331         (Relocate_functions::pcrel_unaligned): Ditto.
2332         (Relocate_functions::rel32_unaligned): Ditto.
2333         (Relocate_functions::pcrel32_unaligned): Ditto.
2334
2335 2011-11-09  Doug Kwan  <dougkwan@google.com>
2336
2337         PR gold/13362
2338         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2339         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2340         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2341         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2342         (Relocate_functions::rel_unaligned): New.
2343         (Relocate_functions::rel32_unaligned): New.
2344         * target-reloc.h (relocate_for_relocatable): Add code to handle
2345         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2346         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2347         arm_unaligned_reloc_r): New targets.
2348         * testsuite/Makefile.in: Regenerate.
2349         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2350         linking.
2351
2352 2011-11-02  Ian Lance Taylor  <iant@google.com>
2353
2354         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2355         NATIVE_LINKER.
2356         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2357         * options.cc (General_options::finalize): Use library search path
2358         from configure script if specified.  If not native and no sysroot,
2359         only search TOOLLIBDIR.
2360         * options.h (Search_directory::Search_directory): Change name to
2361         const std::string&.
2362         (General_options::add_to_library_path_with_sysroot): Change arg to
2363         const std::string&.
2364         * configure, Makefile.in, config.in: Rebuild.
2365
2366 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2367
2368         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2369         we are working around the ARM1176 Erratum.
2370         * options.h (General_options::fix_arm1176): Add option.
2371         * testsuite/Makefile.am: Add testcases, and keep current ones
2372         working.
2373         * testsuite/Makefile.in: Regenerate.
2374         * testsuite/arm_fix_1176.s: New file.
2375         * testsuite/arm_fix_1176.sh: Likewise.
2376
2377 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2378
2379         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2380         may_use_blx_.
2381         (Target_arm::may_use_blx): Remove method.
2382         (Target_arm::set_may_use_blx): Likewise.
2383         (Target_arm::may_use_v4t_interworking): New method.
2384         (Target_arm::may_use_v5t_interworking): Likewise.
2385         (Target_arm::may_use_blx_): Remove member variable.
2386         (Arm_relocate_functions::arm_branch_common): Check for v5T
2387         interworking.
2388         (Arm_relocate_functions::thumb_branch_common): Likewise.
2389         (Reloc_stub::stub_type_for_reloc): Likewise.
2390         (Target_arm::do_finalize_sections): Correct interworking checks.
2391         * testsuite/Makefile.am: Add new tests.
2392         * testsuite/Makefile.in: Regenerate.
2393         * testsuite/arm_farcall_arm_arm.s: New test.
2394         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2395         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2396         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2397         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2398         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2399         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2400         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2401
2402 2011-10-31  Cary Coutant  <ccoutant@google.com>
2403
2404         PR gold/13023
2405         * expression.cc (Expression::eval_with_dot): Add
2406         is_section_dot_assignment parameter.
2407         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2408         absolute and assigning to dot within a section.
2409         * script-sections.cc
2410         (Output_section_element_assignment::set_section_addresses): Pass
2411         dot_section to set_if_absolute.
2412         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2413         as is_section_dot_assignment flag to eval_with_dot.
2414         (Output_section_element_dot_assignment::set_section_addresses):
2415         Likewise.
2416         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2417         parameter.  Also set value if relative to dot_section; set the
2418         symbol's output_section.
2419         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2420         parameter.  Adjust all callers.
2421         (Expression::eval_maybe_dot): Likewise.
2422         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2423         Adjust all callers.
2424         * testsuite/script_test_2.t: Test assignment of an absolute value
2425         to dot within an output section element.
2426
2427 2011-10-31  Cary Coutant  <ccoutant@google.com>
2428
2429         * options.h (class General_options): Add --[no-]gnu-unique options.
2430         * symtab.cc (Symbol_table::sized_write_globals): Convert
2431         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2432
2433 2011-10-31  Cary Coutant  <ccoutant@google.com>
2434
2435         PR gold/13359
2436         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2437         unnecessary assertion.
2438         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2439
2440 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2441
2442         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2443         gc_mark_symbol.
2444         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2445         gc_mark_symbol.
2446         Change to just keep the section associated with symbol.
2447         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2448         they are externally visible and --export-dynamic is turned on.
2449         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2450
2451 2011-10-19  Ian Lance Taylor  <iant@google.com>
2452
2453         PR gold/13163
2454         * script-sections.cc
2455         (Output_section_element_dot_assignment::needs_output_section): New
2456         function.
2457
2458 2011-10-19  Ian Lance Taylor  <iant@google.com>
2459
2460         PR gold/13204
2461         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2462         --section-start option was seen.
2463         * options.h (General_options::any_section_start): New function.
2464
2465 2011-10-18  David S. Miller  <davem@davemloft.net>
2466
2467         PR binutils/13301
2468         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2469         member to track relocation locations that have moved during TLS
2470         reloc optimizations.
2471         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2472         (Target_sparc::Relocate::relocate): Adjust view down by 4
2473         bytes if it matches reloc_adjust_addr_.
2474         (Target_sparc::Relocate::relocate_tls): Always move the
2475         __tls_get_addr call delay slot instruction forward 4 bytes when
2476         performing relaxation.
2477
2478 2011-10-18  Cary Coutant  <ccoutant@google.com>
2479
2480         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2481         (Output_file::map_no_anonymous): Check for non-zero
2482         return code from posix_fallocate.
2483
2484 2011-10-17  Cary Coutant  <ccoutant@google.com>
2485
2486         PR gold/13245
2487         * plugin.cc (is_visible_from_outside): Check for symbols
2488         referenced from dynamic objects.
2489         * resolve.cc (Symbol_table::resolve): Don't count references
2490         from dynamic objects as references from real ELF files.
2491         * testsuite/plugin_test_2.sh: Adjust expected result.
2492
2493 2011-10-17  Cary Coutant  <ccoutant@google.com>
2494
2495         * gold.cc: Include timer.h.
2496         (queue_middle_tasks): Stamp time.
2497         (queue_final_tasks): Likewise.
2498         * main.cc (main): Store timer in parameters.  Print timers
2499         for each pass.
2500         * parameters.cc (Parameters::Parameters): Initialize timer_.
2501         (Parameters::set_timer): New function.
2502         (set_parameters_timer): New function.
2503         * parameters.h (Parameters::set_timer): New function.
2504         (Parameters::timer): New function.
2505         (Parameters::timer_): New data member.
2506         (set_parameters_timer): New function.
2507         * timer.cc (Timer::stamp): New function.
2508         (Timer::get_pass_time): New function.
2509         * timer.h (Timer::stamp): New function.
2510         (Timer::get_pass_time): New function.
2511         (Timer::pass_times_): New data member.
2512
2513 2011-10-17  Cary Coutant  <ccoutant@google.com>
2514
2515         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2516         task for members of lib groups.
2517
2518 2011-10-17  Cary Coutant  <ccoutant@google.com>
2519
2520         PR gold/13288
2521         * fileread.cc (File_read::find_view): Add assert.
2522         (File_read::make_view): Move bounds check (replace with assert)...
2523         (File_read::find_or_make_view): ... to here.
2524
2525 2011-10-12  Cary Coutant  <ccoutant@google.com>
2526
2527         * output.cc (Output_file::open_base_file): Handle case where
2528         ::read returns less than requested size.
2529
2530 2011-10-10  Cary Coutant  <ccoutant@google.com>
2531
2532         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2533         Initialize defined_count_.
2534         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2535         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2536         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2537         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2538         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2539         * incremental.h (Sized_relobj_incr::defined_count_): New data
2540         member.
2541         (Sized_incr_dynobj::defined_count_): New data member.
2542         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2543         Return zeroes instead of internal error.
2544
2545 2011-10-10  Cary Coutant  <ccoutant@google.com>
2546
2547         PR gold/13249
2548         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2549         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2550         * output.h (class Output_reloc): Add use_plt_offset flag.
2551         (Output_reloc::type_): Adjust size of bit field.
2552         (Output_reloc::use_plt_offset_): New bit field.
2553         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2554         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2555         flag.  Adjust all callers.
2556         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2557         creating RELATIVE relocations.
2558
2559 2011-10-10  Nick Clifton  <nickc@redhat.com>
2560
2561         * po/es.po: Updated Spanish translation.
2562         * po/fi.po: Updated Finnish translation.
2563
2564 2011-10-03   Diego Novillo  <dnovillo@google.com>
2565
2566         * options.cc (parse_uint): Fix dereference of RETVAL.
2567
2568 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2569
2570         * layout.h (section_order_map_): New member.
2571         (get_section_order_map): New member function.
2572         * output.cc (Output_section::add_input_section): Check for patterns
2573         only when --section-ordering-file is specified.
2574         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2575         output_sections have been formed.
2576         * layout.cc (Layout_Layout): Initialize section_order_map_.
2577         * plugin.cc (update_section_order): Store order in order_map. Do not
2578         update the order.
2579         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2580         * testsuite/Makefile.in: Regenerate.
2581         * testsuite/plugin_section_order.c: New file.
2582         * testsuite/plugin_final_layout.cc: New file.
2583         * testsuite/plugin_final_layout.sh: New file.
2584
2585 2011-09-29  Cary Coutant  <ccoutant@google.com>
2586
2587         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2588         Check for NULL.
2589         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2590         symbols during incremental update.
2591         (Symbol_table::add_from_dynobj): Likewise.
2592
2593 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2594             Ian Lance Taylor  <iant@google.com>
2595
2596         * symtab.cc (Symbol_table::define_special_symbol): Always
2597         canonicalize version string.
2598
2599 2011-09-26  Cary Coutant  <ccoutant@google.com>
2600
2601         * gold.cc (queue_initial_tasks): Move option checks ...
2602         * options.cc (General_options::finalize): ... to here. Disable
2603         some options; make others fatal.
2604
2605 2011-09-26  Cary Coutant  <ccoutant@google.com>
2606
2607         gcc PR lto/47247
2608         * plugin.cc (get_symbols_v2): New function.
2609         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2610         (is_referenced_from_outside): New function.
2611         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2612         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2613         (get_symbols): Pass version parameter.
2614         (get_symbols_v2): New function.
2615         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2616         parameter.
2617         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2618         (onload): Add LDPT_GET_SYMBOLS_V2.
2619         (all_symbols_read_hook): Use get_symbols_v2; check for
2620         LDPR_PREVAILING_DEF_IRONLY_EXP.
2621         * testsuite/plugin_test_3.sh: Update expected results.
2622
2623 2011-09-23  Simon Baldwin  <simonb@google.com>
2624
2625         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2626         configuration options.
2627         * configure: Regenerate.
2628         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2629         * Makefile.in: Regenerate.
2630         * testsuite/Makefile.in: Regenerate.
2631
2632 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2633
2634         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2635
2636 2011-09-19  Cary Coutant  <ccoutant@google.com>
2637
2638         * incremental.cc (can_incremental_update): Fix typo in comment.
2639         * incremental.h (can_incremental_update): Likewise.
2640
2641 2011-09-18  Cary Coutant  <ccoutant@google.com>
2642
2643         * incremental.cc (can_incremental_update): New function.
2644         * incremental.h (can_incremental_update): New function.
2645         * layout.cc (Layout::init_fixed_output_section): Call it.
2646         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2647         * object.cc (Sized_relobj_file::do_layout): Call
2648         can_incremental_update.
2649
2650 2011-09-13  Cary Coutant  <ccoutant@google.com>
2651
2652         * configure.ac: Check for glibc support for gnu_indirect_function
2653         support with static linking, setting automake conditional
2654         IFUNC_STATIC.
2655         * Makefile.in: Regenerate.
2656         * configure: Regenerate.
2657
2658         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2659         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2660         for IFUNC_STATIC.
2661         * testsuite/Makefile.in: Regenerate.
2662
2663 2011-09-13  Cary Coutant  <ccoutant@google.com>
2664
2665         * incremental.cc (Sized_relobj_incr::do_layout): Call
2666         report_comdat_group for kept comdat sections.
2667         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2668         * testsuite/Makefile.in: Regenerate.
2669         * testsuite/incr_comdat_test_1.cc: New source file.
2670         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2671         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2672         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2673
2674 2011-09-13  Ian Lance Taylor  <iant@google.com>
2675
2676         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2677         variable external_symbols_offset.
2678
2679 2011-09-12  Ian Lance Taylor  <iant@google.com>
2680
2681         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2682         triggered if object has no symbols.
2683
2684 2011-09-09  David S. Miller  <davem@davemloft.net>
2685
2686         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2687         (Output_fill_debug_line::do_write): Likewise.
2688
2689 2011-08-29  Cary Coutant  <ccoutant@google.com>
2690
2691         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2692         casts to match formatting specs.
2693         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2694
2695 2011-08-26  Cary Coutant  <ccoutant@google.com>
2696
2697         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2698         remaining hole size when allocating.
2699         (Layout::make_output_section): Set fill methods for debug sections.
2700         * layout.h (Free_list::Free_list_node): Move from private to
2701         public.
2702         (Free_list::set_min_hole_size): New function.
2703         (Free_list::begin, Free_list::end): New functions.
2704         (Free_list::min_hole_): New data member.
2705         * output.cc: Include dwarf.h.
2706         (Output_fill_debug_info::do_minimum_hole_size): New function.
2707         (Output_fill_debug_info::do_write): New function.
2708         (Output_fill_debug_line::do_minimum_hole_size): New function.
2709         (Output_fill_debug_line::do_write): New function.
2710         (Output_section::Output_section): Initialize new data member.
2711         (Output_section::set_final_data_size): Ensure patch space is larger
2712         than minimum hole size.
2713         (Output_section::do_write): Fill holes in debug sections.
2714         * output.h (Output_fill): New class.
2715         (Output_fill_debug_info): New class.
2716         (Output_fill_debug_line): New class.
2717         (Output_section::set_free_space_fill): New function.
2718         (Output_section::free_space_fill_): New data member.
2719         * testsuite/Makefile.am (incremental_test_3): Add
2720         --incremental-patch option.
2721         (incremental_test_4): Likewise.
2722         (incremental_test_5): Likewise.
2723         (incremental_test_6): Likewise.
2724         (incremental_copy_test): Likewise.
2725         (incremental_common_test_1): Likewise.
2726         * testsuite/Makefile.in: Regenerate.
2727
2728 2011-08-26  Nick Clifton  <nickc@redhat.com>
2729
2730         * po/es.po: Updated Spanish translation.
2731
2732 2011-08-01  Cary Coutant  <ccoutant@google.com>
2733
2734         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2735         * gold/testsuite/Makefile.in: Regenerate.
2736         * gold/testsuite/justsyms_exec.c: New source file.
2737         * gold/testsuite/justsyms_lib.c: New source file.
2738
2739 2011-08-01  Cary Coutant  <ccoutant@google.com>
2740
2741         * layout.cc (Layout::set_segment_offsets): Don't realign text
2742         segment if -Ttext was specified.
2743         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2744         file type.
2745         * object.h (Sized_relobj_file::e_type): New function.
2746         (Sized_relobj_file::e_type_): New data member.
2747         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2748         base address for ET_EXEC files.
2749         * target.cc (Target::do_make_elf_object_implementation): Allow
2750         ET_EXEC files with --just-symbols option.
2751
2752 2011-07-28  Cary Coutant  <ccoutant@google.com>
2753
2754         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2755         Add thread_number parameter.
2756         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2757         * workqueue-threads.cc
2758         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2759         current thread if its thread number is greater than desired thread
2760         count.
2761         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2762         Add thread_number parameter.
2763         (Workqueue::should_cancel_thread): Likewise.
2764         (Workqueue::find_runnable_or_wait): Pass thread_number to
2765         should_cancel_thread.
2766         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2767         parameter.
2768
2769 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2770
2771         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2772         only after checking if it cannot be forced local.
2773         * symtab.h (is_externally_visible): Check if the symbol is not forced
2774         local.
2775
2776 2011-07-15  Ian Lance Taylor  <iant@google.com>
2777
2778         * options.h (class General_options): Add --print-output-format.
2779         Move -EL next to -EB, for  better --help output.
2780         * target-select.cc: Include <cstdio>, "options.h", and
2781         "parameters.h".
2782         (Target_selector::do_target_bfd_name): New function.
2783         (print_output_format): New function.
2784         * target-select.h (class Target_selector): Update declarations.
2785         (Target_selector::target_bfd_name): New function.
2786         (print_output_format): Declare.
2787         * main.cc: Include "target-select.h".
2788         (main): Handle --print-output-format.
2789         * gold.cc: Include "target-select.h".
2790         (queue_initial_tasks): Handle --print-output-format when there are
2791         no input files.
2792         * parameters.cc (parameters_force_valid_target): Give a better
2793         error message if -EB/-EL does not match target.
2794         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2795         function.
2796
2797 2011-07-15  Ian Lance Taylor  <iant@google.com>
2798
2799         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2800         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2801         (Output_data_plt_i386::do_write): Write address of .dynamic
2802         section to first entry in .got.plt section.
2803         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2804         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2805         Initialize layout_.
2806         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2807         section to first entry in .got.plt section.
2808         * layout.h (Layout::dynamic_section): New function.
2809
2810 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2811
2812         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2813         to claim_file call.
2814         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2815         input_section_position_, and input_section_glob_.
2816         (read_layout_from_file): Call function section_ordering_specified.
2817         * layout.h (is_section_ordering_specified): New function.
2818         (section_ordering_specified): New function.
2819         (section_ordering_specified_): New boolean member.
2820         * main.cc(main): Call load_plugins after layout object is defined.
2821         * output.cc (Output_section::add_input_section): Use
2822         function section_ordering_specified to check if section ordering is
2823         needed.
2824         * output.cc (Output_section::add_relaxed_input_section): Use
2825         function section_ordering_specified to check if section ordering is
2826         needed.
2827         (Output_section::update_section_layout): New function.
2828         (Output_section::sort_attached_input_sections): Check if input section
2829         must be reordered.
2830         * output.h (Output_section::update_section_layout): New function.
2831         * plugin.cc (get_section_count): New function.
2832         (get_section_type): New function.
2833         (get_section_name): New function.
2834         (get_section_contents): New function.
2835         (update_section_order): New function.
2836         (allow_section_ordering): New function.
2837         (Plugin::load): Add the new interfaces to the transfer vector.
2838         (Plugin_manager::load_plugins): New parameter.
2839         (Plugin_manager::all_symbols_read): New parameter.
2840         (Plugin_manager::claim_file): New parameter. Save the elf object for
2841         unclaimed objects.
2842         (Plugin_manager::get_elf_object): New function.
2843         (Plugin_manager::get_view): Change to directly use the bool to check
2844         if get_view is called from claim_file_hook.
2845         * plugin.h (input_objects): New function
2846         (Plugin__manager::load_plugins): New parameter.
2847         (Plugin_manager::claim_file): New parameter.
2848         (Plugin_manager::get_elf_object): New function.
2849         (Plugin_manager::in_claim_file_handler): New function.
2850         (Plugin_manager::in_claim_file_handler_): New member.
2851         (layout): New function.
2852         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2853         handler with an extra parameter. Make the elf object before calling
2854         claim_file handler.
2855         * testsuite/plugin_test.c (get_section_count): New function pointer.
2856         (get_section_type): New function pointer.
2857         (get_section_name): New function pointer.
2858         (get_section_contents): New function pointer.
2859         (update_section_order): New function pointer.
2860         (allow_section_ordering): New function pointer.
2861         (onload): Check if the new interfaces exist.
2862
2863 2011-07-13  Ian Lance Taylor  <iant@google.com>
2864
2865         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2866         relro section.
2867         * x86_64.cc (Target_x86_64::got_section): Likewise.
2868         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2869         (relro_now_test_SOURCES): New variable.
2870         (relro_now_test_DEPENDENCIES): New variable.
2871         (relro_now_test_LDFLAGS): New variable.
2872         (relro_now_test_LDADD): New variable.
2873         (relro_now_test.so): New target.
2874         * testsuite/Makefile.in: Rebuild.
2875
2876 2011-07-12  Ian Lance Taylor  <iant@google.com>
2877
2878         PR gold/12980
2879         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2880         GLOB_DAT relocation rather than a RELATIVE relocation for a
2881         protected symbol when creating a shared library.
2882         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2883         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2884         * testsuite/protected_main_1.cc (main): Test that protected
2885         function has same address.
2886
2887 2011-07-11  Ian Lance Taylor  <iant@google.com>
2888
2889         PR gold/12979
2890         * options.h (class General_options): Add -Bgroup.
2891         * options.cc (General_options::finalize): If -Bgroup is set,
2892         default to --unresolved-symbols=report-all.
2893         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2894         * target-reloc.h (issue_undefined_symbol_error): Handle
2895         --unresolved-symbols=report-all.
2896
2897 2011-07-08  Ian Lance Taylor  <iant@google.com>
2898
2899         PR gold/11985
2900         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2901         if linker script discards key sections.
2902         (Layout::create_dynamic_symtab): Likewise.
2903         (Layout::assign_local_dynsym_offsets): Likewise.
2904         (Layout::sized_create_version_sections): Likewise.
2905         (Layout::create_interp): Likewise.
2906         (Layout::finish_dynamic_section): Likewise.
2907         (Layout::set_dynamic_symbol_size): Likewise.
2908
2909 2011-07-08  Ian Lance Taylor  <iant@google.com>
2910
2911         PR gold/12386
2912         * options.h (class General_options): Add --unresolved-symbols.
2913         * target-reloc.h (issue_undefined_symbol_error): Check
2914         --unresolved-symbols.  Add comments.
2915
2916 2011-07-08  Ian Lance Taylor  <iant@google.com>
2917
2918         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2919         expression more complex.
2920
2921 2011-07-08  Ian Lance Taylor  <iant@google.com>
2922
2923         PR gold/11317
2924         * target-reloc.h (issue_undefined_symbol_error): New inline
2925         function, broken out of relocate_section.
2926         (relocate_section): Call issue_undefined_symbol_error.
2927         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2928         there is no TLS segment if we are about to issue an undefined
2929         symbol error.
2930         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2931
2932 2011-07-08  Ian Lance Taylor  <iant@google.com>
2933
2934         PR gold/12279
2935         * resolve.cc (Symbol_table::should_override): Add fromtype
2936         parameter.  Change all callers.  Give error when linking together
2937         TLS and non-TLS symbol.
2938         (Symbol_table::should_override_with_special): Add fromtype
2939         parameter.  Change all callers.
2940         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2941         there is no TLS segment if we have reported some errors.
2942         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2943
2944 2011-07-08  Ian Lance Taylor  <iant@google.com>
2945
2946         PR gold/12372
2947         * target.h (Target::plt_address_for_global): New function.
2948         (Target::plt_address_for_local): New function.
2949         (Target::plt_section_for_global): Remove.
2950         (Target::plt_section_for_local): Remove.
2951         (Target::do_plt_address_for_global): New virtual function.
2952         (Target::do_plt_address_for_local): New virtual function.
2953         (Target::do_plt_section_for_global): Remove.
2954         (Target::do_plt_section_for_local): Remove.
2955         (Target::register_global_plt_entry): Add Symbol_table and Layout
2956         parameters.
2957         * output.cc (Output_data_got::Got_entry::write): Use
2958         plt_address_for_global and plt_address_for_local.
2959         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2960         address of output section.
2961         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2962         got_irelative_, and irelative_count_ fields.  Update
2963         declarations.
2964         (Output_data_plt_i386::has_irelative_section): New function.
2965         (Output_data_plt_i386::entry_count): Add irelative_count_.
2966         (Output_data_plt_i386::set_final_data_size): Likewise.
2967         (class Target_i386): Add got_irelative_ and rel_irelative_
2968         fields.  Update declarations.
2969         (Target_i386::Target_i386): Initialize new fields.
2970         (Target_i386::do_plt_address_for_global): New function replacing
2971         do_plt_section_for_global.
2972         (Target_i386::do_plt_address_for_local): New function replacing
2973         do_plt_section_for_local.
2974         (Target_i386::got_section): Create got_irelative_.
2975         (Target_i386::rel_irelative_section): New function.
2976         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2977         fields.  Don't define __rel_iplt_{start,end}.
2978         (Output_data_plt_i386::add_entry): Add symtab and layout
2979         parameters.  Change all callers.  Use different PLT and GOT for
2980         IFUNC symbols.
2981         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2982         layout parameters.  Change all callers.  Use different PLT and
2983         GOT.
2984         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2985         (Output_data_plt_i386::rel_irelative): New function.
2986         (Output_data_plt_i386::address_for_global): New function.
2987         (Output_data_plt_i386::address_for_local): New function.
2988         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2989         IRELATIVE GOT when changing IFUNC GOT entries.
2990         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2991         reloc.
2992         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2993         if we didn't create an IRELATIVE GOT.
2994         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2995         plt_address_for_local.
2996         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2997         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2998         got_irelative_, and irelative_count_ fields.  Update
2999         declarations.
3000         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3001         Initialize new fields.  Remove symtab parameter.  Change all
3002         callers.
3003         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3004         irelative_count_.
3005         (Output_data_plt_x86_64::has_irelative_section): New function.
3006         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3007         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3008         fields.  Update declarations.
3009         (Target_x86_64::Target_x86_64): Initialize new fields.
3010         (Target_x86_64::do_plt_address_for_global): New function replacing
3011         do_plt_section_for_global.
3012         (Target_x86_64::do_plt_address_for_local): New function replacing
3013         do_plt_section_for_local.
3014         (Target_x86_64::got_section): Create got_irelative_.
3015         (Target_x86_64::rela_irelative_section): New function.
3016         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3017         all callers.  Don't create __rel_iplt_{start,end}.
3018         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3019         parameters.  Change all callers.  Use different PLT and GOT for
3020         IFUNC symbols.
3021         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3022         layout parameters.  Change all callers.  Use different PLT and
3023         GOT.
3024         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3025         parameters.  Change all callers.  Use different PLT and GOT for
3026         IFUNC symbols.
3027         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3028         (Output_data_plt_x86_64::rela_irelative): New function.
3029         (Output_data_plt_x86_64::address_for_global): New function.
3030         (Output_data_plt_x86_64::address_for_local): New function.
3031         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3032         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3033         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3034         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3035         parameters.
3036         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3037         reloc.
3038         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3039         symbols if we didn't create an IRELATIVE GOT.
3040         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3041         plt_address_for_local.
3042         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3043         * testsuite/ifuncvar1.c: New test file.
3044         * testsuite/ifuncvar2.c: New test file.
3045         * testsuite/ifuncvar3.c: New test file.
3046         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3047         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3048         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3049         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3050         * testsuite/Makefile.in: Rebuild.
3051
3052 2011-07-07  Cary Coutant  <ccoutant@google.com>
3053
3054         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3055         (two_file_test_1_ndebug.o): Likewise.
3056         (two_file_test_1b_ndebug.o): Likewise.
3057         (two_file_test_2_ndebug.o): Likewise.
3058         (two_file_test_main_ndebug.o): Likewise.
3059         (incremental_test_2): Link with no-debug versions.
3060
3061 2011-07-06  Cary Coutant  <ccoutant@google.com>
3062
3063         * gold/incremental.cc
3064         (Output_section_incremental_inputs::write_info_blocks): Check for
3065         hidden and internal symbols.
3066
3067 2011-07-06  Cary Coutant  <ccoutant@google.com>
3068
3069         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3070         Check disposition for startup file.
3071         (Incremental_inputs::report_command_line): Ignore
3072         --incremental-startup-unchanged option.
3073         * options.cc (General_options::parse_incremental_startup_unchanged):
3074         New function.
3075         (General_options::General_options): Initialize new data member.
3076         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3077         (General_options): Add --incremental-startup-unchanged option.
3078         (General_options::incremental_startup_disposition): New function.
3079         (General_options::incremental_startup_disposition_): New data member.
3080
3081 2011-07-06  Cary Coutant  <ccoutant@google.com>
3082
3083         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3084         input file index to Script_info ctor.
3085         (Sized_incremental_binary::do_file_has_changed): Find the
3086         command-line argument for files named in scripts.
3087         * incremental.h (Script_info::Script_info): New ctor
3088         with input file index.
3089         (Script_info::input_file_index): New function.
3090         (Script_info::input_file_index_): New data member.
3091         (Incremental_binary::get_library): Add const.
3092         (Incremental_binary::get_script_info): Add const.
3093         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3094         * testsuite/Makefile.am (incremental_test_5): New test case.
3095         (incremental_test_6): New test case.
3096         * testsuite/Makefile.in: Regenerate.
3097
3098 2011-07-06  Cary Coutant  <ccoutant@google.com>
3099
3100         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3101         debug output when command lines differ.
3102
3103 2011-07-06  Cary Coutant  <ccoutant@google.com>
3104
3105         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3106         --incremental-patch option.
3107         * layout.cc (Free_list::allocate): Extend allocation beyond original
3108         end if enabled.
3109         (Layout::make_output_section): Mark sections that should get
3110         patch space.
3111         * options.cc (parse_percent): New function.
3112         * options.h (parse_percent): New function.
3113         (DEFINE_percent): New macro.
3114         (General_options): Add --incremental-patch option.
3115         * output.cc (Output_section::Output_section): Initialize new data
3116         members.
3117         (Output_section::add_input_section): Print section name when out
3118         of patch space.
3119         (Output_section::add_output_section_data): Likewise.
3120         (Output_section::set_final_data_size): Add patch space when
3121         doing --incremental-full.
3122         (Output_section::do_reset_address_and_file_offset): Remove patch
3123         space.
3124         (Output_segment::set_section_list_addresses): Print debug output
3125         only if --incremental-update.
3126         * output.h (Output_section::set_is_patch_space_allowed): New function.
3127         (Output_section::is_patch_space_allowed_): New data member.
3128         (Output_section::patch_space_): New data member.
3129         * parameters.cc (Parameters::incremental_full): New function.
3130         * parameters.h (Parameters::incremental_full): New function
3131         * testsuite/Makefile.am (incremental_test_2): Add test for
3132         --incremental-patch option.
3133         * testsuite/Makefile.in: Regenerate.
3134         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3135         (t18): Remove function body.
3136
3137 2011-07-05  Doug Kwan  <dougkwan@google.com>
3138
3139         PR gold/12771
3140         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3141         Arm_Address type for relocation result.
3142         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3143         overflow check.
3144         (Arm_relocate_functions::abs32): Use unaligned access.
3145         (Arm_relocate_functions::rel32): Ditto.
3146         (Arm_relocate_functions::prel31): Ditto.
3147         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3148         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3149         static data relocations.
3150         * testsuite/Makefile.in: Regnerate.
3151         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3152
3153 2011-07-05  Ian Lance Taylor  <iant@google.com>
3154
3155         PR gold/12392
3156         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3157         symbols if necessary.
3158         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3159
3160 2011-07-05  Ian Lance Taylor  <iant@google.com>
3161
3162         PR gold/12952
3163         * resolve.cc (Symbol::override_base_with_special): Simply override
3164         version with special symbol version, ignoring previous version.
3165
3166 2011-07-05  Ian Lance Taylor  <iant@google.com>
3167
3168         * object.cc (Sized_relobj_file::include_section_group): Add
3169         information to comment about signature location.
3170
3171 2011-07-02  Ian Lance Taylor  <iant@google.com>
3172
3173         PR gold/12957
3174         * options.h (class General_options): Add -f and -F.
3175         * options.cc (General_options::finalize): Fatal error if -f/-F
3176         are used without -shared.
3177         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3178
3179 2011-07-02  Ian Lance Taylor  <iant@google.com>
3180
3181         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3182
3183 2011-07-01  Ian Lance Taylor  <iant@google.com>
3184
3185         PR gold/12525
3186         PR gold/12952
3187         * resolve.cc (Symbol::override_base_with_special): Don't override
3188         the version if the overriding symbol has a different name.
3189         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3190         all callers.  If we give an error about an undefined version,
3191         define the base version if necessary.
3192         * dynobj.h (class Versions): Update declaration.
3193         * testsuite/weak_alias_test_5.cc: New file.
3194         * testsuite/weak_alias_test.script: New file.
3195         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3196         and versioned_alias have the right value, and call t2.
3197         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3198         weak_alias_test_5.so.
3199         (weak_alias_test_LDADD): Likewise.
3200         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3201         * testsuite/Makefile.in: Rebuild.
3202
3203 2011-07-01  Ian Lance Taylor  <iant@google.com>
3204
3205         PR gold/12525
3206         * options.h (class General_options): Support -z notext.
3207         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3208         -Wl,-z,notext.
3209         (two_file_shared_nonpic.so): Likewise.
3210         (two_file_shared_mixed.so): Likewise.
3211         (two_file_shared_mixed_1.so): Likewise.
3212         (weak_undef_lib_nonpic.so): Likewise.
3213         (alt/weak_undef_lib_nonpic.so): Likewise.
3214         (tls_test_shared_nonpic.so): Likewise.
3215         * testsuite/Makefile.in: Rebuild.
3216
3217 2011-07-01  Ian Lance Taylor  <iant@google.com>
3218
3219         PR gold/12525
3220         * configure.ac: Test whether static linking works, setting
3221         the automake conditional HAVE_STATIC.
3222         * testsuite/Makefile.am: Disable tests using -static if
3223         HAVE_STATIC is not true.
3224         * configure, testsuite/Makefile.in: Rebuild.
3225
3226 2011-07-01  Ian Lance Taylor  <iant@google.com>
3227
3228         PR gold/12525
3229         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3230         Assert if we see DW_EH_PE_indirect.
3231         * target.h (Target::ehframe_datarel_base): New function.
3232         (Target::do_ehframe_datarel_base): New target function.
3233         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3234         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3235         function.
3236
3237 2011-07-01  Ian Lance Taylor  <iant@google.com>
3238
3239         PR gold/12571
3240         * options.h (class General_options): Add
3241         --ld-generated-unwind-info.
3242         * ehframe.cc (Fde::write): Add address parameter.  Change all
3243         callers.  If associated with PLT, fill in address and size.
3244         (Cie::set_output_offset): Only add merge mapping if there is an
3245         object.
3246         (Cie::write): Add address parameter.  Change all callers.
3247         (Eh_frame::add_ehframe_for_plt): New function.
3248         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3249         input_offset_ fields into union u_, with new plt field.
3250         (Fde::Fde): Adjust for new union field.
3251         (Fde::Fde) [Output_data version]: New constructor.
3252         (Fde::add_mapping): Only add merge mapping if there is an object.
3253         (class Cie): Update declarations.
3254         (class Eh_frame): Declare add_ehframe_for_plt.
3255         * layout.cc (Layout::layout_eh_frame): Break out code into
3256         make_eh_frame_section, and call it.
3257         (Layout::make_eh_frame_section): New function.
3258         (Layout::add_eh_frame_for_plt): New function.
3259         * layout.h (class Layout): Update declarations.
3260         * merge.cc (Merge_map::add_mapping): Add assertion.
3261         * i386.cc: Include "dwarf.h".
3262         (class Output_data_plt_i386): Make first_plt_entry,
3263         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3264         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3265         and plt_eh_frame_fde.
3266         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3267         boundary.  Call add_eh_frame_for_plt if appropriate.
3268         * x86_64.cc: Include "dwarf.h".
3269         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3270         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3271         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3272         and plt_eh_frame_fde.
3273         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3274         appropriate.
3275
3276 2011-06-29  Ian Lance Taylor  <iant@google.com>
3277
3278         PR gold/12629
3279         * object.cc (Sized_relobj_file::layout_section): Change shdr
3280         parameter to be const.
3281         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3282         out of do_layout.
3283         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3284         appropriate.  Call layout_eh_frame_section.
3285         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3286         sections.
3287         * object.h (class Sized_relobj_file): Update declarations.
3288
3289 2011-06-29  Ian Lance Taylor  <iant@google.com>
3290
3291         PR gold/12652
3292         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3293         modifier.
3294         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3295
3296 2011-06-29  Ian Lance Taylor  <iant@google.com>
3297
3298         PR gold/12675
3299         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3300         SHT_X86_64_UNWIND.
3301         * layout.cc (Layout::layout_eh_frame): Likewise.
3302
3303 2011-06-29  Ian Lance Taylor  <iant@google.com>
3304
3305         PR gold/12695
3306         * layout.cc (Layout::symtab_section_shndx): New function.
3307         * layout.h (class Layout): Declare symtab_section_shndx.
3308         * output.cc (Output_section::write_header): Call it.
3309
3310 2011-06-29  Ian Lance Taylor  <iant@google.com>
3311
3312         PR gold/12818
3313         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3314         symbols which are not used in a relocation.
3315
3316 2011-06-28  Ian Lance Taylor  <iant@google.com>
3317
3318         PR gold/12898
3319         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3320         script create indistinguishable segments.
3321         (Layout::set_segment_offsets): Use stable_sort when sorting
3322         segments.  Pass this to Compare_segments constructor.
3323         * layout.h (class Layout): Make segment_precedes non-static.
3324         (class Compare_segments): Change from struct to class.  Add
3325         layout_ field.  Add constructor.
3326         * script-sections.cc
3327         (Script_sections::attach_sections_using_phdrs_clause): Rename
3328         local orphan to is_orphan.  Don't report failure to put empty
3329         section in segment.  On attachment failure, report name of
3330         section, and attach to first PT_LOAD segment.
3331
3332 2011-06-28  Ian Lance Taylor  <iant@google.com>
3333
3334         PR gold/12934
3335         * target-select.cc (Target_selector::Target_selector): Add
3336         emulation parameter.  Change all callers.
3337         (select_target_by_bfd_name): Rename from select_target_by_name.
3338         Change all callers.
3339         (select_target_by_emulation): New function.
3340         (supported_emulation_names): New function.
3341         * target-select.h (class Target_selector): Add emulation_ field.
3342         Update declarations.
3343         (Target_selector::recognize_by_bfd_name): Rename from
3344         recognize_by_name.  Change all callers.
3345         (Target_selector::supported_bfd_names): Rename from
3346         supported_names.  Change all callers.
3347         (Target_selector::recognize_by_emulation): New function.
3348         (Target_selector::supported_emulations): New function.
3349         (Target_selector::emulation): New function.
3350         (Target_selector::do_recognize_by_bfd_name): Rename from
3351         do_recognize_by_name.  Change all callers.
3352         (Target_selector::do_supported_bfd_names): Rename from
3353         do_supported_names.  Change all callers.
3354         (Target_selector::do_recognize_by_emulation): New function.
3355         (Target_selector::do_supported_emulations): New function.
3356         (select_target_by_bfd_name): Change name in declaration.
3357         (select_target_by_emulation): Declare.
3358         (supported_emulation_names): Declare.
3359         * parameters.cc (parameters_force_valid_target): Try to find
3360         target based on emulation from -m option.
3361         * options.h (class General_options): Change doc string for -m.
3362         * options.cc (help): Print emulations.
3363         (General_options::parse_V): Likewise.
3364         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3365         Add emulation parameter.  Change all callers.
3366
3367 2011-06-28  Ian Lance Taylor  <iant@google.com>
3368
3369         * target.h (class Target): Add osabi_ field.
3370         (Target::osabi): New function.
3371         (Target::set_osabi): New function.
3372         (Target::Target): Initialize osabi_.
3373         (Target::do_adjust_elf_header): Make pure virtual.
3374         (Sized_target::do_adjust_elf_header): Declare.
3375         * target.cc (Sized_target::do_adjust_elf_header): New function.
3376         (class Sized_target): Instantiate all versions.
3377         * freebsd.h (class Target_freebsd): Remove.
3378         (Target_selector_freebsd::do_recognize): Call set_osabi on
3379         Target.
3380         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3381         (Target_selector_freebsd::set_osabi): Remove.
3382         * i386.cc (class Target_i386): Inherit from Sized_target rather
3383         than Target_freebsd.
3384         * x86_64.cc (class Target_x86_64): Likewise.
3385
3386 2011-06-28  Ian Lance Taylor  <iant@google.com>
3387
3388         * target.h (Target::can_check_for_function_pointers): Rewrite.
3389         Make non-virtual.
3390         (Target::can_icf_inline_merge_sections): Likewise.
3391         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3392         (Target::Target_info): Add can_icf_inline_merge_sections field.
3393         (Target::do_can_check_for_function_pointers): New virtual
3394         function.
3395         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3396         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3397         from can_check_for_function_pointers, move in file.
3398         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3399         section_may_have_icf_unsafe_poineters, move in file.
3400         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3401         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3402         Rename from can_check_for_function_pointers, move in file.
3403         (Target_i386::can_icf_inline_merge_sections): Remove.
3404         (Target_i386::i386_info): Initialize
3405         can_icf_inline_merge_sections.
3406         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3407         Initialize can_icf_inline_merge_sections.
3408         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3409         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3410         Rename from can_check_for_function_pointers, move in file.
3411         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3412         (Target_x86_64::x86_64_info): Initialize
3413         can_icf_inline_merge_sections.
3414         * testsuite/testfile.cc (Target_test::test_target_info):
3415         Likewise.
3416         * icf.cc (get_section_contents): Correct formatting.
3417
3418 2011-06-27  Ian Lance Taylor  <iant@google.com>
3419
3420         * symtab.cc (Symbol::versioned_name): New function.
3421         (Symbol_table::add_to_final_symtab): Use versioned_name when
3422         appropriate.
3423         (Symbol_table::sized_write_symbol): Likewise.
3424         * symtab.h (class Symbol): Declare versioned_name.
3425         * stringpool.h (class Stringpool_template): Add variant of add
3426         which takes a std::basic_string.
3427         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3428         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3429         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3430         (ver_test_12.o): New target.
3431         * testsuite/Makefile.in: Rebuild.
3432
3433 2011-06-27  Doug Kwan  <dougkwan@google.com>
3434
3435         * arm.cc (Arm_relocate_functions::thm_jump8,
3436         Arm_relocate_functions::thm_jump11): Use a wider signed
3437         type to compute offset.
3438         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3439         arm_thm_jump8.
3440         * testsuite/Makefile.in: Regenerate.
3441         * testsuite/arm_branch_in_range.sh: Check test results of
3442         arm_thm_jump11 and arm_thm_jump8.
3443         * testsuite/arm_thm_jump11.s: New test source file.
3444         * testsuite/arm_thm_jump11.t: New linker script.
3445         * testsuite/arm_thm_jump8.s: New test source file.
3446         * testsuite/arm_thm_jump8.t: New linker script.
3447
3448 2011-06-24  Ian Lance Taylor  <iant@google.com>
3449
3450         * layout.cc: Include "object.h".
3451         (ctors_sections_in_init_array): New static variable.
3452         (Layout::is_ctors_in_init_array): New function.
3453         (Layout::layout): Add entry to ctors_sections_in_init_array if
3454         appropriate.
3455         * layout.h (class Layout): Declare is_ctors_in_init_array.
3456         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3457         is_ctors_reverse_view is set.
3458         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3459         all callers.  Set is_ctors_reverse_view field of View_size.
3460         (Sized_relobj_file::reverse_words): New function.
3461         * object.h (Sized_relobj_file::View_size): Add
3462         is_ctors_reverse_view field.
3463         (class Sized_relobj_file): Update declarations.
3464         * testsuite/initpri3.c: New test.
3465         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3466         initpri3b.
3467         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3468         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3469         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3470         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3471         * testsuite/Makefile.in: Rebuild.
3472
3473 2011-06-24  Cary Coutant  <ccoutant@google.com>
3474
3475         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3476         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3477         (debug_msg_cdebug.err): New targets.
3478         * testsuite/Makefile.in: Regenerate.
3479         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3480         Fix checks for link with shared library.
3481
3482 2011-06-24  Doug Kwan  <dougkwan@google.com>
3483
3484         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3485         skip empty text sections.
3486         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3487
3488 2011-06-22  Ian Lance Taylor  <iant@google.com>
3489
3490         PR gold/12910
3491         * options.h (class General_options): Add --ctors-in-init-array.
3492         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3493         friends as SHT_PROGBITS for merging sections.
3494         (Layout::layout): Remove special handling of .init_array and
3495         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3496         and .dtors if ctors_in_init_array.
3497         (Layout::make_output_section): Force correct section types for
3498         .init_array and friends.  Don't sort if doing relocatable link,
3499         Don't sort .ctors and .dtors if ctors_in_init_array.
3500         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3501         (Layout::output_section_name): Add relobj parameter.  Change all
3502         callers.  Handle .ctors. and .dtors. in code rather than table.
3503         Handle .ctors and .dtors if ctors_in_init_array.
3504         (Layout::match_file_name): New function, moved from output.cc.
3505         * layout.h (class Layout): Update declarations.
3506         * output.cc: Include "layout.h".
3507         (Input_section_sort_entry::get_priority): New function.
3508         (Input_section_sort_entry::match_file_name): Just call
3509         Layout::match_file_name.
3510         (Output_section::Input_section_sort_init_fini_compare::operator()):
3511         Handle .ctors and .dtors.  Sort by explicit priority rather than
3512         by name.
3513         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3514         * testsuite/initpri2.c: New test.
3515         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3516         (check_PROGRAMS): Add initpri2.
3517         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3518         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3519         * configure, testsuite/Makefile.in: Rebuild.
3520
3521 2011-06-19  Ian Lance Taylor  <iant@google.com>
3522
3523         PR gold/12880
3524         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3525         .interp section to a PT_INTERP segment even if we have seen a
3526         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3527         clause in a linker script.
3528         (Layout::finalize): Don't create a .interp section if we've
3529         already create a PT_INTERP segment.
3530         (Layout::create_interp): Always call choose_output_section (revert
3531         patch of 2011-06-17).  Don't create PT_INTERP segment.
3532         * script-sections.cc
3533         (Script_sections::create_note_and_tls_segments): Add a .interp
3534         section to a PT_INTERP segment even if we have seen a
3535         --dynamic-linker option.
3536
3537 2011-06-18  Ian Lance Taylor  <iant@google.com>
3538
3539         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3540         merely because a non-PT_LOAD segment has a dynamic reloc.
3541
3542 2011-06-18  Ian Lance Taylor  <iant@google.com>
3543
3544         * layout.cc (Layout::finish_dynamic_section): Don't create
3545         DT_FLAGS entry if not needed.
3546
3547 2011-06-18  Ian Lance Taylor  <iant@google.com>
3548
3549         PR gold/12745
3550         * layout.cc (Layout::layout_eh_frame): Correct handling of
3551         writable .eh_frame section.
3552
3553 2011-06-17  Ian Lance Taylor  <iant@google.com>
3554
3555         PR gold/12893
3556         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3557         symbol is redefined with the exact same object and value.
3558
3559 2011-06-17  Ian Lance Taylor  <iant@google.com>
3560
3561         PR gold/12880
3562         * layout.h (class Layout): Add interp_segment_ field.
3563         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3564         (Layout::attach_allocated_section_to_segment): If making shared
3565         library, put .interp section in PT_INTERP segment.
3566         (Layout::finalize): Also call create_interp if -dynamic-linker
3567         option was used.
3568         (Layout::create_interp): Assert that there is no PT_INTERP
3569         segment.  If not using a SECTIONS clause, use make_output_section.
3570         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3571         * script-sections.cc
3572         (Script_sections::create_note_and_tls_segments): If making shared
3573         library, put .interp section in PT_INTERP segment.
3574
3575 2011-06-17  Ian Lance Taylor  <iant@google.com>
3576
3577         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3578         when making a shared library.
3579
3580 2011-06-17  Ian Lance Taylor  <iant@google.com>
3581
3582         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3583         parameter.  Change all callers.  Don't issue warning about PC32
3584         against locally defined symbol.
3585
3586 2011-06-16  Ian Lance Taylor  <iant@google.com>
3587
3588         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3589         occurs in same object.
3590
3591 2011-06-14  Alan Modra  <amodra@gmail.com>
3592
3593         * po/POTFILES.in: Regenerate.
3594
3595 2011-06-09  Ian Lance Taylor  <iant@google.com>
3596
3597         * script-sections.cc
3598         (Orphan_output_section::set_section_addresses): For a relocatable
3599         link set address to 0.
3600
3601 2011-06-09  Cary Coutant  <ccoutant@google.com>
3602
3603         PR gold/12804
3604         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3605         used with --compress-debug-sections.
3606         * gold/object.cc (Sized_relobj_file::do_layout): Report
3607         uncompressed size of compressed input sections.
3608
3609 2011-06-08  Cary Coutant  <ccoutant@google.com>
3610
3611         PR gold/12804
3612         * testsuite/two_file_test_2_v1.cc: Change initialization of
3613         v2 to keep it in .data.
3614
3615 2011-06-07  Cary Coutant  <ccoutant@google.com>
3616
3617         * common.cc (Symbol_table::do_allocate_commons_list): Call
3618         gold_fallback.
3619         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3620         (Errors::fallback): New function.
3621         (gold_fallback): New function.
3622         * errors.h (Errors::fallback): New function.
3623         * gold.cc (gold_exit): Change status parameter to enum; adjust
3624         all callers.
3625         (queue_initial_tasks): Call gold_fallback.
3626         * gold.h: Include cstdlib.
3627         (Exit_status): New enum type.
3628         (gold_exit): Change status parameter to enum.
3629         (gold_fallback): New function.
3630         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3631         (Layout::create_symtab_sections): Likewise.
3632         (Layout::create_shdrs): Likewise.
3633         * main.cc (main): Adjust call to gold_exit.
3634         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3635         (Output_data_got::add_got_entry_pair): Likewise.
3636         (Output_section::add_input_section): Likewise.
3637         (Output_section::add_output_section_data): Likewise.
3638         (Output_segment::set_section_list_addresses): Likewise.
3639         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3640
3641 2011-06-07  Cary Coutant  <ccoutant@google.com>
3642
3643         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3644         for incremental links.
3645         * output.cc (Output_segment::set_section_list_addresses): Remove
3646         FIXME and test for TLS or BSS.
3647
3648 2011-06-07  Cary Coutant  <ccoutant@google.com>
3649
3650         * testsuite/Makefile.am: Add incremental_copy_test,
3651         incremental_common_test_1.
3652         * testsuite/Makefile.in: Regenerate.
3653         * testsuite/common_test_1_v1.c: New source file.
3654         * testsuite/common_test_1_v2.c: New source file.
3655         * testsuite/copy_test_v1.cc: New source file.
3656
3657 2011-06-07  Cary Coutant  <ccoutant@google.com>
3658
3659         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3660         update, allocate common from bss section's free list.
3661         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3662         linker-defined symbols.
3663         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3664         Skip GOT and PLT entries that are no longer referenced.
3665         (Output_section_incremental_inputs::write_info_blocks): Mark
3666         linker-defined symbols.
3667         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3668         * output.cc (Output_section::allocate): New function.
3669         * output.h (Output_section::allocate): New function.
3670         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3671         linker-defined symbols.
3672         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3673         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3674         (Symbol::init_base_output_data): Likewise.
3675         (Symbol::init_base_output_segment): Likewise.
3676         (Symbol::init_base_constant): Likewise.
3677         (Sized_symbol::init_output_data): Likewise.
3678         (Sized_symbol::init_output_segment): Likewise.
3679         (Sized_symbol::init_constant): Likewise.
3680         (Symbol_table::do_define_in_output_data): Likewise.
3681         (Symbol_table::do_define_in_output_segment): Likewise.
3682         (Symbol_table::do_define_as_constant): Likewise.
3683         * symtab.h (Symbol::is_predefined): New function.
3684         (Symbol::init_base_output_data): Add is_predefined parameter.
3685         (Symbol::init_base_output_segment): Likewise.
3686         (Symbol::init_base_constant): Likewise.
3687         (Symbol::is_predefined_): New data member.
3688         (Sized_symbol::init_output_data): Add is_predefined parameter.
3689         (Sized_symbol::init_output_segment): Likewise.
3690         (Sized_symbol::init_constant): Likewise.
3691         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3692
3693 2011-06-07  Cary Coutant  <ccoutant@google.com>
3694
3695         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3696         instead of emit_copy_reloc.
3697         (Copy_relocs::emit_copy_reloc): Refactor.
3698         (Copy_relocs::make_copy_reloc): New function.
3699         (Copy_relocs::add_copy_reloc): Remove.
3700         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3701         section.
3702         (Copy_relocs::make_copy_reloc): New function.
3703         (Copy_relocs::add_copy_reloc): Remove.
3704         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3705         unchanged input files.
3706         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3707         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3708         Reserve BSS space for COPY relocations.
3709         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3710         (Output_section_incremental_inputs::write_info_blocks): Record
3711         whether a symbol is copied from a shared object.
3712         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3713         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3714         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3715         (Incremental_input_entry_reader::get_output_symbol_index): Add
3716         is_copy parameter.
3717         (Incremental_binary::emit_copy_relocs): New function.
3718         (Incremental_binary::do_emit_copy_relocs): New function.
3719         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3720         new data member.
3721         (Sized_incremental_binary::add_copy_reloc): New function.
3722         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3723         (Sized_incremental_binary::Copy_reloc): New struct.
3724         (Sized_incremental_binary::Copy_relocs): New typedef.
3725         (Sized_incremental_binary::copy_relocs_): New data member.
3726         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3727         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3728         * target.h (Sized_target::emit_copy_reloc): New function.
3729         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3730
3731 2011-06-02  Cary Coutant  <ccoutant@google.com>
3732
3733         PR gold/12163
3734         * gold/archive.cc (Archive::Archive): Initialize new data member.
3735         (Archive::include_all_members): Return if archive has already been
3736         included.
3737         * gold/archive.h (Archive::include_all_members_): New data member.
3738
3739 2011-06-02  Nick Clifton  <nickc@redhat.com>
3740
3741         * dynobj.h: Fix spelling mistake in comment.
3742         * output.cc: Likewise.
3743
3744 2011-05-31  Doug Kwan  <dougkwan@google.com>
3745             Asier Llano
3746
3747         PR gold/12826
3748         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3749         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3750         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3751         redundant arm_exidx_test.so.
3752         * testsuite/Makefile.in: Regenerate.
3753         (check_SCRIPTS): Add pr12826.sh
3754         (check_DATA): Add pr12826.stdout
3755         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3756         * testsuite/pr12826.sh: New file.
3757         * testsuite/pr12826_1.s: Ditto.
3758         * testsuite/pr12826_1.s: Ditto.
3759
3760 2011-05-30  Ian Lance Taylor  <iant@google.com>
3761
3762         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3763         sections.
3764
3765 2011-05-29  Ian Lance Taylor  <iant@google.com>
3766
3767         PR gold/12804
3768         * testsuite/Makefile.am: Use different file name for two_file_test
3769         temporary file for each incremental test.
3770         * testsuite/Makefile.in: Rebuild.
3771
3772 2011-05-29  Ian Lance Taylor  <iant@google.com>
3773
3774         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3775         binary input file is empty.
3776
3777 2011-05-27  Ian Lance Taylor  <iant@google.com>
3778
3779         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3780         (ver_test_9.so): Likewise.
3781         * testsuite/Makefile.in: Rebuild.
3782
3783 2011-05-26 Cary Coutant  <ccoutant@google.com>
3784
3785         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3786         * incremental.cc (Incremental_inputs::report_input_section): Fix
3787         comment, indentation.
3788         (Incremental_inputs::report_comdat_group): New function.
3789         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3790         of data for incremental input file entry.
3791         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3792         group count, COMDAT group signatures.
3793         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3794         an unchanged input file.
3795         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3796         Initialize new data member.
3797         (Incremental_object_entry::add_comdat_group): New function.
3798         (Incremental_object_entry::get_comdat_group_count): New function.
3799         (Incremental_object_entry::get_comdat_signature_key): New function.
3800         (Incremental_object_entry::groups_): New data member.
3801         (Incremental_inputs::report_comdat_group): New function.
3802         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3803         data for incremental input file entry.
3804         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3805         (Incremental_input_entry_reader::get_input_section): Adjust size of
3806         data for incremental input file entry.
3807         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3808         (Incremental_input_entry_reader::get_comdat_group_signature): New
3809         function.
3810         * object.cc (Sized_relobj::include_section_group): Report kept
3811         COMDAT groups for incremental links.
3812
3813 2011-05-24  David Meyer  <pdox@google.com>
3814
3815         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3816         with name parameter.  Add found_name parameter.
3817         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3818         * dirsearch.h (class Dirsearch): Update declaration.
3819
3820 2011-05-24  Ian Lance Taylor  <iant@google.com>
3821
3822         * archive.cc (Library_base::should_include_member): Pull in object
3823         from archive if it defines the entry symbol.
3824         * parameters.cc (Parameters::entry): New function.
3825         * parameters.h (class Parameters): Declare entry.
3826         * output.h (class Output_file_header): Remove entry_ field.
3827         * output.cc (Output_file_header::Output_file_header): Remove entry
3828         parameter.  Change all callers.
3829         (Output_file_header::entry): Use parameters->entry.
3830         * gold.cc (queue_middle_tasks): Likewise.
3831         * plugin.cc (Plugin_hook::run): Likewise.
3832
3833 2011-05-24 Cary Coutant  <ccoutant@google.com>
3834
3835         * gold.cc (queue_initial_tasks): Pass incremental base filename
3836         to Output_file::open_base_file; don't print error message.
3837         * incremental-dump.cc (main): Adjust call to
3838         Output_file::open_for_modification.
3839         * incremental-dump.cc (main): Likewise.
3840         * incremental.cc (Incremental_inputs::report_command_line):
3841         Ignore --incremental-base option when comparing command lines.
3842         Ignore parameter when given as separate argument.
3843         * options.h (class General_options): Add --incremental-base.
3844         * output.cc (Output_file::Output_file):
3845         (Output_file::open_base_file): Add base_name and writable parameters;
3846         read base file into new file; print error message here.
3847         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3848         callers.
3849         * output.h (Output_file::open_for_modification): Rename to...
3850         (Output_file::open_base_file): ...this; add base_name and
3851         writable parameters; adjust all callers.
3852         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3853         callers.
3854         * testsuite/Makefile.am (incremental_test_4): Test
3855         --incremental-base.
3856         * testsuite/Makefile.in: Regenerate.
3857
3858 2011-05-24 Cary Coutant  <ccoutant@google.com>
3859
3860         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3861         incremental_test_4.
3862         * testsuite/Makefile.in: Regenerate.
3863         * testsuite/two_file_test_1_v1.cc: New test source file.
3864         * testsuite/two_file_test_1b_v1.cc: New test source file.
3865         * testsuite/two_file_test_2_v1.cc: New test source file.
3866
3867 2011-05-24 Cary Coutant  <ccoutant@google.com>
3868
3869         * dynobj.h (Dynobj::do_dynobj): New function.
3870         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3871         flag and soname for shared objects.
3872         * incremental.cc (Incremental_inputs::report_object): Make
3873         either Incremental_object_entry or Incremental_dynobj_entry; add
3874         soname to string table.
3875         (Incremental_inputs::report_input_section): Add assertion.
3876         (Output_section_incremental_inputs::set_final_data_size): Adjust
3877         type of input file entry for shared libraries; adjust size of
3878         shared library info entry.
3879         (Output_section_incremental_inputs::write_input_files): Write
3880         as_needed flag for shared libraries.
3881         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3882         of input file entry for shared libraries; write soname.
3883         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3884         soname from incremental info.
3885         * incremental.h (enum Incremental_input_flags): Add
3886         INCREMENTAL_INPUT_AS_NEEDED.
3887         (Incremental_input_entry::Incremental_input_entry): Initialize new
3888         data member.
3889         (Incremental_input_entry::set_as_needed): New function.
3890         (Incremental_input_entry::as_needed): New function.
3891         (Incremental_input_entry::do_dynobj_entry): New function.
3892         (Incremental_input_entry::as_needed_): New data member.
3893         (Incremental_object_entry::Incremental_object_entry): Don't check
3894         for shared library.
3895         (Incremental_object_entry::do_type): Likewise.
3896         (class Incremental_dynobj_entry): New class.
3897         (Incremental_input_entry_reader::as_needed): New function.
3898         (Incremental_input_entry_reader::get_soname): New function.
3899         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3900         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3901         size of shared library info entry.
3902         * layout.cc (Layout::finish_dynamic_section): Don't test for
3903         incremental link when adding DT_NEEDED entries.
3904         * object.h (Object::Object): Initialize new data member.
3905         (Object::dynobj): New function.
3906         (Object::set_as_needed): New function.
3907         (Object::as_needed): New function.
3908         (Object::do_dynobj): New function.
3909         (Object::as_needed_): New data member.
3910
3911 2011-05-24 Cary Coutant  <ccoutant@google.com>
3912
3913         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3914         info; adjust display of GOT entries.
3915         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3916         vector of input objects; remove file_status_.
3917         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3918         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3919         got_plt reader; call target hooks to reserve GOT entries.
3920         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3921         of input file info header and GOT info entry.
3922         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3923         relocation info.
3924         (Got_plt_view_info::got_descriptor): Remove.
3925         (Got_plt_view_info::sym_index): New data member.
3926         (Got_plt_view_info::input_index): New data member.
3927         (Local_got_offset_visitor::visit): Write input file index.
3928         (Global_got_offset_visitor::visit): Write 0 for input file index.
3929         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3930         with sym_index and input_index.
3931         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3932         incremental info GOT entry; replace got_descriptor with input_index.
3933         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3934         map from input file index to object.
3935         (Sized_relobj_incr::do_layout): Replace direct data member reference
3936         with accessor function.
3937         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3938         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3939         Adjust size of input file info header.
3940         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3941         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3942         (Incremental_input_entry_reader::get_input_section): Adjust size of
3943         input file info header.
3944         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3945         of incremental info GOT entry.
3946         (Incremental_got_plt_reader::get_got_desc): Remove.
3947         (Incremental_got_plt_reader::get_got_symndx): New function.
3948         (Incremental_got_plt_reader::get_got_input_index): New function.
3949         (Sized_incremental_binary::Sized_incremental_binary): Remove
3950         file_status_; add input_objects_.
3951         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3952         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3953         (Sized_incremental_binary::file_is_unchanged): Remove.
3954         (Sized_incremental_binary::set_input_object): New function.
3955         (Sized_incremental_binary::input_object): New function.
3956         (Sized_incremental_binary::file_status_): Remove.
3957         (Sized_incremental_binary::input_objects_): New data member.
3958         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3959         references.
3960         (Sized_relobj_incr::invalid_address): Move to base class.
3961         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3962         class.
3963         (Sized_relobj_incr::do_output_section_offset): Likewise.
3964         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3965         (Sized_relobj_incr::section_offsets_): Likewise.
3966         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3967         function.
3968         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3969         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3970         with accessor function.
3971         (Sized_relobj_file::do_layout): Likewise.
3972         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3973         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3974         (Sized_relobj_file::compute_final_local_value): Replace refs to
3975         section_offsets_ with accessor function.
3976         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3977         * object.h (Relobj::Relobj): Initialize new data members.
3978         (Relobj::add_dyn_reloc): New function.
3979         (Relobj::first_dyn_reloc): New function.
3980         (Relobj::dyn_reloc_count): New function.
3981         (Relobj::first_dyn_reloc_): New data member.
3982         (Relobj::dyn_reloc_count_): New data member.
3983         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3984         references.
3985         (Sized_relobj::Address): New typedef.
3986         (Sized_relobj::invalid_address): Move here from child class.
3987         (Sized_relobj::Sized_relobj): Initialize new data members.
3988         (Sized_relobj::sized_relobj): New function.
3989         (Sized_relobj::is_output_section_offset_invalid): Move here from
3990         child class.
3991         (Sized_relobj::get_output_section_offset): Likewise.
3992         (Sized_relobj::local_has_got_offset): Likewise.
3993         (Sized_relobj::local_got_offset): Likewise.
3994         (Sized_relobj::set_local_got_offset): Likewise.
3995         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3996         (Sized_relobj::clear_got_offsets): New function.
3997         (Sized_relobj::section_offsets): Move here from child class.
3998         (Sized_relobj::do_output_section_offset): Likewise.
3999         (Sized_relobj::do_set_section_offset): Likewise.
4000         (Sized_relobj::Local_got_offsets): Likewise.
4001         (Sized_relobj::local_got_offsets_): Likewise.
4002         (Sized_relobj::section_offsets_): Likewise.
4003         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4004         references.
4005         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4006         class.
4007         (Sized_relobj_file::sized_relobj): New function
4008         (Sized_relobj_file::local_has_got_offset): Move to base class.
4009         (Sized_relobj_file::local_got_offset): Likewise.
4010         (Sized_relobj_file::set_local_got_offset): Likewise.
4011         (Sized_relobj_file::get_output_section_offset): Likewise.
4012         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4013         (Sized_relobj_file::do_output_section_offset): Likewise.
4014         (Sized_relobj_file::do_set_section_offset): Likewise.
4015         (Sized_relobj_file::Local_got_offsets): Likewise.
4016         (Sized_relobj_file::local_got_offsets_): Likewise.
4017         (Sized_relobj_file::section_offsets_): Likewise.
4018         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4019         (all constructors).
4020         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4021         (Output_reloc::get_symbol_index): Likewise.
4022         (Output_reloc::local_section_offset): Likewise.
4023         (Output_reloc::get_address): Likewise.
4024         (Output_reloc::symbol_value): Likewise.
4025         (Output_data_got::reserve_slot): Move to class definition.
4026         (Output_data_got::reserve_local): New function.
4027         (Output_data_got::reserve_slot_for_global): Remove.
4028         (Output_data_got::reserve_global): New function.
4029         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4030         (all constructors, two instantiations).
4031         (Output_reloc::get_relobj): New function (two instantiations).
4032         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4033         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4034         (Output_data_reloc::add_global): Adjust type of relobj.
4035         (Output_data_reloc::add_global_relative): Likewise.
4036         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4037         (Output_data_reloc::add_local): Likewise.
4038         (Output_data_reloc::add_local_relative): Likewise.
4039         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4040         (Output_data_reloc::add_local_section): Likewise.
4041         (Output_data_reloc::add_output_section): Likewise.
4042         (Output_data_reloc::add_absolute): Likewise.
4043         (Output_data_reloc::add_target_specific): Likewise.
4044         (Output_data_got::reserve_slot): Move definition here.
4045         (Output_data_got::reserve_local): New function.
4046         (Output_data_got::reserve_global): New function.
4047         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4048         section_offsets_ with accessor function.
4049         (Sized_relobj_file::write_sections): Likewise.
4050         (Sized_relobj_file::do_relocate_sections): Likewise.
4051         * target.h (Sized_target::reserve_local_got_entry): New function.
4052         (Sized_target::reserve_global_got_entry): New function.
4053         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4054         (Target_x86_64::reserve_global_got_entry): New function.
4055         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4056
4057 2011-05-23 Cary Coutant  <ccoutant@google.com>
4058
4059         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4060         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4061         bit when checking got_type.
4062         * incremental.cc (Sized_incremental_binary::setup_readers):
4063         Store symbol table and string table locations; initialize bit vector
4064         of file status flags.
4065         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4066         unchanged files.
4067         (Sized_incremental_binary::do_process_got_plt): New function.
4068         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4069         (Output_section_incremental_inputs::set_final_data_size): Record
4070         file index for each input file.
4071         (Output_section_incremental_inputs::write_got_plt): Store file index
4072         instead of input entry offset for each GOT entry.
4073         * incremental.h
4074         (Incremental_input_entry::Incremental_input_entry): Initialize new
4075         data member.
4076         (Incremental_input_entry::set_offset): Store file index.
4077         (Incremental_input_entry::get_file_index): New function.
4078         (Incremental_input_entry::file_index_): New data member.
4079         (Incremental_binary::process_got_plt): New function.
4080         (Incremental_binary::do_process_got_plt): New function.
4081         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4082         data members.
4083         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4084         (Sized_incremental_binary::set_file_is_unchanged): New function.
4085         (Sized_incremental_binary::file_is_unchanged): New function.
4086         (Sized_incremental_binary::do_process_got_plt): New function.
4087         (Sized_incremental_binary::file_status_): New data member.
4088         (Sized_incremental_binary::main_symtab_loc_): New data member.
4089         (Sized_incremental_binary::main_strtab_loc_): New data member.
4090         * output.cc (Output_data_got::Got_entry::write): Add case
4091         RESERVED_CODE.
4092         (Output_data_got::add_global): Call add_got_entry.
4093         (Output_data_got::add_global_plt): Likewise.
4094         (Output_data_got::add_global_with_rel): Likewise.
4095         (Output_data_got::add_global_with_rela): Likewise.
4096         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4097         (Output_data_got::add_global_pair_with_rela): Likewise.
4098         (Output_data_got::add_local): Call add_got_entry.
4099         (Output_data_got::add_local_plt): Likewise.
4100         (Output_data_got::add_local_with_rel): Likewise.
4101         (Output_data_got::add_local_with_rela): Likewise.
4102         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4103         (Output_data_got::add_local_pair_with_rela): Likewise.
4104         (Output_data_got::reserve_slot): New function.
4105         (Output_data_got::reserve_slot_for_global): New function.
4106         (Output_data_got::add_got_entry): New function.
4107         (Output_data_got::add_got_entry_pair): New function.
4108         (Output_section::add_output_section_data): Edit FIXME.
4109         * output.h
4110         (Output_section_data_build::Output_section_data_build): New
4111         constructor with size parameter.
4112         (Output_data_space::Output_data_space): Likewise.
4113         (Output_data_got::Output_data_got): Initialize new data member; new
4114         constructor with size parameter.
4115         (Output_data_got::add_constant): Call add_got_entry.
4116         (Output_data_got::reserve_slot): New function.
4117         (Output_data_got::reserve_slot_for_global): New function.
4118         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4119         (Output_data_got::add_got_entry): New function.
4120         (Output_data_got::add_got_entry_pair): New function.
4121         (Output_data_got::free_list_): New data member.
4122         * target.h (Sized_target::init_got_plt_for_update): New function.
4123         (Sized_target::register_global_plt_entry): New function.
4124         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4125         Initialize new data member; call init; add constructor with PLT count.
4126         (Output_data_plt_x86_64::init): New function.
4127         (Output_data_plt_x86_64::add_relocation): New function.
4128         (Output_data_plt_x86_64::reserve_slot): New function.
4129         (Output_data_plt_x86_64::free_list_): New data member.
4130         (Target_x86_64::init_got_plt_for_update): New function.
4131         (Target_x86_64::register_global_plt_entry): New function.
4132         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4133         incremental updates.
4134         (Output_data_plt_x86_64::add_relocation): New function.
4135         * testsuite/object_unittest.cc (Object_test): Set default options.
4136
4137 2011-05-16  Ian Lance Taylor  <iant@google.com>
4138
4139         * options.h (class General_options): Make -i a synonym for -r.
4140
4141 2011-05-16  Ian Lance Taylor  <iant@google.com>
4142
4143         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4144
4145 2011-05-10 Cary Coutant  <ccoutant@google.com>
4146
4147         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4148         strip_all (-s).
4149
4150 2011-05-06  Ian Lance Taylor  <iant@google.com>
4151
4152         * layout.cc (Layout::layout): If the output section flags change,
4153         update the ordering.
4154
4155 2011-04-25 Cary Coutant  <ccoutant@google.com>
4156
4157         * incremental-dump.cc (dump_incremental_inputs): Print local
4158         symbol info for each input file.
4159         * incremental.cc
4160         (Output_section_incremental_inputs::set_final_data_size): Add local
4161         symbol info to input file entries in incremental info.
4162         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4163         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4164         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4165         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4166         implementation.
4167         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4168         (Sized_incr_relobj::do_relocate): Write the local symbols.
4169         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4170         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4171         Adjust size of input file header.
4172         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4173         (Incremental_inputs_reader::get_local_symbol_count): New function.
4174         (Incremental_inputs_reader::get_input_section): Adjust size of input
4175         file header.
4176         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4177         (Sized_incr_relobj::This): New typedef.
4178         (Sized_incr_relobj::sym_size): New const data member.
4179         (Sized_incr_relobj::Local_symbol): New struct.
4180         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4181         (Sized_incr_relobj::do_local_symbol_offset): New function.
4182         (Sized_incr_relobj::local_symbol_count_): New data member.
4183         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4184         (Sized_incr_relobj::local_symbol_index_): New data member.
4185         (Sized_incr_relobj::local_symbol_offset_): New data member.
4186         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4187         (Sized_incr_relobj::local_symbols_): New data member.
4188         * object.h (Relobj::output_local_symbol_count): New function.
4189         (Relobj::local_symbol_offset): New function.
4190         (Relobj::do_output_local_symbol_count): New function.
4191         (Relobj::do_local_symbol_offset): New function.
4192         (Sized_relobj::do_output_local_symbol_count): New function.
4193         (Sized_relobj::do_local_symbol_offset): New function.
4194
4195 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4196
4197         * descriptors.cc (set_close_on_exec): New function.
4198         (Descriptors::open): Use set_close_on_exec.
4199         * output.cc (S_ISLNK): Define if not defined.
4200
4201 2011-04-22 Cary Coutant  <ccoutant@google.com>
4202
4203         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4204         global symbol map.
4205         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4206         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4207         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4208         relocations.
4209         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4210         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4211         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4212         * incremental.h
4213         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4214         function.
4215         (Incremental_binary::apply_incremental_relocs): New function.
4216         (Incremental_binary::do_apply_incremental_relocs): New function.
4217         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4218         data member.
4219         (Sized_incremental_binary::add_global_symbol): New function.
4220         (Sized_incremental_binary::global_symbol): New function.
4221         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4222         (Sized_incremental_binary::symbol_map_): New data member.
4223         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4224         * target.h (Sized_target::apply_relocation): New function.
4225         * target-reloc.h (apply_relocation): New function.
4226         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4227
4228 2011-04-22  Doug Kwan  <dougkwan@google.com>
4229
4230         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4231         flag of a SHT_ARM_EXIDX section.
4232         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4233         * testsuite/Makefile.in: Regenerate.
4234         * testsuite/arm_exidx_test.s: New file.
4235         * testsuite/arm_exidx_test.sh: Same.
4236
4237 2011-04-20 Cary Coutant  <ccoutant@google.com>
4238
4239         PR gold/12689
4240         * archive.h (Incremental_archive_entry::Archive_member):
4241         Initialize arg_serial_ (second constructor).
4242
4243 2011-04-17  Ian Lance Taylor  <iant@google.com>
4244
4245         * object.cc (Relocate_info::location): Simplify location string.
4246         * errors.cc (Errors::error_at_location): Don't print program
4247         name.
4248         (Errors::warning_at_location): Likewise.
4249         (Errors::undefined_symbol): Likewise.
4250         * testsuite/debug_msg.sh: Update accordingly.
4251
4252 2011-04-14 Cary Coutant  <ccoutant@google.com>
4253
4254         * gold/layout.cc (Layout::symtab_section_offset): New function.
4255         * gold/layout.h (Layout::symtab_section_offset): New function.
4256         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4257
4258 2011-04-12  Ian Lance Taylor  <iant@google.com>
4259
4260         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4261         with MREMAP_MAYMOVE.
4262         * output.h (class Output_file): Add map_is_allocated_ field.
4263         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4264         not available, provide stubs.  If mremap is not available, #define
4265         it to gold_mremap.
4266         (MREMAP_MAYMOVE): Define if not defined.
4267         (Output_file::Output_file): Initialize map_is_allocated_.
4268         (Output_file::resize): Check map_is_allocated_.
4269         (Output_file::map_anonymous): If mmap fails, use malloc.
4270         (Output_file::unmap): Don't do anything for an anonymous map.
4271         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4272         is not available, provide stubs.
4273         (File_read::View::~View): Use free rather than delete[].
4274         (File_read::make_view): Use malloc rather than new[].  If mmap
4275         fails, use malloc.
4276         (File_read::find_or_make_view): Use malloc rather than new[].
4277         * gold.h: Remove HAVE_REMAP code.
4278         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4279         exists.  Rename mremap to gold_mremap.  If mmap is not available
4280         don't do anything.
4281         * configure, config.in: Rebuild.
4282
4283 2011-04-11  Ian Lance Taylor  <iant@google.com>
4284
4285         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4286         initialize local variable v.
4287
4288 2011-04-11  Cary Coutant  <ccoutant@google.com>
4289
4290         * archive.cc (Archive::include_member): Adjust call to
4291         report_object.
4292         (Add_archive_symbols::run): Track argument serial numbers.
4293         (Lib_group::include_member): Likewise.
4294         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4295         * archive.h (Incremental_archive_entry::Archive_member):
4296         Initialize arg_serial_.
4297         (Archive_member::arg_serial_): New data member.
4298         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4299         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4300         incremental link.
4301         (Sized_dynobj::do_for_all_local_got_entries): New function.
4302         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4303         function.
4304         * fileread.cc (get_mtime): New function.
4305         * fileread.h (get_mtime): New function.
4306         * gold.cc (queue_initial_tasks): Check for incremental update.
4307         (process_incremental_input): New function.
4308         (queue_middle_tasks): Don't force valid target for incremental
4309         update.
4310         * incremental-dump.cc (find_input_containing_global): Adjust
4311         size of symbol info entry.
4312         (dump_incremental_inputs): Dump argument serial number and
4313         in_system_directory flag; bias shndx by 1; print symbol names
4314         when dumping per-file symbol lists; use new symbol info readers.
4315         * incremental.cc
4316         (Output_section_incremental_inputs:update_data_size): New function.
4317         (Sized_incremental_binary::setup_readers): Setup input readers
4318         for each input file; build maps for files added from libraries
4319         and scripts.
4320         (Sized_incremental_binary::check_input_args): New function.
4321         (Sized_incremental_binary::do_check_inputs): Build map of argument
4322         serial numbers to input arguments.
4323         (Sized_incremental_binary::do_file_has_changed): Rename
4324         do_file_is_unchanged to this; compare file modification times.
4325         (Sized_incremental_binary::do_init_layout): New function.
4326         (Sized_incremental_binary::do_reserve_layout): New function.
4327         (Sized_incremental_binary::do_get_input_reader): Remove.
4328         (Sized_incremental_binary::get_symtab_view): New function.
4329         (Incremental_checker::can_incrementally_link_output_file): Remove.
4330         (Incremental_inputs::report_command_line): Exclude --debug options.
4331         (Incremental_inputs::report_archive_begin): Add parameter; track
4332         argument serial numbers; don't put input file entry for archive
4333         before archive members.
4334         (Incremental_inputs::report_archive_end): Put input file entry
4335         for archive after archive members.
4336         (Incremental_inputs::report_object): Add parameter; track argument
4337         serial numbers and in_system_directory flag.
4338         (Incremental_inputs::report_script): Add parameter; track argument
4339         serial numbers.
4340         (Output_section_incremental_inputs::set_final_data_size): Adjust
4341         size of symbol info entry; check for forwarding symbols.
4342         (Output_section_incremental_inputs::write_input_files): Write
4343         in_system_directory flag and argument serial number.
4344         (Output_section_incremental_inputs::write_info_blocks): Map section
4345         indices between incremental info and original input file; store
4346         input section index for each symbol.
4347         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4348         change operator() to visit().
4349         (class Global_got_offset_visitor): Likewise.
4350         (class Global_symbol_visitor_got_plt):
4351         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4352         classes.
4353         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4354         (Sized_incr_relobj::do_read_symbols): New function.
4355         (Sized_incr_relobj::do_layout): New function.
4356         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4357         (Sized_incr_relobj::do_add_symbols): New function.
4358         (Sized_incr_relobj::do_should_include_member): New function.
4359         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4360         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4361         (Sized_incr_relobj::do_section_size): New function.
4362         (Sized_incr_relobj::do_section_name): New function.
4363         (Sized_incr_relobj::do_section_contents): New function.
4364         (Sized_incr_relobj::do_section_flags): New function.
4365         (Sized_incr_relobj::do_section_entsize): New function.
4366         (Sized_incr_relobj::do_section_address): New function.
4367         (Sized_incr_relobj::do_section_type): New function.
4368         (Sized_incr_relobj::do_section_link): New function.
4369         (Sized_incr_relobj::do_section_info): New function.
4370         (Sized_incr_relobj::do_section_addralign): New function.
4371         (Sized_incr_relobj::do_initialize_xindex): New function.
4372         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4373         (Sized_incr_relobj::do_read_relocs): New function.
4374         (Sized_incr_relobj::do_gc_process_relocs): New function.
4375         (Sized_incr_relobj::do_scan_relocs): New function.
4376         (Sized_incr_relobj::do_count_local_symbols): New function.
4377         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4378         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4379         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4380         (Sized_incr_relobj::do_relocate): New function.
4381         (Sized_incr_relobj::do_set_section_offset): New function.
4382         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4383         (Sized_incr_dynobj::do_read_symbols): New function.
4384         (Sized_incr_dynobj::do_layout): New function.
4385         (Sized_incr_dynobj::do_add_symbols): New function.
4386         (Sized_incr_dynobj::do_should_include_member): New function.
4387         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4388         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4389         (Sized_incr_dynobj::do_section_size): New function.
4390         (Sized_incr_dynobj::do_section_name): New function.
4391         (Sized_incr_dynobj::do_section_contents): New function.
4392         (Sized_incr_dynobj::do_section_flags): New function.
4393         (Sized_incr_dynobj::do_section_entsize): New function.
4394         (Sized_incr_dynobj::do_section_address): New function.
4395         (Sized_incr_dynobj::do_section_type): New function.
4396         (Sized_incr_dynobj::do_section_link): New function.
4397         (Sized_incr_dynobj::do_section_info): New function.
4398         (Sized_incr_dynobj::do_section_addralign): New function.
4399         (Sized_incr_dynobj::do_initialize_xindex): New function.
4400         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4401         (make_sized_incremental_object): New function.
4402         (Incremental_library::copy_unused_symbols): New function.
4403         (Incremental_library::do_for_all_unused_symbols): New function.
4404         * incremental.h (enum Incremental_input_flags): New type.
4405         (class Incremental_checker): Remove.
4406         (Incremental_input_entry::Incremental_input_entry): Add argument
4407         serial number.
4408         (Incremental_input_entry::arg_serial): New function.
4409         (Incremental_input_entry::set_is_in_system_directory): New function.
4410         (Incremental_input_entry::is_in_system_directory): New function.
4411         (Incremental_input_entry::arg_serial_): New data member.
4412         (Incremental_input_entry::is_in_system_directory_): New data member.
4413         (class Script_info): Move here from script.h.
4414         (Script_info::Script_info): Add filename parameter.
4415         (Script_info::filename): New function.
4416         (Script_info::filename_): New data member.
4417         (Incremental_script_entry::Incremental_script_entry): Add argument
4418         serial number.
4419         (Incremental_object_entry::Incremental_object_entry): Likewise.
4420         (Incremental_object_entry::add_input_section): Build list of input
4421         sections with map to original shndx.
4422         (Incremental_object_entry::get_input_section_index): New function.
4423         (Incremental_object_entry::shndx_): New data member.
4424         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4425         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4426         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4427         serial number.
4428         (Incremental_inputs::report_archive_begin): Likewise.
4429         (Incremental_inputs::report_object): Likewise.
4430         (Incremental_inputs::report_script): Likewise.
4431         (class Incremental_global_symbol_reader): New class.
4432         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4433         and store flags and input file type.
4434         (Incremental_input_entry_reader::arg_serial): New function.
4435         (Incremental_input_entry_reader::type): Extract type from flags.
4436         (Incremental_input_entry_reader::is_in_system_directory): New function.
4437         (Incremental_input_entry_reader::get_input_section_count): Call
4438         accessor function for type.
4439         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4440         function for type; adjust size of global symbol entry.
4441         (Incremental_input_entry_reader::get_global_symbol_count): Call
4442         accessor function for type.
4443         (Incremental_input_entry_reader::get_object_count): Likewise.
4444         (Incremental_input_entry_reader::get_object_offset): Likewise.
4445         (Incremental_input_entry_reader::get_member_count): Likewise.
4446         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4447         (Incremental_input_entry_reader::get_member_offset): Likewise.
4448         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4449         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4450         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4451         (Incremental_input_entry_reader::get_global_symbol_reader): New
4452         function.
4453         (Incremental_input_entry_reader::get_output_symbol_index): New
4454         function.
4455         (Incremental_input_entry_reader::type_): Remove.
4456         (Incremental_input_entry_reader::flags_): New data member.
4457         (Incremental_inputs_reader::input_file_offset): New function.
4458         (Incremental_inputs_reader::input_file_index): New function.
4459         (Incremental_inputs_reader::input_file): Call input_file_offset.
4460         (Incremental_inputs_reader::input_file_at_offset): New function.
4461         (Incremental_relocs_reader::get_r_type): Reformat.
4462         (Incremental_relocs_reader::get_r_shndx): Reformat.
4463         (Incremental_relocs_reader::get_r_offset): Reformat.
4464         (Incremental_relocs_reader::data): New function.
4465         (Incremental_binary::Incremental_binary): Initialize new data members.
4466         (Incremental_binary::check_inputs): Add cmdline parameter.
4467         (Incremental_binary::file_is_unchanged): Remove.
4468         (Input_reader::arg_serial): New function.
4469         (Input_reader::get_unused_symbol_count): New function.
4470         (Input_reader::get_unused_symbol): New function.
4471         (Input_reader::do_arg_serial): New function.
4472         (Input_reader::do_get_unused_symbol_count): New function.
4473         (Input_reader::do_get_unused_symbol): New function.
4474         (Incremental_binary::input_file_count): New function.
4475         (Incremental_binary::get_input_reader): Change signature to use
4476         index instead of filename.
4477         (Incremental_binary::file_has_changed): New function.
4478         (Incremental_binary::get_input_argument): New function.
4479         (Incremental_binary::get_library): New function.
4480         (Incremental_binary::get_script_info): New function.
4481         (Incremental_binary::init_layout): New function.
4482         (Incremental_binary::reserve_layout): New function.
4483         (Incremental_binary::output_file): New function.
4484         (Incremental_binary::do_check_inputs): New function.
4485         (Incremental_binary::do_file_is_unchanged): Remove.
4486         (Incremental_binary::do_file_has_changed): New function.
4487         (Incremental_binary::do_init_layout): New function.
4488         (Incremental_binary::do_reserve_layout): New function.
4489         (Incremental_binary::do_input_file_count): New function.
4490         (Incremental_binary::do_get_input_reader): Change signature.
4491         (Incremental_binary::input_args_map_): New data member.
4492         (Incremental_binary::library_map_): New data member.
4493         (Incremental_binary::script_map_): New data member.
4494         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4495         new data members.
4496         (Sized_incremental_binary::output_section): New function.
4497         (Sized_incremental_binary::inputs_reader): Add const.
4498         (Sized_incremental_binary::symtab_reader): Add const.
4499         (Sized_incremental_binary::relocs_reader): Add const.
4500         (Sized_incremental_binary::got_plt_reader): Add const.
4501         (Sized_incremental_binary::get_symtab_view): New function.
4502         (Sized_incremental_binary::Inputs_reader): New typedef.
4503         (Sized_incremental_binary::Input_entry_reader): New typedef.
4504         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4505         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4506         (Sized_incremental_binary::do_file_has_changed): New function.
4507         (Sized_incremental_binary::do_init_layout): New function.
4508         (Sized_incremental_binary::do_reserve_layout): New function.
4509         (Sized_input_reader::Inputs_reader): Remove.
4510         (Sized_input_reader::Input_entry_reader): Remove.
4511         (Sized_input_reader::do_arg_serial): New function.
4512         (Sized_input_reader::do_get_unused_symbol_count): New function.
4513         (Sized_input_reader::do_get_unused_symbol): New function.
4514         (Sized_incremental_binary::do_input_file_count): New function.
4515         (Sized_incremental_binary::do_get_input_reader): Change signature;
4516         use index instead of filename.
4517         (Sized_incremental_binary::section_map_): New data member.
4518         (Sized_incremental_binary::input_entry_readers_): New data member.
4519         (class Sized_incr_relobj): New class.
4520         (class Sized_incr_dynobj): New class.
4521         (make_sized_incremental_object): New function.
4522         (class Incremental_library): New class.
4523         * layout.cc (Free_list::num_lists): New static data member.
4524         (Free_list::num_nodes): New static data member.
4525         (Free_list::num_removes): New static data member.
4526         (Free_list::num_remove_visits): New static data member.
4527         (Free_list::num_allocates): New static data member.
4528         (Free_list::num_allocate_visits): New static data member.
4529         (Free_list::init): New function.
4530         (Free_list::remove): New function.
4531         (Free_list::allocate): New function.
4532         (Free_list::dump): New function.
4533         (Free_list::print_stats): New function.
4534         (Layout_task_runner::run): Resize output file for incremental updates.
4535         (Layout::Layout): Initialize new data members.
4536         (Layout::set_incremental_base): New function.
4537         (Layout::init_fixed_output_section): New function.
4538         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4539         incremental updates.
4540         (Layout::create_gold_note): Do not create gold note section for
4541         incremental updates.
4542         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4543         for incremental updates.
4544         (Layout::set_section_offsets): For incremental updates, allocate space
4545         from free list.
4546         (Layout::create_symtab_sections): Layout with offsets relative to
4547         start of section; for incremental updates, allocate space from free
4548         list.
4549         (Layout::create_shdrs): For incremental updates, allocate space from
4550         free list.
4551         (Layout::finish_dynamic_section): For incremental updates, do not
4552         check --as-needed (fixed in subsequent patch).
4553         * layout.h (class Free_list): New class.
4554         (Layout::set_incremental_base): New function.
4555         (Layout::incremental_base): New function.
4556         (Layout::init_fixed_output_section): New function.
4557         (Layout::allocate): New function.
4558         (Layout::incremental_base_): New data member.
4559         (Layout::free_list_): New data member.
4560         * main.cc (main): Print Free_list statistics.
4561         * object.cc (Relobj::finalize_incremental_relocs): Add
4562         clear_counts parameter; clear counts only when clear_counts is set.
4563         (Sized_relobj::Sized_relobj): Initialize new base class.
4564         (Sized_relobj::do_layout): Don't report special sections.
4565         (Sized_relobj::do_for_all_local_got_entries): New function.
4566         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4567         symtab_off to all symbol table offsets.
4568         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4569         * object.h (class Got_offset_list): Move to top of file.
4570         (Object::Object): Allow case where input_file == NULL.
4571         (Object::~Object): Likewise.
4572         (Object::input_file): Assert that input_file != NULL.
4573         (Object::lock): Allow case where input_file == NULL.
4574         (Object::unlock): Likewise.
4575         (Object::is_locked): Likewise.
4576         (Object::token): Likewise.
4577         (Object::release): Likewise.
4578         (Object::is_incremental): New function.
4579         (Object::get_mtime): New function.
4580         (Object::for_all_local_got_entries): New function.
4581         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4582         (Object::set_is_in_system_directory): New function.
4583         (Object::is_in_system_directory): New function.
4584         (Object::do_is_incremental): New function.
4585         (Object::do_get_mtime): New function.
4586         (Object::do_for_all_local_got_entries): New function.
4587         (Object::is_in_system_directory_): New data member.
4588         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4589         (class Sized_relobj_base): New class.
4590         (class Sized_relobj): Derive from Sized_relobj_base.
4591         (class Sized_relobj::Symbols): Redeclare from base class.
4592         (class Sized_relobj::local_got_offset_list): Remove.
4593         (class Sized_relobj::Output_sections): Redeclare from base class.
4594         (class Sized_relobj::do_for_all_local_got_entries): New function.
4595         (class Sized_relobj::write_local_symbols): Add offset parameter.
4596         (class Sized_relobj::local_symbol_offset_): Update comment.
4597         (class Sized_relobj::local_dynsym_offset_): Update comment.
4598         * options.cc (Input_arguments::add_file): Remove const.
4599         * options.h (Input_file_argument::Input_file_argument):
4600         Initialize arg_serial_ (all constructors).
4601         (Input_file_argument::set_arg_serial): New function.
4602         (Input_file_argument::arg_serial): New function.
4603         (Input_file_argument::arg_serial_): New data member.
4604         (Input_arguments::Input_arguments): Initialize file_count_.
4605         (Input_arguments::add_file): Remove const.
4606         (Input_arguments::number_of_input_files): New function.
4607         (Input_arguments::file_count_): New data member.
4608         (Command_line::number_of_input_files): Call
4609         Input_arguments::number_of_input_files.
4610         * output.cc (Output_segment_headers::Output_segment_headers):
4611         Set current size.
4612         (Output_section::Input_section::current_data_size): New function.
4613         (Output_section::Output_section): Initialize new data members.
4614         (Output_section::add_input_section): Don't do merge sections for
4615         an incremental link; allocate space from free list for an
4616         incremental update.
4617         (Output_section::add_output_section_data): Allocate space from
4618         free list for an incremental update.
4619         (Output_section::update_data_size): New function.
4620         (Output_section::set_fixed_layout): New function.
4621         (Output_section::reserve): New function.
4622         (Output_segment::set_section_addresses): Remove const.
4623         (Output_segment::set_section_list_addresses): Remove const; allocate
4624         space from free list for an incremental update.
4625         (Output_segment::set_offset): Adjust size of RELRO segment for an
4626         incremental update.
4627         * output.h (Output_data::current_data_size): Move here from
4628         child classes.
4629         (Output_data::pre_finalize_data_size): New function.
4630         (Output_data::update_data_size): New function.
4631         (Output_section_headers::update_data_size): new function.
4632         (Output_section_data_build::current_data_size): Move to Output_data.
4633         (Output_data_strtab::update_data_size): New function.
4634         (Output_section::current_data_size): Move to Output_data.
4635         (Output_section::set_fixed_layout): New function.
4636         (Output_section::has_fixed_layout): New function.
4637         (Output_section::reserve): New function.
4638         (Output_section::update_data_size): New function.
4639         (Output_section::has_fixed_layout_): New data member.
4640         (Output_section::free_list_): New data member.
4641         (Output_segment::set_section_addresses): Remove const.
4642         (Output_segment::set_section_list_addresses): Remove const.
4643         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4644         New function.
4645         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4646         New function.
4647         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4648         parameter when calling Add_symbols constructor; store argument
4649         serial number for members of a lib group.
4650         (Add_symbols::locks): Allow case where token == NULL.
4651         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4652         (Read_member::~Read_member): New function.
4653         (Read_member::is_runnable): New function.
4654         (Read_member::locks): New function.
4655         (Read_member::run): New function.
4656         (Check_script::~Check_script): New function.
4657         (Check_script::is_runnable): New function.
4658         (Check_script::locks): New function.
4659         (Check_script::run): New function.
4660         (Check_library::~Check_library): New function.
4661         (Check_library::is_runnable): New function.
4662         (Check_library::locks): New function.
4663         (Check_library::run): New function.
4664         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4665         (Add_symbols::library_): New data member.
4666         (class Read_member): New class.
4667         (class Check_script): New class.
4668         (class Check_library): New class.
4669         * reloc.cc (Read_relocs::is_runnable): Allow case where
4670         token == NULL.
4671         (Read_relocs::locks): Likewise.
4672         (Scan_relocs::locks): Likewise.
4673         (Relocate_task::locks): Likewise.
4674         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4675         to clear counters.
4676         (Sized_relobj::incremental_relocs_scan): Fix comment.
4677         (Sized_relobj::do_relocate): Pass output file offset to
4678         write_local_symbols.
4679         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4680         from class declaration.
4681         * script.cc (read_input_script): Allocate Script_info; pass
4682         argument serial number to report_script.
4683         * script.h (class Script_info): Move to incremental.h.
4684         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4685         * symtab.h (Symbol_table::add_from_incrobj): New function.
4686         (Symbol_table::set_file_offset): New function.
4687
4688 2011-04-05  Cary Coutant  <ccoutant@google.com>
4689
4690         * incremental-dump.cc (dump_incremental_inputs): Change signature
4691         to take a Sized_incremental_binary; change caller.  Use readers
4692         in Sized_incremental_binary.
4693         * incremental.cc
4694         (Sized_incremental_binary::find_incremental_inputs_sections):
4695         Rename do_find_incremental_inputs_sections to this.
4696         (Sized_incremental_binary::setup_readers): New function.
4697         (Sized_incremental_binary::do_check_inputs): Check
4698         has_incremental_info_ flag; move setup code to setup_readers;
4699         use input readers.
4700         (Sized_incremental_binary::do_file_is_unchanged): New function.
4701         (Sized_incremental_binary::do_get_input_reader): New function.
4702         * incremental.h (class Incremental_binary): Move to end of file.
4703         (Incremental_binary::file_is_unchanged): New function.
4704         (Incremental_binary::do_file_is_unchanged): New function.
4705         (Incremental_binary::Input_reader): New class.
4706         (Incremental_binary::get_input_reader): New function.
4707         (class Sized_incremental_binary): Move to end of file.
4708         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4709         input section reader classes.
4710         (Sized_incremental_binary::has_incremental_info): New function.
4711         (Sized_incremental_binary::inputs_reader): New function.
4712         (Sized_incremental_binary::symtab_reader): New function.
4713         (Sized_incremental_binary::relocs_reader): New function.
4714         (Sized_incremental_binary::got_plt_reader): New function.
4715         (Sized_incremental_binary::do_file_is_unchanged): New function.
4716         (Sized_incremental_binary::Sized_input_reader): New class.
4717         (Sized_incremental_binary::get_input_reader): New function.
4718         (Sized_incremental_binary::find_incremental_inputs_sections):
4719         Rename do_find_incremental_inputs_sections to this.
4720         (Sized_incremental_binary::setup_readers): New function.
4721         (Sized_incremental_binary::has_incremental_info_): New data member.
4722         (Sized_incremental_binary::inputs_reader_): New data member.
4723         (Sized_incremental_binary::symtab_reader_): New data member.
4724         (Sized_incremental_binary::relocs_reader_): New data member.
4725         (Sized_incremental_binary::got_plt_reader_): New data member.
4726         (Sized_incremental_binary::current_input_file_): New data member.
4727
4728 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4729
4730         PR gold/12640
4731         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4732         violation.
4733
4734 2011-03-30  Cary Coutant  <ccoutant@google.com>
4735
4736         * archive.cc (Archive::include_member): Adjust call to report_object.
4737         (Add_archive_symbols::run): Add script_info to call to
4738         report_archive_begin.
4739         (Lib_group::include_member): Adjust call to report_object.
4740         (Add_lib_group_symbols::run): Adjust call to report_object.
4741         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4742         blocks.  Add object count for script input files.
4743         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4744         script_info parameter; change all callers.
4745         (Incremental_inputs::report_object): Add script_info parameter;
4746         change all callers.
4747         (Incremental_inputs::report_script): Store backpointer to
4748         incremental info entry.
4749         (Output_section_incremental_inputs::set_final_data_size): Record
4750         additional information for scripts.
4751         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4752         * incremental.h (Incremental_script_entry::add_object): New function.
4753         (Incremental_script_entry::get_object_count): New function.
4754         (Incremental_script_entry::get_object): New function.
4755         (Incremental_script_entry::objects_): New data member; adjust
4756         constructor.
4757         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4758         (Incremental_inputs::report_object): Add script_info parameter.
4759         (Incremental_inputs_reader::get_object_count): New function.
4760         (Incremental_inputs_reader::get_object_offset): New function.
4761         * options.cc (Input_arguments::add_file): Return reference to
4762         new input argument.
4763         * options.h (Input_argument::set_script_info): New function.
4764         (Input_argument::script_info): New function.
4765         (Input_argument::script_info_): New data member; adjust all
4766         constructors.
4767         (Input_file_group::add_file): Return reference to new input argument.
4768         (Input_file_lib::add_file): Likewise.
4769         (Input_arguments::add_file): Likewise.
4770         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4771         * script.cc (Parser_closure::Parser_closure): Add script_info
4772         parameter; adjust all callers.
4773         (Parser_closure::script_info): New function.
4774         (Parser_closure::script_info_): New data member.
4775         (read_input_script): Report scripts earlier to incremental info.
4776         (script_add_file): Set script_info in Input_argument.
4777         (script_add_library): Likewise.
4778         * script.h (Script_options::Script_info): Rewrite class.
4779
4780 2011-03-29  Cary Coutant  <ccoutant@google.com>
4781
4782         * archive.cc (Library_base::should_include_member): Move
4783         method here from class Archive.
4784         (Archive::Archive): Initialize base class.
4785         (Archive::should_include_member): Move to base class.
4786         (Archive::do_for_all_unused_symbols): New function.
4787         (Add_archive_symbols::run): Remove redundant access to
4788         incremental_inputs.
4789         (Lib_group::Lib_group): Initialize base class.
4790         (Lib_group::do_filename): New function.
4791         (Lib_group::include_member): Pass pointer to Lib_group to
4792         report_object.
4793         (Lib_group::do_for_all_unused_symbols): New function.
4794         (Add_lib_group_symbols::run): Report archive information for
4795         incremental links.
4796         * archive.h (class Library_base): New base class.
4797         (class Archive): Derive from Library_base.
4798         (Archive::filename): Move to base class.
4799         (Archive::set_incremental_info): Likewise.
4800         (Archive::incremental_info): Likewise.
4801         (Archive::Should_include): Likewise.
4802         (Archive::should_include_member): Likewise.
4803         (Archive::Armap_entry): Remove.
4804         (Archive::Unused_symbol_iterator): Remove.
4805         (Archive::unused_symbols_begin): Remove.
4806         (Archive::unused_symbols_end): Remove.
4807         (Archive::do_filename): New function.
4808         (Archive::do_get_mtime): New function.
4809         (Archive::do_for_all_unused_symbols): New function.
4810         (Archive::task_): Move to base class.
4811         (Archive::incremental_info_): Likewise.
4812         (class Lib_group): Derive from Library_base.
4813         (Lib_group::do_filename): New function.
4814         (Lib_group::do_get_mtime): New function.
4815         (Lib_group::do_for_all_unused_symbols): New function.
4816         (Lib_group::task_): Move to base class.
4817         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4818         function.
4819         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4820         function.
4821         * incremental.cc (Incremental_inputs::report_archive_begin):
4822         Use Library_base; call library's get_mtime; add incremental inputs
4823         entry before members.
4824         (class Unused_symbol_visitor): New class.
4825         (Incremental_inputs::report_archive_end): Use Library_base; use
4826         visitor class to record unused symbols; don't add incremental inputs
4827         entry after members.
4828         (Incremental_inputs::report_object): Use Library_base.
4829         * incremental.h
4830         (Incremental_archive_entry::Incremental_archive_entry): Remove
4831         unused Archive parameter.
4832         (Incremental_inputs::report_archive_begin): Use Library_base.
4833         (Incremental_inputs::report_archive_end): Likewise.
4834         (Incremental_inputs::report_object): Likewise.
4835         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4836         function.
4837         * object.h (Object::for_all_global_symbols): New function.
4838         (Object::do_for_all_global_symbols): New function.
4839         (Sized_relobj::do_for_all_global_symbols): New function.
4840         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4841         function.
4842         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4843         function.
4844
4845 2011-03-27  Ian Lance Taylor  <iant@google.com>
4846
4847         * archive.cc (Archive::interpret_header): Return -1 if something
4848         goes wrong.  Change callers accordingly.
4849
4850 2011-03-25  Cary Coutant  <ccoutant@google.com>
4851
4852         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4853         * testsuite/Makefile.in: Regenerate.
4854
4855 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4856
4857         * plugin.cc (get_view): New.
4858         (Plugin::load): Pass get_view to the plugin.
4859         (Plugin_manager::get_view): New.
4860
4861 2011-03-21  Ian Lance Taylor  <iant@google.com>
4862
4863         * testsuite/final_layout.sh: Rewrite to not use dc.
4864         * testsuite/relro_test.sh: Fail if dc is not present.
4865
4866 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4867
4868         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4869         Change == to -eq.
4870         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4871         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4872         Change == to -eq.
4873         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4874         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4875
4876 2011-03-14  Ian Lance Taylor  <iant@google.com>
4877
4878         * script-sections.cc (Sort_output_sections::script_compare):
4879         Rename from is_before, change return type.
4880         (Sort_output_sections::operator()): Adjust accordingly.
4881
4882 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4883
4884         PR gold/12572
4885         * testsuite/odr_violation2.cc: Add comment to make all error line
4886         numbers double digits.
4887         * testsuite/debug_msg.sh: Adjust expected errors.
4888
4889 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4890
4891         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4892         but mark earlier ones as non-canonical
4893         (offset_to_iterator): Update search target and example
4894         (do_addr2line): Return extra lines in a vector*
4895         (format_file_lineno): Extract from do_addr2line
4896         (one_addr2line): Add vector* out-param
4897         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4898         when a lineno entry appeared last for its instruction
4899         (Dwarf_line_info): Add vector* out-param
4900         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4901         * symtab.cc (Odr_violation_compare): Include the lineno in the
4902         comparison again.
4903         (linenos_from_loc): New. Combine the canonical line for an
4904         address with its other lines.
4905         (True_if_intersect): New. Helper functor to make
4906         std::set_intersection a query.
4907         (detect_odr_violations): Compare sets of lines instead of just
4908         one line for each function. This became less deterministic, but
4909         has fewer false positives.
4910         * symtab.h: Declarations.
4911         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4912         mix an optimized and non-optimized object in the same binary
4913         (odr_violation2.so): Same.
4914         * testsuite/Makefile.in: Regenerate from Makefile.am.
4915         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4916         * testsuite/debug_msg.sh: Update line numbers and add
4917         assertions.
4918         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4919         non-optimized context.
4920         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4921         isn't inlined, and use OdrDerived in an optimized context.
4922         * testsuite/odr_header1.h: Defines OdrDerived, where
4923         optimization will change the
4924         first-instruction-in-the-destructor's file and line number.
4925         * testsuite/odr_header2.h: Defines OdrBase.
4926
4927 2011-03-09  Ian Lance Taylor  <iant@google.com>
4928
4929         * fileread.cc (File_read::clear_views): Don't delete the whole
4930         file view.
4931
4932 2011-03-08  Ian Lance Taylor  <iant@google.com>
4933
4934         PR gold/12525
4935         * fileread.cc: #include <climits>.
4936         (GOLD_IOV_MAX): Define.
4937         (File_read::read_multiple): Limit number of entries by iov_max.
4938         * fileread.h (class File_read): Always set max_readv_entries to
4939         128.
4940
4941 2011-03-07  Ian Lance Taylor  <iant@google.com>
4942
4943         PR gold/12525
4944         * options.h (class General_options): Add -dy and -dn.
4945
4946 2011-03-02  Cary Coutant  <ccoutant@google.com>
4947
4948         * testsuite/script_test_9.t: Add TLS segment.
4949
4950 2011-03-02  Simon Baldwin  <simonb@google.com>
4951
4952         * configure.ac: Add check for gnu_indirect_function support in
4953         the toolchain building binutils.
4954         * configure: Rebuild.
4955
4956 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4957
4958         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4959         plugin only symbols.
4960         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4961         in plugin files as not needed in the symbol table.
4962
4963 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4964
4965         * output.cc (Output_section::add_input_section): Delay fill
4966         generation for section ordering.
4967
4968 2011-02-09  Ian Lance Taylor  <iant@google.com>
4969
4970         PR gold/12316
4971         * object.h (class Sized_relobj): Remove clear_local_symbols.
4972         * reloc.cc (Sized_relobj::do_relocate): Don't call
4973         clear_local_symbols.
4974
4975 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4976
4977         * plugin.cc (is_visible_from_outside): Return true for symbols
4978         in the -u option.
4979
4980 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4981
4982         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4983         filename.
4984
4985 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4986
4987         * icf.h (is_section_foldable_candidate): Change type of parameter
4988         to std::string.
4989         * icf.cc (Icf::find_identical_sections): Change type of local variable
4990         section_name to be std::string.
4991         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4992
4993 2011-01-25  Ian Lance Taylor  <iant@google.com>
4994
4995         * script.cc (script_add_extern): Rewrite to use
4996         add_symbol_reference.
4997
4998 2011-01-25  Doug Kwan  <dougkwan@google.com>
4999
5000         * icf.cc (get_section_contents): Always lock section's object.
5001
5002 2011-01-24  Ian Lance Taylor  <iant@google.com>
5003
5004         * options.h (class General_options): Accept
5005         --no-detect-odr-violations.
5006
5007 2011-01-24  Ian Lance Taylor  <iant@google.com>
5008
5009         * version.cc (version_string): Bump to 1.11.
5010
5011 2011-01-24  Ian Lance Taylor  <iant@google.com>
5012
5013         * plugin.cc (class Plugin_rescan): Define new class.
5014         (Plugin_manager::claim_file): Set any_claimed_.
5015         (Plugin_manager::save_archive): New function.
5016         (Plugin_manager::save_input_group): New function.
5017         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5018         necessary.
5019         (Plugin_manager::new_undefined_symbol): New function.
5020         (Plugin_manager::rescan): New function.
5021         (Plugin_manager::rescannable_defines): New function.
5022         (Plugin_manager::add_input_file): Set any_added_.
5023         * plugin.h (class Plugin_manager): define new fields rescannable_,
5024         undefined_symbols_, any_claimed_, and any_added_.  Declare
5025         Plugin_rescan as friend.  Declare new functions.
5026         (Plugin_manager::Rescannable): Define type.
5027         (Plugin_manager::Rescannable_list): Define type.
5028         (Plugin_manager::Undefined_symbol_list): Define type.
5029         (Plugin_manager::Plugin_manager): Initialize new fields.
5030         * archive.cc (Archive::defines_symbol): New function.
5031         (Add_archive_symbols::run): Pass archive to plugins if any.
5032         * archive.h (class Archive): Declare defines_symbol.
5033         * readsyms.cc (Input_group::~Input_group): New function.
5034         (Finish_group::run): Pass input_group to plugins if any.
5035         * readsyms.h (class Input_group): Declare destructor.
5036         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5037         any.
5038
5039 2011-01-10  Ian Lance Taylor  <iant@google.com>
5040
5041         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5042         section as relro.
5043         (Layout::set_segment_offsets): Reset increase_relro before calling
5044         set_section_addresses a second time.
5045
5046 2011-01-04  Cary Coutant  <ccoutant@google.com>
5047
5048         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5049         sections before NOBITS sections.
5050
5051 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5052
5053         * version.cc (print_version): Update copyright to 2011.
5054
5055 2010-12-23  Cary Coutant  <ccoutant@google.com>
5056
5057         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5058         of OS to this->add.  Add OD parameter to second form of the function.
5059
5060 2010-12-20  Ian Lance Taylor  <iant@google.com>
5061
5062         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5063         second of two consecutive entries with same offset.
5064
5065 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5066
5067         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5068         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5069         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5070         to avoid unneeded links against $(LDADD).
5071         * testsuite/Makefile.in: Regenerate.
5072
5073 2010-12-15  Ian Lance Taylor  <iant@google.com>
5074
5075         PR gold/12324
5076         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5077         for R_X86_64_32 and R_X86_64_PC32.
5078         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5079         ver_matching_def_pic.o.
5080         (ver_matching_def_pic.o): New target.
5081
5082 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5083
5084         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5085         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5086         Move definition before File_read::View member definitions.
5087         (File_read::View::~View): Initialize and hold lock before
5088         updating current_mapped_bytes.
5089
5090 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5091
5092         * dwarf_reader.cc: Remove outdated comment.
5093         * gold-threads.cc: Fix typo in error message.
5094         * archive.cc: Fix typos in comments.
5095         * archive.h: Likewise.
5096         * arm-reloc-property.cc: Likewise.
5097         * arm-reloc-property.h: Likewise.
5098         * arm-reloc.def: Likewise.
5099         * arm.cc: Likewise.
5100         * attributes.h: Likewise.
5101         * cref.cc: Likewise.
5102         * ehframe.cc: Likewise.
5103         * fileread.h: Likewise.
5104         * gold.h: Likewise.
5105         * i386.cc: Likewise.
5106         * icf.cc: Likewise.
5107         * incremental.h: Likewise.
5108         * int_encoding.cc: Likewise.
5109         * layout.h: Likewise.
5110         * main.cc: Likewise.
5111         * merge.h: Likewise.
5112         * object.cc: Likewise.
5113         * object.h: Likewise.
5114         * options.cc: Likewise.
5115         * readsyms.cc: Likewise.
5116         * reduced_debug_output.cc: Likewise.
5117         * reloc.cc: Likewise.
5118         * script-sections.cc: Likewise.
5119         * sparc.cc: Likewise.
5120         * symtab.h: Likewise.
5121         * target-reloc.h: Likewise.
5122         * target.cc: Likewise.
5123         * target.h: Likewise.
5124         * timer.cc: Likewise.
5125         * timer.h: Likewise.
5126         * x86_64.cc: Likewise.
5127
5128 2010-12-09  Cary Coutant  <ccoutant@google.com>
5129
5130         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5131         stack.
5132         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5133         parameter; change all callers.
5134         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5135         * options.h (warn_execstack): New option.
5136
5137 2010-12-07  Doug Kwan  <dougkwan@google.com>
5138
5139         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5140         like function call relocations.
5141
5142 2010-12-07  Ian Lance Taylor  <iant@google.com>
5143
5144         * archive.cc (Archive::get_elf_object_for_member): Permit
5145         punconfigured to be NULL.
5146         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5147         (Archive::include_member): Pass NULL to get_elf_object_for_member
5148         if we searched for the archive and this is the first included
5149         object.
5150
5151 2010-12-01  Ian Lance Taylor  <iant@google.com>
5152
5153         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5154         track_relocs_type_ field.
5155         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5156         Set track_relocs_type_.
5157         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5158         contents when using RELA relocs.
5159         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5160         reloc_map_.
5161         * reloc.cc (Track_relocs::next_addend): New function.
5162         * reloc.h (class Track_relocs): Declare next_addend.
5163
5164 2010-12-01  Ian Lance Taylor  <iant@google.com>
5165
5166         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5167         virtual destructor.
5168
5169 2010-12-01  Ian Lance Taylor  <iant@google.com>
5170
5171         * README: Update compilers known to work and fail.
5172
5173 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5174
5175         * configure.in: For --enable-gold, handle value `default' instead of
5176         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5177         not the default.
5178         * configure: Regenerate.
5179
5180 2010-11-18  Doug Kwan  <dougkwan@google.com>
5181
5182         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5183         and right_alignment to be zero.  Store result alignment only if it is
5184         greater than existing alignment.
5185
5186 2010-11-16  Cary Coutant  <ccoutant@google.com>
5187
5188         PR gold/12220
5189         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5190         Check for ".zdebug_line".
5191
5192 2010-11-16  Doug Kwan  <dougkwan@google.com>
5193             Cary Coutant  <ccoutant@google.com>
5194
5195         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5196         by reference; adjust all callers.
5197         * output.cc (Output_segment::set_section_addresses): Adjust references
5198         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5199         list is empty.
5200         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5201         end at page boundary.
5202
5203 2010-11-16  Cary Coutant  <ccoutant@google.com>
5204
5205         PR gold/12220
5206         * layout.cc (Layout::choose_output_section): Transform names of
5207         compressed sections even when using a script with a SECTIONS clause.
5208         (Layout::output_section_name): Remove code to transform
5209         compressed debug section names.
5210         * output.cc (Output_section::add_input_section): Use uncompressed
5211         section size when tracking input sections.
5212
5213 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5214
5215         * symtab.h (Symbol::NON_PIC_REF): Remove.
5216         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5217         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5218         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5219         (Symbol::use_plt_offset): Take a flags argument and pass it
5220         directly to needs_dynamic_reloc.  Restrict check for undefined
5221         weak symbols to function calls.
5222         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5223         (Target_arm::Scan::global): Use it.
5224         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5225         (Target_arm::Relocate::relocate): Likewise.
5226         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5227         parameter with an r_type parameter.  Use get_reference_flags
5228         to get the flags.
5229         (Target_arm::Relocate::relocate): Update accordingly.
5230         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5231         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5232         (Target_i386::Scan::global): Likewise.
5233         (Target_i386::Relocate::relocate): Likewise.
5234         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5235         parameter with an r_type parameter.  Use get_reference_flags
5236         to get the flags.
5237         (Target_i386::Relocate::relocate): Update accordingly.
5238         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5239         (Target_powerpc::Scan::global): Use it.
5240         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5241         (Target_powerpc::Relocate::relocate): Likewise.
5242         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5243         (Target_sparc::Scan::global): Use it.
5244         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5245         (Target_sparc::Relocate::relocate): Likewise.
5246         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5247         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5248         (Target_x86_64::Scan::global): Likewise.
5249         (Target_x86_64::Relocate::relocate): Likewise.
5250
5251 2010-11-08  Doug Kwan  <dougkwan@google.com>
5252             Cary Coutant  <ccoutant@google.com>
5253
5254         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5255         (Arm_exidx_merge_section::section_contents_): New data member.
5256         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5257         (Arm_input_section::~Arm_input_section): De-allocate memory.
5258         (Arm_input_section::original_contents_): New data member.
5259         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5260         in parameters instead of calling Object::section_contents without
5261         locking.
5262         (Arm_output_section::group_section): New parameter TASK.  Pass it
5263         to callees that need locking objects.
5264         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5265         to lock EXIDX input sections.  Fix a formatting issue.  Call
5266         Arm_exidx_merged_section::build_contents to create merged section
5267         contents.
5268         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5269         to lock object of stub table owner.
5270         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5271         TEXT_SIZE to initialize data member TEXT_SIZE_.
5272         (Arm_exidx_input_section::addralign): Fix typo in comment.
5273         (Arm_exidx_input_section::text_size): New method.
5274         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5275         that require locking objects.  Lock objects before scanning for stubs
5276         and updating local symbols.
5277         (Arm_input_section<big_endian>::init): Copy contents of original
5278         input section.
5279         (Arm_input_section<big_endian>::do_write): Use saved contents of
5280         original input section instead of calling Object::section_contents
5281         without locking.
5282         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5283         size without calling Object::section_size().
5284         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5285         for size.  Allocate a buffer for merged EXIDX entries.
5286         (Arm_exidx_merged_section::build_contents): New method.
5287         (Arm_exidx_merged_section::do_write): Move merge section contents
5288         building code to Arm_exidx_merged_section::build_contetns.  Write
5289         out contetns in buffer instead of building it on the fly.
5290         (Arm_relobj::make_exidx_input_section): Also pass text section size
5291         to Arm_exidx_input_section constructor.
5292         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5293         (Arm_dynobj::do_read_symbols): Fix memory leak.
5294         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5295         * target.h: (class Task): Add forward declaration.
5296         (Target::relax): Add new parameter TASK and pass it to
5297         Target::do_relax().
5298         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5299
5300 2010-11-05  Cary Coutant  <ccoutant@google.com>
5301
5302         PR gold/10708
5303         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5304         object when reading from the file.
5305         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5306         second layout pass.
5307         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5308         when reading section contents.
5309         (get_section_contents): Likewise.
5310         (icf::find_identical_sections): Likewise.
5311         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5312         object when reading from the file.
5313         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5314         the object when doing deferred section layout.
5315
5316 2010-11-03  Nick Clifton  <nickc@redhat.com>
5317
5318         PR gold/12001
5319         * script.h (class Symbol_assignment: name): New member.  Returns
5320         the name of the symbol.
5321         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5322         Returns true if the given symbol name is on the list of
5323         assignments wating to be processed.
5324         * archive.cc (should_incldue_member): If the symbol is undefined,
5325         check to see if it is on the list of symbols pending assignment.
5326
5327 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5328
5329         * script-sections.cc (Script_sections::find_memory_region): Check
5330         for a NULL output section pointer.
5331
5332 2010-10-29  Doug Kwan  <dougkwan@google.com>
5333
5334         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5335         Output_section::add_relaxed_input_section.
5336         * output.cc (Output_section::add_relaxed_input_section): Add new
5337         arguments LAYOUT and NAME.  Set section order index.
5338         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5339         Copy section order index.
5340         * output.h (Output_section::add_relaxed_input_section): Add new
5341         arguments LAYOUT and NAME.
5342
5343 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5344
5345         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5346         NATIVE_OR_CROSS_LINKER.
5347         * testsuite/Makefile.in: Regenerate.
5348
5349 2010-10-20  Doug Kwan  <dougkwan@google.com>
5350
5351         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5352         without SHF_LINK_ORDER flags.
5353         * layout.cc (Layout::choose_output_section): Do not filter
5354         SHF_LINK_ORDER flag in a relocatable link.
5355
5356 2010-10-17  Cary Coutant  <ccoutant@google.com>
5357
5358         * output.h (Output_segment::set_section_addresses): Change function
5359         signature.  Update all callers.
5360         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5361         sections.
5362         (Output_segment::set_section_addresses): Align after last TLS
5363         section.  Add padding before last relro section instead of after.
5364
5365 2010-10-17  Doug Kwan  <dougkwan@google.com>
5366
5367         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5368         GOT output section to be writable.
5369
5370 2010-10-14  Cary Coutant  <ccoutant@google.com>
5371
5372         * debug.h (DEBUG_INCREMENTAL): New flag.
5373         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5374         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5375         mode.
5376         * incremental.cc (report_command_line): Ignore all forms of
5377         --incremental.
5378         * layout.cc (Layout::Layout): Check parameters for incremental link
5379         mode.
5380         * options.cc (General_options::parse_incremental): New function.
5381         (General_options::parse_no_incremental): New function.
5382         (General_options::parse_incremental_full): New function.
5383         (General_options::parse_incremental_update): New function.
5384         (General_options::incremental_mode_): New data member.
5385         (General_options::finalize): Check incremental_mode_.
5386         * options.h (General_options): Update help text for --incremental.
5387         Add --no-incremental, --incremental-full, --incremental-update.
5388         (General_options::Incremental_mode): New enum type.
5389         (General_options::incremental_mode): New function.
5390         (General_options::incremental_mode_): New data member.
5391         * parameters.cc (Parameters::incremental_mode_): New data member.
5392         (Parameters::set_options): Set incremental_mode_.
5393         (Parameters::set_incremental_full): New function.
5394         (Parameters::incremental): New function.
5395         (Parameters::incremental_update): New function.
5396         (set_parameters_incremental_full): New function.
5397         * parameters.h (Parameters::set_incremental_full): New function.
5398         (Parameters::incremental): New function.
5399         (Parameters::incremental_update): New function.
5400         (Parameters::incremental_mode_): New data member.
5401         (set_parameters_incremental_full): New function.
5402         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5403         incremental link mode.
5404         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5405         (Sized_relobj::do_relocate_sections): Likewise.
5406         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5407         option.
5408         * testsuite/Makefile.in: Regenerate.
5409         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5410
5411 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5412
5413         * script-sections.h (class Script_sections): Make
5414         Sections_elements typedef public.
5415         * script-sections.cc (class Sort_output_sections): Add elements_
5416         field.  Add constructor which sets it; change all callers.
5417         (Sort_output_sections::is_before): New function.
5418         (Sort_output_sections::operator()): Call is_before.
5419         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5420         conditional.
5421         * testsuite/script_test_10.sh: New test. Test script section
5422         order.
5423         * testsuite/script_test_10.t: Likewise.
5424         * testsuite/script_test_10.s: Likewise.
5425         * testsuite/Makefile.am: Wrap the cross linker tests and the
5426         common tests into NATIVE_OR_CROSS_LINKER.
5427         (check_SCRIPTS): Add script_test_10.sh.
5428         (check_DATA): Add script_test_10.stdout.
5429         (script_test_10.o, script_test_10): New targets.
5430         (script_test_10.stdout): New target.
5431         * configure, testsuite/Makefile.in: Regenerate.
5432
5433 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5434
5435         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5436         error for the deprecated relocations.
5437         (Target_arm::Scan::global): Likewise.
5438         (Target_arm::Relocate::relocate): Likewise.
5439
5440 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5441
5442         * fileread.cc (Input_file::find_file): Initialize *found_name
5443         and *namep when using the fallback search for case 4.
5444
5445 2010-10-11  Cary Coutant  <ccoutant@google.com>
5446
5447         * options.h (class General_options): Redefine -z lazy as an alias for
5448         the negation of -z now.
5449
5450 2010-10-11  Ian Lance Taylor  <iant@google.com>
5451
5452         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5453         binding.
5454
5455 2010-10-06  Nick Clifton  <nickc@redhat.com>
5456
5457         * script-sections.cc(class Memory_region): Remove
5458         current_lma_offset_ field.  Rename current_vma_offset_ to
5459         current_offset_.  Add last_section_ field.
5460         (Memory_region::get_current_vma_address): Rename to
5461         get_current_address.
5462         (Memory_region::get_current_lma_address): Delete.
5463         (Memory_region::increment_vma_offset): Rename to
5464         increment_offset.
5465         (Memory_region::increment_lma_offset): Delete.
5466         (Memory_region::attributes_compatible): New method.  Returns
5467         true if the provided section is compatible with the region.
5468         (Memory_region::get_last_section): New method.  Returns the last
5469         section to use the region.
5470         (Memory_region::set_last_section): New method.  Stores the last
5471         section to use the region.
5472         (Script_sections::block_in_region): New method.  Returns true if
5473         a block of memory is contained within a region.
5474         (Script_sections::find_memory_region): New method.  Locates a
5475         memory region to be used to set a VMA or LMA address.
5476         (Output_section_definition::set_section_addresses): Add code to
5477         check for addresses set by memory regions.
5478         (Output_segment::set_section_addresses): Remove memory region
5479         walking code.
5480         (Script_sections::create_segment): Add a warning if a header
5481         segment is created outside of any region.
5482         * script-sections.h (class Script_sections): Add prototypes for
5483         find_memory_region and block_in_region methods.
5484         * testsuite/memory_test.s: Use .long instead of .word.
5485         * testsuite/memory_test.t: Add some more output sections.
5486         * testsuite/memory_test.sh: Update expected output.
5487
5488 2010-10-02  Doug Kwan  <dougkwan@google.com>
5489
5490         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5491         defintion to symtab.h
5492         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5493         declaration to defintion.
5494
5495 2010-10-01  Nick Clifton  <nickc@redhat.com>
5496
5497         * expression.cc (eval): Replace dummy argument with NULL.
5498         (eval_maybe_dot): Check for a NULL result section pointer.
5499         (Symbol_expression::value): Likewise.
5500         (Dot_expression::value): Likewise.
5501         (BINARY_EXPRESSION): Likewise.
5502         (Max_expression::value): Likewise.
5503         (Min_expression::value): Likewise.
5504         (Absolute_expression::value): Likewise.
5505         (Addr_expression::value_from_output_section): Likewise.
5506         (Loaddddr_expression::value_from_output_section): Likewise.
5507         (Segment_start_expression::value): Likewise.
5508         * script-sections.cc
5509         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5510         argument with NULL.
5511         (Sections_elememt_dot_assignment::set_section_addresses):
5512         Likewise.
5513         (Output_data_expression::do_write_to_buffer): Likewise.
5514         (Output_section_definition::finalize_symbols): Likewise.
5515         (Output_section_definition::set_section_addresses): Likewise.
5516
5517 2010-09-30  Doug Kwan  <dougkwan@google.com>
5518
5519         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5520
5521 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5522
5523         * target.h (Target::can_icf_inline_merge_sections): New virtual
5524         function.
5525         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5526         virtual function.
5527         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5528         virtual function.
5529         * icf.cc (get_section_contents): Inline merge sections only when
5530         target allows it.
5531
5532 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5533
5534         * configure: Regenerate.
5535
5536 2010-09-17  Ian Lance Taylor  <iant@google.com>
5537
5538         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5539         * testsuite/Makefile.am (memory_test.o): New target.
5540         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5541         memory_test.t.
5542         * testsuite/Makefile.in: Rebuild.
5543
5544 2010-09-17  Doug Kwan  <dougkwan@google.com>
5545
5546         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5547         defintion if relocation uses GOT entries of the symbol.
5548         * testsuite/icf_safe_test.sh: Fix test.
5549         * testsuite/icf_safe_so_test.sh: Fix test.
5550
5551 2010-09-16  Cary Coutant  <ccoutant@google.com>
5552
5553         * script_sections.cc (class Memory_region): Remove "NULL" from
5554         vector initializations.
5555
5556 2010-09-15  Cary Coutant  <ccoutant@google.com>
5557
5558         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5559         Resolve forwarding symbols.
5560
5561 2010-09-15  Doug Kwan  <dougkwan@google.com>
5562
5563         * gold/testsuite/script_test_3.t: Add ARM special sections.
5564         * gold/testsuite/script_test_4.t: Same.
5565         * gold/testsuite/script_test_5.t: Same.
5566         * gold/testsuite/script_test_6.t: Same.
5567         * gold/testsuite/script_test_7.t: Same.
5568         * gold/testsuite/script_test_7.t: Same.
5569         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5570
5571 2010-09-14  Cary Coutant  <ccoutant@google.com>
5572
5573         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5574         (Target_x86_64::Relocate::relocate_tls): Replace check for
5575         saw_tls_block_reloc_ with test for executable section.
5576
5577 2010-09-12  Cary Coutant  <ccoutant@google.com>
5578
5579         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5580         position-independent executables to shared libraries need dynamic
5581         relocations.
5582         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5583         position-independent executables.
5584         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5585         * testsuite/Makefile.in: Regenerate.
5586
5587 2010-09-10  Nick Clifton  <nickc@redhat.com>
5588
5589         PR gold/11997
5590         * testsuite/memory_test.t: Discard any sections that are not
5591         needed.
5592
5593 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5594
5595         PR gold/11996
5596         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5597         "This::" to work around a bug in gcc 4.2.
5598
5599         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5600
5601 2010-09-09  Rafael Espindola  <espindola@google.com>
5602
5603         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5604         sections with different PF_X flags in the same segment.
5605         (Layout::find_first_load_seg): Search all segments to find the first
5606         one.
5607         * options.h (rosegment): New.
5608
5609 2010-09-08  Rafael Espindola  <espindola@google.com>
5610
5611         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5612
5613 2010-09-08  Doug Kwan  <dougkwan@google.com>
5614
5615         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5616         (Arm_relobj::do_relocate_sections): Add new parameter for output
5617         file to match the parent.
5618         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5619         of local symbols instead of input values.  Update code to track
5620         changes in gold::relocate_section.
5621         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5622         (Sized_relobj::compute_final_local_value_internal): New methods.
5623         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5624         body into private version of Sized_relobj::compute_final_local_value.
5625         Call the inline method.
5626         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5627         merged symbol value if there is one.
5628         (Symbol_value::has_output_value): New method defintiion.
5629         (Sized_relobj::Compute_final_local_value_status): New enum type.
5630         (Sized_relobj::compute_final_local_value): New methods.
5631         (Sized_relobj::compute_final_local_value_internal): New methods.
5632         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5633         and arm_cortex_a8.sh.
5634         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5635         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5636         New tests.
5637         * Makefile.in: Regenerate.
5638         * testsuite/arm_bl_out_of_range.s: Update test.
5639         * testsuite/thumb_bl_out_of_range.s: Ditto.
5640         * testsuite/thumb_blx_out_of_range.s: Ditto.
5641         * testsuite/arm_branch_out_of_range.sh: New file.
5642         * testsuite/arm_cortex_a8.sh: Ditto.
5643         * testsuite/arm_cortex_a8_b.s: Ditto.
5644         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5645         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5646         * testsuite/arm_cortex_a8_bl.s: Ditto.
5647         * testsuite/arm_cortex_a8_blx.s: Ditto.
5648         * testsuite/arm_cortex_a8_local.s: Ditto.
5649         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5650         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5651
5652 2010-09-08  Rafael Espindola  <espindola@google.com>
5653
5654         * Makefile.am (memory_test.stdout): Run readelf with -W.
5655         * Makefile.in: Regenerate.
5656         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5657         64 bit output.
5658
5659 2010-09-08  Rafael Espindola  <espindola@google.com>
5660
5661         * script-sections.cc (Script_sections::add_memory_region): Convert
5662         field precision to int.
5663         * script.cc (script_set_section_region, script_set_section_region):
5664         Convert field precision to int.
5665
5666 2010-09-08  Rafael Espindola  <espindola@google.com>
5667
5668         * arm.cc (do_finalize_sections): Create the __exidx_start and
5669         __exdix_end symbols even when the section is missing.
5670
5671 2010-09-08  Nick Clifton  <nickc@redhat.com>
5672
5673         * README: Remove claim that MEMORY is not supported.
5674         * expression.cc (script_exp_function_origin)
5675         (script_exp_function_length): Move from here to ...
5676         * script.cc: ... here.
5677         (script_set_section_region, script_add_memory)
5678         (script_parse_memory_attr, script_include_directive): New
5679         functions.
5680         * script-sections.cc
5681         (class Memory_region): New class.
5682         (class Output_section_definition): Add set_memory_region,
5683         set_section_vma, set_section_lma and get_section_name methods.
5684         (class Script_Sections): Add add_memory_region,
5685         find_memory_region, find_memory_region_origin,
5686         find_memory_region_length and set_memory_region methods.
5687         Have set_section_addresses method walk the list of set memory
5688         regions.
5689         Extend the print methos to display memory regions.
5690         * script-sections.h: Add prototypes for new methods.
5691         Add enum for MEMORY region attributes.
5692         * yyscript.y: Add support for parsing MEMORY regions.
5693         * script-c.h: Add prototypes for new functions.
5694         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5695         * testsuite/Makefile.in: Regenerate.
5696         * testsuite/memory_test.sh: New script.
5697         * testsuite/memory_test.s: New assembler source file.
5698         * testsuite/memory_test.t: New linker script.
5699
5700 2010-08-27  Doug Kwan  <dougkwan@google.com>
5701
5702         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5703         reference override an existing dynamic weak reference.
5704         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5705         * testsuite/Makefile.in: Regenerate.
5706         * testsuite/dyn_weak_ref.sh: New file.
5707         * testsuite/dyn_weak_ref_1.c: Ditto.
5708         * testsuite/dyn_weak_ref_2.c: Ditto.
5709
5710 2010-08-27  Ian Lance Taylor  <iant@google.com>
5711
5712         * incremental.h (class Incremental_input_entry): Add virtual
5713         destructor.
5714
5715 2010-08-27  Ian Lance Taylor  <iant@google.com>
5716
5717         * testsuite/start_lib_test_3.c: Mark t3 as used.
5718
5719 2010-08-27  Nick Clifton  <nickc@redhat.com>
5720
5721         * options.cc (version_script): Fix small typo in previous
5722         whitespace tidyup.
5723
5724 2010-08-25  Nick Clifton  <nickc@redhat.com>
5725
5726         * archive.cc: Formatting fixes: Remove whitespace between
5727         typename and following asterisk.  Remove whitespace between
5728         function name and opening parenthesis.
5729         * archive.h: Likewise.
5730         * arm.cc: Likewise.
5731         * attributes.cc: Likewise.
5732         * attributes.h: Likewise.
5733         * common.cc: Likewise.
5734         * copy-relocs.cc: Likewise.
5735         * dirsearch.h: Likewise.
5736         * dynobj.cc: Likewise.
5737         * ehframe.cc: Likewise.
5738         * ehframe.h: Likewise.
5739         * expression.cc: Likewise.
5740         * fileread.cc: Likewise.
5741         * fileread.h: Likewise.
5742         * gc.h: Likewise.
5743         * gold-threads.cc: Likewise.
5744         * gold.cc: Likewise.
5745         * i386.cc: Likewise.
5746         * icf.h: Likewise.
5747         * incremental-dump.cc: Likewise.
5748         * incremental.cc: Likewise.
5749         * layout.cc: Likewise.
5750         * layout.h: Likewise.
5751         * main.cc: Likewise.
5752         * merge.cc: Likewise.
5753         * merge.h: Likewise.
5754         * object.cc: Likewise.
5755         * object.h: Likewise.
5756         * options.cc: Likewise.
5757         * options.h: Likewise.
5758         * output.cc: Likewise.
5759         * output.h: Likewise.
5760         * plugin.cc: Likewise.
5761         * plugin.h: Likewise.
5762         * powerpc.cc: Likewise.
5763         * reloc.cc: Likewise.
5764         * script-c.h: Likewise.
5765         * script-sections.cc: Likewise.
5766         * script.cc: Likewise.
5767         * stringpool.cc: Likewise.
5768         * symtab.cc: Likewise.
5769         * symtab.h: Likewise.
5770         * target.cc: Likewise.
5771         * timer.cc: Likewise.
5772         * timer.h: Likewise.
5773         * version.cc: Likewise.
5774         * x86_64.cc: Likewise.
5775
5776 2010-08-24  Nick Clifton  <nickc@redhat.com>
5777
5778         PR 11899
5779         * layout.cc (segment_precedes): Sort segments by their physical
5780         addresses, if they have been set.
5781
5782 2010-08-23  Cary Coutant  <ccoutant@google.com>
5783
5784         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5785         symbols data.
5786         (Lib_group::include_member): Unlock object after deleting its
5787         symbols data.
5788         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5789         the bug fixed here.
5790
5791 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5792             Cary Coutant  <ccoutant@google.com>
5793
5794         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5795         constructor, and set_blocker.
5796         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5797         readsyms_blocker_.
5798         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5799         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5800         * testsuite/Makefile.am (start_lib_test): New test case.
5801         * testsuite/Makefile.in: Regenerate.
5802         * testsuite/start_lib_test_main.c: New file.
5803         * testsuite/start_lib_test_1.c: New file.
5804         * testsuite/start_lib_test_2.c: New file.
5805         * testsuite/start_lib_test_3.c: New file.
5806
5807 2010-08-19  Ian Lance Taylor  <iant@google.com>
5808
5809         * Makefile.in: Rebuild with automake 1.11.1.
5810         * aclocal.m4: Likewise.
5811         * testsuite/Makefile.in: Likewise.
5812
5813 2010-08-19  Ian Lance Taylor  <iant@google.com>
5814
5815         PR 10893
5816         * i386.cc (class Output_data_plt_i386): Update declarations.
5817         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5818         local_ifuncs_ fields.
5819         (Target_i386::do_plt_section_for_global): New function.
5820         (Target_i386::do_plt_section_for_local): New function.
5821         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5822         parameter; change all callers.  Initialize global_ifuncs_ and
5823         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5824         __rel_iplt_end.
5825         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5826         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5827         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5828         symbols.
5829         (Target_i386::make_plt_section): New function, broken out of
5830         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5831         (Target_i386::make_plt_entry): Call make_plt_section.
5832         (Target_i386::make_local_ifunc_plt_entry): New function.
5833         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5834         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5835         R_386_IRELATIVE to switch.
5836         (Target_i386::Scan::global): Likewise.
5837         (Target_i386::Relocate::relocate): Likewise.
5838         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5839         switch.
5840         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5841         (Target_x86_64::do_plt_section_for_global): New function.
5842         (Target_x86_64::do_plt_section_for_local): New function.
5843         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5844         parameter; change all callers.  If doing a static link define
5845         __rela_iplt_start and __rela_iplt_end.
5846         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5847         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5848         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5849         to point to .plt.
5850         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5851         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5852         switch.
5853         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5854         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5855         R_X86_64_IRELATIVE to switch.
5856         (Target_x86_64::Scan::global): Likewise.
5857         (Target_x86_64::Relocate::relocate): Likewise.
5858         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5859         switch.
5860         * target.h (class Target): Add plt_section_for_global and
5861         plt_section_for_local functions.  Add do_plt_section_for_global
5862         and do_plt_section_for_local virtual functions.
5863         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5864         clarifying comments.
5865         (Symbol::use_plt_offset): Handle IFUNC symbol.
5866         * object.cc (Sized_relobj::Sized_relobj): Initialize
5867         local_plt_offsets_.
5868         (Sized_relobj::local_has_plt_offset): New function.
5869         (Sized_relobj::local_plt_offset): New function.
5870         (Sized_relobj::set_local_plt_offset): New function.
5871         (Sized_relobj::do_count): Handle IFUNC symbol.
5872         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5873         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5874         is_ifunc_symbol functions.
5875         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5876         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5877         local_plt_offsets_ field.
5878         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5879         * output.h (class Output_section_data): Add non-const
5880         output_section function.
5881         (class Output_data_got): Update declarations.
5882         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5883         Add use_plt_offset parameter to global and local constructors.
5884         Change all callers.  Change local_sym_index_ field to 31 bits.
5885         Change GSYM_CODE and CONSTANT_CODE accordingly.
5886         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5887         doing a static link don't set sh_link field.
5888         (Output_data_got::Got_entry::write): Use PLT offset if
5889         appropriate.
5890         (Output_data_got::add_global_plt): New function.
5891         (Output_data_got::add_local_plt): New function.
5892         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5893         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5894         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5895         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5896         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5897         IFUNC conditional.
5898         * testsuite/ifunc-sel.h: New file.
5899         * testsuite/ifuncmain1.c: New file.
5900         * testsuite/ifuncmain1vis.c: New file.
5901         * testsuite/ifuncmod1.c: New file.
5902         * testsuite/ifuncdep2.c: New file.
5903         * testsuite/ifuncmain2.c: New file.
5904         * testsuite/ifuncmain3.c: New file.
5905         * testsuite/ifuncmod3.c: New file.
5906         * testsuite/ifuncmain4.c: New file.
5907         * testsuite/ifuncmain5.c: New file.
5908         * testsuite/ifuncmod5.c: New file.
5909         * testsuite/ifuncmain6pie.c: New file.
5910         * testsuite/ifuncmod6.c: New file.
5911         * testsuite/ifuncmain7.c: New file.
5912         * configure, testsuite/Makefile.in: Rebuild.
5913
5914 2010-08-18  Ian Lance Taylor  <iant@google.com>
5915
5916         * incremental.cc
5917         (Output_section_incremental_inputs::write_input_files): Add cast
5918         to avoid signed/unsigned comparison warning.
5919         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5920
5921 2010-08-12  Cary Coutant  <ccoutant@google.com>
5922
5923         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5924
5925 2010-08-13  Ian Lance Taylor  <iant@google.com>
5926
5927         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5928
5929 2010-08-12  Cary Coutant  <ccoutant@google.com>
5930             Doug Kwan  <dougkwan@google.com>
5931
5932         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5933         defintion overrides non-weak undef, remember that the original undef
5934         is not weak.
5935         * symtab.cc (Symbol_table::sized_write_global): For undef without
5936         an original weak binding, set binding to global in output.
5937         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5938         * testsuite/Makefile.in: Regenerate.
5939         * testsuite/strong_ref_weak_def.sh: New file.
5940         * testsuite/strong_ref_weak_def_1.c: Ditto.
5941         * testsuite/strong_ref_weak_def_2.c: Ditto.
5942
5943 2010-08-12  Cary Coutant  <ccoutant@google.com>
5944
5945         * testsuite/incremental_test.sh: Rewrite.
5946         * testsuite/incremental_test_1.c: Rewrite.
5947         * testsuite/incremental_test_2.c: Rewrite.
5948
5949 2010-08-12  Cary Coutant  <ccoutant@google.com>
5950
5951         * arm.cc (Target_arm::got_size): Add const.
5952         (Target_arm::got_entry_count): New function.
5953         (Target_arm::plt_entry_count): New function.
5954         (Target_arm::first_plt_entry_offset): New function.
5955         (Target_arm::plt_entry_size): New function.
5956         (Output_data_plt_arm::entry_count): New function.
5957         (Output_data_plt_arm::first_plt_entry_offset): New function.
5958         (Output_data_plt_arm::get_plt_entry_size): New function.
5959         * i386.cc (Target_i386::got_size): Add const.
5960         (Target_i386::got_entry_count): New function.
5961         (Target_i386::plt_entry_count): New function.
5962         (Target_i386::first_plt_entry_offset): New function.
5963         (Target_i386::plt_entry_size): New function.
5964         (Output_data_plt_i386::entry_count): New function.
5965         (Output_data_plt_i386::first_plt_entry_offset): New function.
5966         (Output_data_plt_i386::get_plt_entry_size): New function.
5967         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5968         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5969         * incremental.cc: Include target.h.
5970         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5971         parameter.  Adjust all callers.  Find incremental_got_plt section.
5972         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5973         section.
5974         (Output_section_incremental_inputs::set_final_data_size): Calculate
5975         size of incremental_got_plt section.
5976         (Output_section_incremental_inputs::do_write): Write the
5977         incremental_got_plt section.
5978         (Got_plt_view_info): New struct.
5979         (Local_got_offset_visitor): New class.
5980         (Global_got_offset_visitor): New class.
5981         (Global_symbol_visitor_got_plt): New class.
5982         (Output_section_incremental_inputs::write_got_plt): New function.
5983         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5984         Add parameter.  Adjust all callers.
5985         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5986         (Incremental_inputs::got_plt_section): New function.
5987         (Incremental_inputs::got_plt_section_): New data member.
5988         (Incremental_got_plt_reader): New class.
5989         * layout.cc (Layout::create_incremental_info_sections): Add the
5990         incremental_got_plt section.
5991         * object.h (Got_offset_list::get_list): New function.
5992         (Got offset_list::for_all_got_offsets): New function.
5993         (Sized_relobj::local_got_offset_list): New function.
5994         * powerpc.cc (Target_powerpc::got_size): Add const.
5995         (Target_powerpc::got_entry_count): New function.
5996         (Target_powerpc::plt_entry_count): New function.
5997         (Target_powerpc::first_plt_entry_offset): New function.
5998         (Target_powerpc::plt_entry_size): New function.
5999         (Output_data_plt_powerpc::entry_count): New function.
6000         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6001         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6002         * sparc.cc (Target_sparc::got_size): Add const.
6003         (Target_sparc::got_entry_count): New function.
6004         (Target_sparc::plt_entry_count): New function.
6005         (Target_sparc::first_plt_entry_offset): New function.
6006         (Target_sparc::plt_entry_size): New function.
6007         (Output_data_plt_sparc::entry_count): New function.
6008         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6009         (Output_data_plt_sparc::get_plt_entry_size): New function.
6010         * symtab.h (Symbol::got_offset_list): New function.
6011         (Symbol_table::for_all_symbols): New function.
6012         * target.h (Sized_target::got_entry_count): New function.
6013         (Sized_target::plt_entry_count): New function.
6014         (Sized_target::plt_entry_size): New function.
6015         * x86_64.cc (Target_x86_64::got_size): Add const.
6016         (Target_x86_64::got_entry_count): New function.
6017         (Target_x86_64::plt_entry_count): New function.
6018         (Target_x86_64::first_plt_entry_offset): New function.
6019         (Target_x86_64::plt_entry_size): New function.
6020         (Output_data_plt_x86_64::entry_count): New function.
6021         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6022         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6023
6024 2010-08-12  Cary Coutant  <ccoutant@google.com>
6025
6026         * archive.cc: Include incremental.h.
6027         (Archive::Archive): Initialize incremental_info_.
6028         (Archive::include_member): Record archive members in incremental info.
6029         (Add_archive_symbols::run): Record begin and end of an archive in
6030         incremental info.
6031         (Lib_group::include_member): Record objects in incremental info.
6032         * archive.h (Incremental_archive_entry): Forward declaration.
6033         (Archive::set_incremental_info): New member function.
6034         (Archive::incremental_info): New member function.
6035         (Archive::Unused_symbol_iterator): New class.
6036         (Archive::unused_symbols_begin): New member function.
6037         (Archive::unused_symbols_end): New member function.
6038         (Archive::incremental_info_): New data member.
6039         * incremental-dump.cc (find_input_containing_global): New function.
6040         (dump_incremental_inputs): Dump new incremental info sections.
6041         * incremental.cc: Include symtab.h.
6042         (Output_section_incremental_inputs): New class.
6043         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6044         new incremental info sections.
6045         (Sized_incremental_binary::do_check_inputs): Likewise.
6046         (Incremental_inputs::report_archive): Remove.
6047         (Incremental_inputs::report_archive_begin): New function.
6048         (Incremental_inputs::report_archive_end): New function.
6049         (Incremental_inputs::report_object): New function.
6050         (Incremental_inputs::finalize_inputs): Remove.
6051         (Incremental_inputs::report_input_section): New function.
6052         (Incremental_inputs::report_script): Rewrite.
6053         (Incremental_inputs::finalize): Do nothing but finalize string table.
6054         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6055         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6056         (Incremental_inputs::create_data_sections): New function.
6057         (Incremental_inputs::relocs_entsize): New function.
6058         (Output_section_incremental_inputs::set_final_data_size): New function.
6059         (Output_section_incremental_inputs::do_write): New function.
6060         (Output_section_incremental_inputs::write_header): New function.
6061         (Output_section_incremental_inputs::write_input_files): New function.
6062         (Output_section_incremental_inputs::write_info_blocks): New function.
6063         (Output_section_incremental_inputs::write_symtab): New function.
6064         * incremental.h (Incremental_script_entry): Forward declaration.
6065         (Incremental_object_entry): Forward declaration.
6066         (Incremental_archive_entry): Forward declaration.
6067         (Incremental_inputs): Forward declaration.
6068         (Incremental_inputs_header_data): Remove.
6069         (Incremental_inputs_header): Remove.
6070         (Incremental_inputs_header_write): Remove.
6071         (Incremental_inputs_entry_data): Remove.
6072         (Incremental_inputs_entry): Remove.
6073         (Incremental_inputs_entry_write): Remove.
6074         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6075         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6076         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6077         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6078         Likewise.
6079         (Incremental_input_entry): New class.
6080         (Incremental_script_entry): New class.
6081         (Incremental_object_entry): New class.
6082         (Incremental_archive_entry): New class.
6083         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6084         (Incremental_inputs::report_inputs): Remove.
6085         (Incremental_inputs::report_archive): Remove.
6086         (Incremental_inputs::report_archive_begin): New function.
6087         (Incremental_inputs::report_archive_end): New function.
6088         (Incremental_inputs::report_object): Change prototype.
6089         (Incremental_inputs::report_input_section): New function.
6090         (Incremental_inputs::report_script): Change prototype.
6091         (Incremental_inputs::get_reloc_count): New function.
6092         (Incremental_inputs::set_reloc_count): New function.
6093         (Incremental_inputs::create_data_sections): New function.
6094         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6095         (Incremental_inputs::inputs_section): New function.
6096         (Incremental_inputs::symtab_section): New function.
6097         (Incremental_inputs::relocs_section): New function.
6098         (Incremental_inputs::get_stringpool): Add const.
6099         (Incremental_inputs::command_line): Add const.
6100         (Incremental_inputs::inputs): Remove.
6101         (Incremental_inputs::command_line_key): New function.
6102         (Incremental_inputs::input_file_count): New function.
6103         (Incremental_inputs::input_files): New function.
6104         (Incremental_inputs::relocs_entsize): New function.
6105         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6106         (Incremental_inputs::finalize_inputs): Remove.
6107         (Incremental_inputs::Input_info): Remove.
6108         (Incremental_inputs::lock_): Remove.
6109         (Incremental_inputs::inputs_): Change type.
6110         (Incremental_inputs::inputs_map_): Remove.
6111         (Incremental_inputs::current_object_entry_): New data member.
6112         (Incremental_inputs::inputs_section_): New data member.
6113         (Incremental_inputs::symtab_section_): New data member.
6114         (Incremental_inputs::relocs_section_): New data member.
6115         (Incremental_inputs::reloc_count_): New data member.
6116         (Incremental_inputs_reader): New class.
6117         (Incremental_symtab_reader): New class.
6118         (Incremental_relocs_reader): New class.
6119         * layout.cc (Layout::finalize): Move finalization of incremental info
6120         and creation of incremental info sections to follow finalization of
6121         symbol table.  Set offsets for postprocessing sections.
6122         (Layout::create_incremental_info_sections): Call
6123         Incremental_inputs::create_data_sections.  Add incremental symtab
6124         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6125         sections to layout after input sections.
6126         * layout.h (struct Timespec): Forward declaration.
6127         (Layout::incremental_inputs): Add const.
6128         (Layout::create_incremental_info_sections): Add parameter.
6129         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6130         * object.cc: Include incremental.h.
6131         (Relobj::finalize_incremental_relocs): New function.
6132         (Sized_relobj::do_layout): Record input sections in incremental info.
6133         * object.h (Object::output_section): New function.
6134         (Object::output_section_offset): Moved from Relobj.
6135         (Object::get_incremental_reloc_base): New function.
6136         (Object::get_incremental_reloc_count): New function.
6137         (Object::do_output_section): New function.
6138         (Object::do_output_section_offset): Moved from Relobj.
6139         (Object::do_get_incremental_reloc_base): New function.
6140         (Object::do_get_incremental_reloc_count): New function.
6141         (Object::Object): Initialize new data members.
6142         (Relobj::output_section): Renamed do_output_section and moved to
6143         protected.
6144         (Relobj::output_section_offset): Moved to Object.
6145         (Relobj::do_get_incremental_reloc_base): New function.
6146         (Relobj::do_get_incremental_reloc_count): New function.
6147         (Relobj::allocate_incremental_reloc_counts): New function.
6148         (Relobj::count_incremental_reloc): New function.
6149         (Relobj::finalize_incremental_relocs): New function.
6150         (Relobj::next_incremental_reloc_index): New function.
6151         (Relobj::reloc_counts_): New data member.
6152         (Relobj::reloc_bases_): New data member.
6153         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6154         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6155         (Sized_relobj::incremental_relocs_scan): New function.
6156         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6157         (Sized_relobj::incremental_relocs_write): New function.
6158         (Sized_relobj::incremental_relocs_write_reltype): New function.
6159         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6160         incremental link.
6161         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6162         archives and object files elsewhere.
6163         (Add_symbols::run): Report object files here.
6164         (Finish_group::run): Report end of archive at end of group.
6165         * reloc.cc: Include layout.h, incremental.h.
6166         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6167         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6168         (Sized_relobj::incremental_relocs_scan): New function.
6169         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6170         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6171         (Sized_relobj::incremental_relocs_write): New function.
6172         (Sized_relobj::incremental_relocs_write_reltype): New function.
6173         * script.cc (read_input_script): Rewrite test for incremental link.
6174         Change call to Incremental_inputs::report_script.
6175         * symtab.h (Symbol_table::first_global_index): New function.
6176         (Symbol_table::output_count): New function.
6177
6178 2010-08-12  Doug Kwan  <dougkwan@google.com>
6179
6180         * arm.cc (Target_arm::merge_object_attributes): Check command line
6181         options --no-wchar-size-warning and --no-enum-size-warning.
6182         * options.h (General_options): Add ld-compatible options
6183         --no-enum-size-warning and --no-wchar-size-warning.
6184
6185 2010-08-04  Ian Lance Taylor  <iant@google.com>
6186
6187         * x86_64.cc (Target_x86_64::Scan::local): Use
6188         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6189         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6190         (Target_x86_64::Scan::global): Likewise.
6191         (Target_x86_64::Relocate::relocate): Likewise.
6192         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6193         Likewise.
6194
6195 2010-08-03  Cary Coutant  <ccoutant@google.com>
6196
6197         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6198         to reserve space in merged_strings vector. Keep total input size
6199         for stats.
6200         (Output_merge_string::do_print_merge_stats): Print total input size.
6201         * merge.h (Output_merge_string): Add input_size_ field.
6202         * stringpool.cc (Stringpool_template::string_length): Move
6203         implementations out of Stringpool_template class and place in
6204         stringpool.h.
6205         * stringpool.h (string_length): Move out of Stringpool_template.
6206
6207 2010-08-03  Ian Lance Taylor  <iant@google.com>
6208
6209         PR 11712
6210         * layout.cc (relaxation_loop_body): If address of load segment is
6211         set, adjust address to include headers if possible.
6212
6213 2010-08-03  Ian Lance Taylor  <iant@google.com>
6214
6215         * version.cc (version_string): Bump to 1.10.
6216
6217 2010-08-03  Ian Lance Taylor  <iant@google.com>
6218
6219         PR 11805
6220         * layout.h (enum Output_section_order): Define.
6221         (class Layout): Update declarations.
6222         * layout.cc (Layout::get_output_section): Add order parameter.
6223         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6224         is_first_non_relro parameters.  Change all callers.
6225         (Layout::choose_output_section): Likewise.
6226         (Layout::add_output_section_data): Likewise.
6227         (Layout::make_output_section): Likewise.  Set order.
6228         (Layout::default_section_order): New function.
6229         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6230         * output.cc (Output_section::Output_section): Initialize order_.
6231         Don't initialize deleted fields.
6232         (Output_segment::Output_segment): Don't initialize deleted
6233         fields.
6234         (Output_segment::add_output_section_to_load): New function
6235         replacing add_output_section.  Change all callers to call this or
6236         add_output_section_to_nonload.
6237         (Output_segment::add_output_section_to_nonload): New function.
6238         (Output_segment::remove_output_section): Rewrite.
6239         (Output_segment::add_initial_output_data): Likewise.
6240         (Output_segment::has_any_data_sections): Likewise.
6241         (Output_segment::is_first_section_relro): Likewise.
6242         (Output_segment::maximum_alignment): Likewise.
6243         (Output_segment::has_dynamic_reloc): New function replacing
6244         dynamic_reloc_count.  Change all callers.
6245         (Output_segment::has_dynamic_reloc_list): New function replacing
6246         dynamic_reloc_count_list.  Change all callers.
6247         (Output_segment::set_section_addresses): Rewrite.
6248         (Output_segment::set_offset): Rewrite.
6249         (Output_segment::find_first_and_last_list): Remove.
6250         (Output_segment::set_tls_offsets): Rewrite.
6251         (Output_segment::first_section_load_address): Likewise.
6252         (Output_segment::output_section_count): Likewise.
6253         (Output_segment::section_with_lowest_load_address): Likewise.
6254         (Output_segment::write_section_headers): Likewise.
6255         (Output_segment::print_sections_to_map): Likewise.
6256         * output.h (class Output_data): Remove dynamic_reloc_count_
6257         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6258         (Output_data::add_dynamic_reloc): Rewrite.
6259         (Output_data::has_dynamic_reloc): New function.
6260         (Output_data::dynamic_reloc_count): Remove.
6261         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6262         is_last_relro_, is_first_non_relro_, is_interp_,
6263         is_dynamic_linker_section_ fields.  Add order and set_order
6264         functions.  Remove is_relro_local, set_is_relro_local,
6265         is_last_relro, set_is_last_relro, is_first_non_relro,
6266         set_is_first_non_relro functions, is_interp, set_is_interp,
6267         is_dynamic_linker_section, and set_is_dynamic_linker_section
6268         functions.
6269         (class Output_segment): Change Output_data_list from std::list to
6270         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6271         output_bss_ fields.  Update declarations.
6272
6273 2010-08-02  Ian Lance Taylor  <iant@google.com>
6274
6275         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6276         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6277         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6278
6279 2010-08-02  Ian Lance Taylor  <iant@google.com>
6280
6281         PR 11855
6282         * script.cc (Script_options::Script_options): Initialize
6283         symbol_definitions_ and symbol_references_.
6284         (Script_options::add_symbol_assignment): Update
6285         symbol_definitions_ and symbol_references_.
6286         (Script_options::add_symbol_reference): New function.
6287         (script_symbol): New function.
6288         * script.h (class Script_options): Add symbol_definitions_ and
6289         symbol_references_ fields.
6290         (Script_options::referenced_const_iterator): New type.
6291         (Script_options::referenced_begin): New function.
6292         (Script_options::referenced_end): New function.
6293         (Script_options::is_referenced): New function.
6294         (Script_options::any_unreferenced): New function.
6295         * script-c.h (script_symbol): Declare.
6296         * yyscript.y (exp): Call script_symbol.
6297         * symtab.cc: Include "script.h".
6298         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6299         Change all callers.  Check symbols referenced by scripts.
6300         (Symbol_table::add_undefined_symbols_from_command_line): Add
6301         layout parameter.  Change all callers.
6302         (Symbol_table::do_add_undefined_symbols_from_command_line):
6303         Likewise.  Break out loop body.  Check symbols referenced by
6304         scripts.
6305         (Symbol_table::add_undefined_symbol_from_command_line): New
6306         function broken out of
6307         do_add_undefined_symbols_from_command_line.
6308         * symtab.h (class Symbol_table): Update declarations.
6309         * archive.cc: Include "layout.h".
6310         (Archive::should_include_member): Add layout parameter.  Change
6311         all callers.  Check for symbol mentioned in expression.
6312         * archive.h (class Archive): Update declaration.
6313         * object.cc (Sized_relobj::do_should_include_member): Add layout
6314         parameter.
6315         * object.h (Object::should_include_member): Add layout parameter.
6316         Change all callers.
6317         (Object::do_should_include_member): Add layout parameter.
6318         (class Sized_relobj): Update declaration.
6319         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6320         parameter.
6321         * dynobj.h (class Sized_dynobj): Update declaration.
6322         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6323         layout parameter.
6324         * plugin.h (class Sized_pluginobj): Update declaration.
6325
6326 2010-08-02  Ian Lance Taylor  <iant@google.com>
6327
6328         PR 11866
6329         * output.cc (Output_segment::set_offset): Search for the first and
6330         last sections rather than assuming that the list is in order.
6331         (Output_segment::find_first_and_last_list): New function.
6332         * output.h (class Output_segment): Update declarations.
6333         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6334         (relro_strip_test_SOURCES): New variable.
6335         (relro_strip_test_DEPENDENCIES): New variable.
6336         (relro_strip_test_LDFLAGS): New variable.
6337         (relro_strip_test_LDADD): New variable.
6338         (relro_strip_test.so): New target.
6339
6340 2010-08-02  Ian Lance Taylor  <iant@google.com>
6341
6342         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6343         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6344         (Target_i386::got_tlsdesc_section): New function.
6345         (Target_i386::got_section): Create space for GOT entries for
6346         TLSDESC relocations.
6347         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6348         R_386_TLS_GOTDESC.
6349         (Target_i386::Scan::global): Likewise.
6350         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6351         using TLSDESC GOT.
6352         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6353         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6354         (Target_x86_64::got_tlsdesc_section): New function.
6355         (Target_x86_64::got_section): Create space for GOT entries for
6356         TLSDESC relocations.
6357         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6358         R_386_TLS_GOTDESC.
6359         (Target_x86_64::Scan::global): Likewise.
6360         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6361         using TLSDESC GOT.
6362
6363 2010-08-02  Ian Lance Taylor  <iant@google.com>
6364
6365         * testsuite/final_layout.sh: Use dc to convert from hex to
6366         decimal.
6367
6368 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6369
6370         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6371         paramter to the call to gold::gc_process_relocs.
6372         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6373         paramter to the call to gold::gc_process_relocs.
6374         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6375         parameter to the call to gold::gc_process_relocs.
6376         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6377         template parameter to the call to gold::gc_process_relocs.
6378         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6379         paramter to the call to gold::gc_process_relocs.
6380         * gc.h (get_embedded_addend_size): New function.
6381         (gc_process_relocs): Save the size of the reloc for use by ICF.
6382         * icf.cc (get_section_contents): Get the addend from the text section
6383         for SHT_REL relocation sections.
6384         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6385         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6386         * int_encoding.h (read_from_pointer): New overloaded function.
6387         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6388         * testsuite/icf_sht_rel_addend_test.sh: New file.
6389         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6390         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6391
6392 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6393
6394         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6395         * Makefile.in: Regenerate.
6396         * testsuite/Makefile.in: Regenerate.
6397
6398 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6399
6400         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6401         * gold/testsuite/debug_msg.cc: Likewise.
6402         * gold/testsuite/odr_violation1.cc
6403         * gold/testsuite/odr_violation2.cc
6404
6405 2010-07-21  Cary Coutant  <ccoutant@google.com>
6406
6407         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6408         string, and length fields.
6409         (Output_merge_string::Merged_strings_list): New type.
6410         (Output_merge_string::Merged_strings_lists): New typedef.
6411         (Output_merge_string): Replace merged_strings_ with
6412         merged_strings_lists_.
6413         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6414         Merged_strings_list per input object and section.  Don't store pointer
6415         to the string.  Don't store length with each merged string entry.
6416         (Output_merge_string::finalize_merged_data): Loop over list of merged
6417         strings lists.  Recompute length of each merged string.
6418
6419 2010-07-15  Cary Coutant  <ccoutant@google.com>
6420
6421         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6422         here.
6423
6424 2010-07-14  Ian Lance Taylor  <iant@google.com>
6425
6426         * descriptors.cc (Descriptors::open): Report correct name in error
6427         message.
6428
6429 2010-07-13  Doug Kwan  <dougkwan@google.com>
6430
6431         * arm.cc (Arm_input_section::Arm_input_section): For a
6432         SHT_ARM_EXIDX section, always keeps the input sections.
6433         (Arm_input_section::set_exidx_section_link): New method.
6434         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6435         has_errors_ to false.
6436         (Arm_exidx_input_section::has_errors,
6437         Arm_exidx_input_section::set_has_errors): New methods.
6438         (Arm_exidx_input_section::has_errors_): New data member.
6439         (Arm_relobj::get_exidx_shndx_list): New method.
6440         (Arm_output_section::append_text_sections_to_list): Do not skip
6441         section without SHF_EXECINSTR.
6442         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6443         errors.
6444         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6445         section header.  Make error messages more verbose.  Check for
6446         a non-executable section linked to an EXIDX section.
6447         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6448         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6449         check that there is no deferred EXIDX section if we exit early.
6450         Instead of not making an EXIDX section in case of an error, make one
6451         and set the has_errors flag of it.
6452         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6453         in a relocatable link.
6454         (Target_arm::do_relax): Look for the EXIDX output section instead of
6455         assuming that it is called .ARM.exidx.
6456         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6457         section list.  Do not check for SHF_EXECINSTR section flags but
6458         skip any input section with errors.
6459         * output.cc (Output_section::Output_section): Initialize
6460         always_keeps_input_sections_ to false.
6461         (Output_section::add_input_section): Check for
6462         always_keeps_input_sections_.
6463         *  output.h (Output_section::always_keeps_input_sections,
6464         Output_section::set_always_keeps_input_sections): New methods.
6465         (Output_section::always_keeps_input_sections): New data member.
6466
6467 2010-07-13  Rafael Espindola  <espindola@google.com>
6468
6469         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6470         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6471
6472 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6473             Ian Lance Taylor  <iant@google.com>
6474
6475         * output.h (Output_section_lookup_maps::add_merge_section):
6476         Correct check of whether value was inserted.
6477         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6478         (Output_section_lookup_maps::add_relaxed_input_section):
6479         Likewise.
6480         * arm.cc (Target_arm::got_section): Remove used local os.
6481         * i386.cc (Target_i386::got_section): Likewise.
6482         * x86_64.cc (Target_x86_64::got_section): Likewise.
6483         * sparc.cc (Target_sparc::got_section): Likewise.
6484         (Target_sparc::relocate): Remove unused local have_got_offset.
6485         * powerpc.cc (Target_powerpc::relocate): Likewise.
6486
6487 2010-07-13  Ian Lance Taylor  <iant@google.com>
6488
6489         * compressed_output.cc (zlib_decompress): Fix signature in
6490         !HAVE_ZLIB_H case.
6491
6492         * archive.cc (Archive::include_member): Unlock an external member
6493         of a thin archive.  Don't bother to delete an object we know is
6494         NULL.
6495
6496 2010-07-12  Cary Coutant  <ccoutant@google.com>
6497
6498         * compressed_output.cc (zlib_decompress): New function.
6499         (get_uncompressed_size): New function.
6500         (decompress_input_section): New function.
6501         * compressed_output.h (get_uncompressed_size): New function.
6502         (decompress_input_section): New function.
6503         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6504         Handle compressed debug sections.
6505         * layout.cc (is_compressed_debug_section): New function.
6506         (Layout::output_section_name): Map compressed section names to
6507         canonical names.
6508         * layout.h (is_compressed_debug_section): New function.
6509         (is_debug_info_section): Recognize compressed debug sections.
6510         * merge.cc: Include compressed_output.h.
6511         (Output_merge_data::do_add_input_section): Handle compressed
6512         debug sections.
6513         (Output_merge_string::do_add_input_section): Handle compressed
6514         debug sections.
6515         * object.cc: Include compressed_output.h.
6516         (Sized_relobj::Sized_relobj): Initialize new data members.
6517         (build_compressed_section_map): New function.
6518         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6519         * object.h (Object::section_is_compressed): New method.
6520         (Object::do_section_is_compressed): New method.
6521         (Sized_relobj::Compressed_section_map): New type.
6522         (Sized_relobj::do_section_is_compressed): New method.
6523         (Sized_relobj::compressed_sections_): New data member.
6524         * output.cc (Output_section::add_input_section): Handle compressed
6525         debug sections.
6526         * reloc.cc: Include compressed_output.h.
6527         (Sized_relobj::write_sections): Handle compressed debug sections.
6528
6529 2010-07-08  Cary Coutant  <ccoutant@google.com>
6530
6531         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6532         weak when resolving to a dynamic def.
6533         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6534         for weak undef/dynamic def cases. Adjust callers.
6535         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6536         undef_binding_weak_.
6537         (Symbol_table::sized_write_globals): Adjust symbol binding.
6538         (Symbol_table::sized_write_symbol): Add binding parameter.
6539         * symtab.h (Symbol::set_undef_binding): New method.
6540         (Symbol::is_undef_binding_weak): New method.
6541         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6542         (Symbol_table::should_override): Add new parameter.
6543         (Symbol_table::sized_write_symbol): Add new parameter.
6544
6545         * testsuite/weak_undef_file1.cc: Add new test case.
6546         * testsuite/weak_undef_file2.cc: Fix header comment.
6547         * testsuite/weak_undef_test.cc: Add new test case.
6548
6549 2010-06-29  Doug Kwan  <dougkwan@google.com>
6550
6551         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6552         Initialize USE_SYMBOL_.
6553         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6554         definition.
6555         (Arm_reloc_property::uses_symbol_): New data member declaration.
6556         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6557         uses symbol value and symbol is undefined but not weakly undefined.
6558
6559 2010-06-28  Rafael Espindola  <espindola@google.com>
6560
6561         * plugin.cc (Plugin::load): Use dlerror.
6562
6563 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6564
6565         * symtab.cc (detect_odr_violations): When reporting an ODR
6566         violation, report an object where the symbol is defined.
6567
6568 2010-06-25  Doug Kwan  <dougkwan@google.com>
6569
6570         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6571         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6572         definition.
6573         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6574         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6575         target hook to detect function points.
6576         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6577         * icf.h (Icf::check_section_for_function_pointers): Change type of
6578         parameter SECTION_NAME to const reference to std::string.  Use
6579         target hook to determine if section may have unsafe pointers.
6580         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6581         method definition.
6582
6583 2010-06-21  Rafael Espindola  <espindola@google.com>
6584
6585         * fileread.cc (Input_file::find_fie): New
6586         (Input_file::open): Use Input_file::find_fie.
6587         * fileread.h (Input_file::find_fie): New
6588         * plugin.cc (set_extra_library_path): New.
6589         (Plugin::load): Add set_extra_library_path to the transfer vector.
6590         (Plugin_manager::set_extra_library_path): New.
6591         (Plugin_manager::add_input_file): Use the extra search path if set.
6592         (set_extra_library_path(): New.
6593         * plugin.h (Plugin_manager): Add set_extra_library_path and
6594         extra_search_path_.
6595
6596 2010-06-19  Cary Coutant  <ccoutant@google.com>
6597
6598         * layout.cc (gdb_sections): Add .debug_types.
6599         (lines_only_debug_sections): Likewise.
6600
6601 2010-06-18  Rafael Espindola  <espindola@google.com>
6602
6603         * plugin.cc (add_input_file,add_input_library)
6604         (Plugin_manager::add_input_file): Make filename arguments const.
6605         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6606         const.
6607
6608 2010-06-16  Doug Kwan  <dougkwan@google.com>
6609
6610         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6611         .ARM.attributes section if we have not merged any input
6612         attributes sections.
6613
6614 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6615
6616         * arm.cc: Allow combining objects with no EABI version
6617         information.
6618
6619 2010-06-15  Rafael Espindola  <espindola@google.com>
6620
6621         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6622
6623 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6624
6625         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6626         (struct iovec): Correct !HAVE_READV definition.
6627
6628 2010-06-10  Cary Coutant  <ccoutant@google.com>
6629
6630         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6631         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6632         reloc sections.
6633         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6634
6635         PR 11683
6636         * symtab.h (Symbol::is_placeholder): New member function.
6637         * target-reloc.h (relocate_section): Check for placeholder symbols.
6638
6639         * testsuite/Makefile.am (plugin_test_8): New test.
6640         (plugin_test_9): New test.
6641         * testsuite/Makefile.in: Regenerate.
6642
6643 2010-06-09  Nick Clifton  <nickc@redhat.com>
6644
6645         * yyscript.y (input_list_element): Allow strings prefixed with
6646         the '-' character.  Treat these as libraries.
6647         * script.cc (script_add_library): New function.  Adds a library
6648         specified by "-l<name>" found in an input script.
6649         * script-c.h: Add prototype for script_add_library.
6650
6651 2010-06-07  Doug Kwan  <dougkwan@google.com>
6652
6653         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6654         Restrict stub-group size to be within long conditional branch
6655         range when working around cortex-A8 erratum.
6656
6657 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6658
6659         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6660         #ifdef typo.
6661
6662 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6663
6664         PR gold/11658
6665         * output.cc
6666         (Output_section::Input_section_sort_entry::compare_section_ordering):
6667         Change to return non-zero correctly.
6668         (Output_section::Input_section_sort_section_order_index_compare
6669         ::operator()): Change to fix ambiguity in comparisons.
6670
6671 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6672
6673         * gold.h (is_wildcard_string): New function.
6674         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6675         (Layout::layout_eh_frame): Ditto.
6676         (Layout::find_section_order_index): New method.
6677         (Layout::read_layout_from_file): New method.
6678         * layout.h (Layout::find_section_order_index): New method.
6679         (Layout::read_layout_from_file): New method.
6680         (Layout::input_section_position_): New private member.
6681         (Layout::input_section_glob_): New private member.
6682         * main.cc (main): Call read_layout_from_file here.
6683         * options.h (--section-ordering-file): New option.
6684         * output.cc (Output_section::input_section_order_specified_): New
6685         member.
6686         (Output_section::Output_section): Initialize new member.
6687         (Output_section::add_input_section): Add new parameter.
6688         Keep input sections when --section-ordering-file is used.
6689         (Output_section::set_final_data_size): Sort input sections when
6690         section ordering file is specified.
6691         (Output_section::Input_section_sort_entry): Add new parameter.
6692         Check sorting type.
6693         (Output_section::Input_section_sort_entry::compare_section_ordering):
6694         New method.
6695         (Output_section::Input_section_sort_compare::operator()): Change to
6696         consider section_order_index.
6697         (Output_section::Input_section_sort_init_fini_compare::operator()):
6698         Change to consider section_order_index.
6699         (Output_section::Input_section_sort_section_order_index_compare
6700         ::operator()): New method.
6701         (Output_section::sort_attached_input_sections): Change to sort
6702         according to section order when specified.
6703         (Output_section::add_input_section<32, true>): Add new parameter.
6704         (Output_section::add_input_section<64, true>): Add new parameter.
6705         (Output_section::add_input_section<32, false>): Add new parameter.
6706         (Output_section::add_input_section<64, false>): Add new parameter.
6707         * output.h (Output_section::add_input_section): Add new parameter.
6708         (Output_section::input_section_order_specified): New
6709         method.
6710         (Output_section::set_input_section_order_specified): New method.
6711         (Input_section::Input_section): Initialize section_order_index_.
6712         (Input_section::section_order_index): New method.
6713         (Input_section::set_section_order_index): New method.
6714         (Input_section::section_order_index_): New member.
6715         (Input_section::Input_section_sort_section_order_index_compare): New
6716         struct.
6717         (Output_section::input_section_order_specified_): New member.
6718         * script-sections.cc (is_wildcard_string): Delete and move modified
6719         method to gold.h.
6720         (Output_section_element_input::Output_section_element_input): Modify
6721         call to is_wildcard_string.
6722         (Output_section_element_input::Input_section_pattern
6723         ::Input_section_pattern): Ditto.
6724         (Output_section_element_input::Output_section_element_input): Ditto.
6725         * testsuite/Makefile.am (final_layout): New test case.
6726         * testsuite/Makefile.in: Regenerate.
6727         * testsuite/final_layout.cc: New file.
6728         * testsuite/final_layout.sh: New file.
6729
6730 2010-06-01  Rafael Espindola  <espindola@google.com>
6731
6732         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6733
6734 2010-06-01  Rafael Espindola  <espindola@google.com>
6735
6736         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6737         visibility of symbols.
6738
6739 2010-05-27  Doug Kwan  <dougkwan@google.com>
6740
6741         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6742         from start of output section instead of address for a local symbol
6743         in a merged or relaxed section when doing a relocatable link.
6744
6745 2010-05-26  Rafael Espindola  <espindola@google.com>
6746
6747         PR 11604
6748         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6749         adding sections the garbage collector removed.
6750         * gold/testsuite/Makefile.am: Add test.
6751         * gold/testsuite/Makefile.in: Regenerate.
6752         * gold/testsuite/plugin_test_7.sh: New.
6753         * gold/testsuite/plugin_test_7_1.c: New.
6754         * gold/testsuite/plugin_test_7_2.c: New.
6755
6756 2010-05-26  Rafael Espindola  <espindola@google.com>
6757
6758         * script-sections.cc (Output_section_definition::set_section_addresses):
6759         Check for --section-start.
6760
6761 2010-05-26  Doug Kwan  <dougkwan@google.com>
6762
6763         * arm.cc (Arm_scan_relocatable_relocs): New class.
6764         (Target_arm::relocate_special_relocatable): New method.
6765         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6766         (Arm_relocate_functions::thumb_branch_common): Same.
6767         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6768         instead of Default_scan_relocatable_relocs.
6769         * target-reloc.h (relocate_for_relocatable): Let target handle
6770         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6771         * target.h (Sized_target::relocate_special_relocatable): New method.
6772
6773 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6774
6775         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6776
6777 2010-05-23  Doug Kwan  <dougkwan@google.com>
6778
6779         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6780         instead of a cast.
6781         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6782         with a direct branch, not a conditional branch, to a stub.
6783         * merge.cc (Output_merge_base::record_input_section): New method
6784         defintion.
6785         (Output_merge_data::do_add_input_section): Record input section if
6786         keeps-input-sections flag is set.
6787         (Output_merge_string::do_add_input_section): Ditto.
6788         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6789         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6790         INPUT_SECTIONS_.
6791         (Output_merge_base::keeps_input_sections,
6792         Output_merge_base::set_keeps_input_sections,
6793         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6794         method definitions.
6795         (Output_merge_base::Input_sections): New type declaration.
6796         (Output_merge_base::input_sections_begin,
6797         Output_merge_base::input_sections_end,
6798         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6799         (Output_merge_base::bool keeps_input_sections_,
6800         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6801         Output_merge_base::input_sections_): New data members.
6802         (Output_merge_data::do_set_keeps_input_sections): New method
6803         defintion.
6804         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6805         * output.cc (Output_section::Input_section::relobj): Move method
6806         defintion from class declaration to here and handle merge sections.
6807         (Output_section::Input_section::shndx): Ditto.
6808         (Output_section::Output_section): Remove initializations of removed
6809         data members and initialize new data member LOOKUP_MAPS_.
6810         (Output_section::add_input_section): Set keeps-input-sections flag
6811         for a newly created merge output section as appropriate.  Adjust code
6812         to use Output_section_lookup_maps class.
6813         (Output_section::add_relaxed_input_section): Adjst code for lookup
6814         maps code refactoring.
6815         (Output_section::add_merge_input_section): Add a new parameter
6816         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6817         class.  If adding input section to a newly created merge output
6818         section fails, remove the new merge section.
6819         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6820         Adjust code for use of the Output_section_lookup_maps class.
6821         (Output_section::find_merge_section): Ditto.
6822         (Output_section::build_lookup_maps): New method defintion.
6823         (Output_section::find_relaxed_input_section): Adjust code to use
6824         Output_section_lookup_maps class.
6825         (Output_section::get_input_sections): Export merge sections.  Adjust
6826         code to use Output_section_lookup_maps class.
6827         (Output_section:::add_script_input_section): Adjust code to use
6828         Output_section_lookup_maps class.  Update lookup maps for merge
6829         sections also.
6830         (Output_section::discard_states): Use Output_section_lookup_maps.
6831         (Output_section::restore_states): Same.
6832         * output.h (Merge_section_properties): Move class defintion out of
6833         Output_section.
6834         (Output_section_lookup_maps): New class.
6835         (Output_section::Input_section::is_merge_section): New method
6836         defintion.
6837         (Output_section::Input_section::relobj): Move defintion out of class
6838         defintion.  Declare method only.
6839         (Output_section::Input_section::shndx): Ditto.
6840         (Output_section::Input_section::output_merge_base): New method defintion.
6841         (Output_section::Input_section::u2_.pomb): New union field.
6842         (Output_section::Merge_section_by_properties_map,
6843         Output_section::Output_section_data_by_input_section_map,
6844         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6845         Remove types.
6846         (Output_section::add_merge_input_section): Add new parameter
6847         KEEPS_INPUT_SECTIONS.
6848         (Output_section::build_lookup_maps): New method declaration.
6849         (Output_section::merge_section_map_,
6850         Output_section::merge_section_by_properties_map_,
6851         Output_section::relaxed_input_section_map_,
6852         Output_section::is_relaxed_input_section_map_valid_): Remove data
6853         members.
6854         (Output_section::lookup_maps_): New data member.
6855
6856 2010-05-21  Doug Kwan  <dougkwan@google.com>
6857
6858         PR gold/11619
6859         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6860         avoid a compilation error.
6861
6862 2010-05-19  Rafael Espindola  <espindola@google.com>
6863
6864         * script-sections.cc (Output_section_definition::allocate_to_segment):
6865         Update the phdrs_list even when the output section is NULL.
6866         * testsuite/Makefile.am: Add test.
6867         * testsuite/Makefile.in: Regenerate.
6868         * testsuite/script_test_9.cc: New.
6869         * testsuite/script_test_9.sh: New.
6870         * testsuite/script_test_9.t: New.
6871
6872 2010-05-19  Doug Kwan  <dougkwan@google.com>
6873
6874         * arm.cc (Arm_input_section::original_size): New method.
6875         (Arm_input_section::do_addralign): Add a cast.
6876         (Arm_input_section::do_output_offset): Remove static cast.
6877         (Arm_input_section::original_addralign,
6878          Arm_input_section::original_size_): Change type to uint32_t.
6879         (Arm_input_section::init): Add safe casts for section alignment
6880         and size.
6881         (Arm_input_section::set_final_data_size): Do not set address and
6882         offset of stub table.
6883         (Arm_output_section::fix_exidx_coverage): Change use of of
6884         Output_section::Simple_input_section to that of
6885         Output_section::Input_section.
6886         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6887         except for the first pass.
6888         * output.cc (Output_section::get_input_sections): Change type of
6889         input_sections to std::list<Input_section>.
6890         (Output_section::add_script_input_section): Rename from
6891         Output_section::add_simple_input_section.  Change type of SIS
6892         parameter from Simple_input_section to Input_section.
6893         * output.h (Output_section::Simple_input_section): Remove class.
6894         (Output_section::Input_section): Change class visibility to public.
6895         (Output_section::Input_section::addralign): Use stored alignments
6896         for special input sections if set.
6897         (Output_section::Input_section::set_addralign): New method.
6898         (Output_section::get_input_sections): Change parameter type from
6899         list of Simple_input_section to list of Input_section.
6900         (Output_section::add_script_input_section): Rename from
6901         Output_section::add_simple_input_section. Change first parameter's
6902         type from Simple_input_section to Input_section and remove the
6903         second and third parameters.
6904         * script-sections.cc (Input_section::Input_section_list): Change
6905         type to list of Output_section::Input_section/
6906         (Input_section_info::Input_section_info): Change parameter type of
6907         INPUT_SECTION to Output_section::Input_section.
6908         (Input_section_info::input_section): Change return type.
6909         (Input_section_info::input_section_): Change type to
6910         Output_section::Input_section.
6911         (Output_section_element_input::set_section_addresses): Adjust code
6912         to use Output_section::Input_section instead of
6913         Output_section::Simple_input_section.  Adjust code for renaming
6914         of Output_section::add_simple_input_section.
6915         (Orphan_output_section::set_section_addresses): Ditto.
6916
6917 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6918
6919         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6920         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6921
6922 2010-05-18  Rafael Espindola  <espindola@google.com>
6923
6924         * options.cc (General_options::finalize): Handle -nostdlib.
6925         * options.h (nostdlib): New option.
6926         * script.cc (script_add_search_dir): Handle -nostdlib.
6927
6928 2010-05-12  Doug Kwan  <dougkwan@google.com>
6929
6930         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6931         attributes section only if there no attributes section after merging.
6932         (Target_arm::merge_object_attributes): Move value of
6933         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6934         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6935         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6936         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6937         and arm_attr_merge_7.stdout.
6938         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6939         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6940         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6941         arm_attr_merge_7b.o): New rules.
6942         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6943         arm_attr_merge_7
6944         * testsuite/Makefile.in: Regenerate.
6945         * testsuite/arm_attr_merge.sh: New file.
6946         * testsuite/arm_attr_merge_[67][ab].s: Same.
6947
6948 2010-05-05  Nick Clifton  <nickc@redhat.com>
6949
6950         * po/es.po: Updated Spanish translation.
6951
6952 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6953
6954         * Makefile.am (install-exec-local): Properly install gold as
6955         default cross linker.
6956         * Makefile.in: Regenerated.
6957
6958 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6959             Nick Clifton  <nickc@redhat.com>
6960
6961         * configure.ac (install_as_default): Define and set to false
6962         unless --enable-gold or --enable-gold=both/gold has been
6963         specified.
6964         * configure: Regenerate.
6965
6966         * Makefile.am (install-exec-local): Install the executable as
6967         'ld.gold'.  If install_as_default is true then also install it as
6968         'ld'.
6969         * Makefile.in: Regenerated.
6970
6971 2010-04-24  Ian Lance Taylor  <iant@google.com>
6972
6973         * layout.cc (Layout::layout_reloc): In relocatable link don't
6974         combine reloc sections for grouped sections.
6975
6976 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6977
6978         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6979         sections that are not ordinary to icf.
6980         * icf.cc (get_section_contents): Handle relocation pointing to section
6981         with no object or shndx information.
6982         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6983         * testsuite/Makefile.in: Regenerate.
6984         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6985         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6986
6987 2010-04-22  Ian Lance Taylor  <iant@google.com>
6988
6989         * expression.cc (Expression::Expression_eval_info): Add
6990         result_alignment_pointer field.
6991         (Expression::eval_with_dot): Add result_alignment_pointer
6992         parameter.  Change all callers.
6993         (Expression::eval_maybe_dot): Likewise.
6994         (class Binary_expression): Add alignment_pointer parameter to
6995         left_value and right_value.  Change all callers.
6996         (BINARY_EXPRESSION): Set result alignment.
6997         (class Trinary_expression): Add alignment_pointer parameter to
6998         arg2_value and arg3_value.  Change all callers.
6999         (Trinary_cond::value): Set result alignment.
7000         (Max_expression::value, Min_expression::value): Likewise.
7001         (Align_expression::value): Likewise.
7002         * script-sections.cc (class Sections_element): Add dot_alignment
7003         parameter to set_section_addresses virtual function.  Update
7004         instantiations.
7005         (class Output_section_element): Likewise.
7006         (Script_sections::create_segments): Add dot_alignment parameter.
7007         Change all callers.
7008         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7009         (Script_sections::set_phdrs_clause_addresses): Likewise.
7010         * script-sections.h: Update declarations.
7011         * script.h: Update declarations.
7012         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7013         min_p_align.
7014         * testsuite/script_test_3.t: Set large alignment.
7015         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7016         segment has expected alignment.
7017
7018 2010-04-22  Nick Clifton  <nickc@redhat.com>
7019
7020         * po/gold.pot: Updated by the Translation project.
7021         * po/vi.po: Updated Vietnamese translation.
7022
7023 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7024
7025         * testsuite/Makefile.am (check_PROGRAMS): Add
7026         icf_virtual_function_folding_test.
7027         * testsuite/Makefile.in: Regenerated.
7028
7029 2010-04-15  Andrew Haley  <aph@redhat.com>
7030
7031         * options.h (merge_exidx_entries): New option.
7032         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7033         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7034         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7035         (Target_arm::merge_exidx_entries): New function.
7036         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7037         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7038         to Arm_exidx_fixup constructor.
7039         Add new arg, merge_exidx_entries.
7040         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7041         Arm_output_section::fix_exidx_coverage.
7042
7043 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7044
7045         * icf.cc (get_section_contents): Check for preemptible functions.
7046         Ignore addend when appropriate.
7047         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7048         section folded.
7049         (add_from_relobj): Check for section folded.
7050         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7051         * symtab.h (should_add_dynsym_entry): Add new parameter.
7052         * target-reloc.h (scan_relocs): Check for section folded.
7053         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7054         Check reloc types for function pointers in shared objects.
7055         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7056         case.
7057         (icf_preemptible_functions_test): New test case.
7058         (icf_string_merge_test): New test case.
7059         * testsuite.Makefile.in: Regenerate.
7060         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7061         bar_glob.  Refactor code.
7062         * testsuite/icf_preemptible_functions_test.cc: New file.
7063         * testsuite/icf_preemptible_functions_test.sh: New file.
7064         * testsuite/icf_string_merge_test.cc: New file.
7065         * testsuite/icf_string_merge_test.sh: New file.
7066         * testsuite/icf_virtual_function_folding_test.cc: New file.
7067         * testsuite/icf_virtual_function_folding_test.sh: New file.
7068
7069 2010-04-14  Doug Kwan  <dougkwan@google.com>
7070
7071         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7072         for local symbol recounting if we remove a section due to ICF.
7073         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7074         there are no regular objects in input.
7075
7076 2010-04-13  Doug Kwan  <dougkwan@google.com>
7077
7078         * arm.cc (Arm_input_section::set_final_data_size): Compute
7079         accurate final data size instead of using current data size.
7080
7081 2010-04-09  Doug Kwan  <dougkwan@google.com>
7082
7083         * layout.cc (Layout::choose_output_section): Handle script section
7084         types.
7085         (Layout::make_output_section_for_script): Add section type parameter.
7086         Handle script section types.
7087         * layout.h (Layout::make_output_section_for_script): Add section
7088         type parameter.
7089         * output.cc (Output_section::Output_section): Initialize data member
7090         is_noload_.
7091         (Output_section::do_reset_address_and_file_offset): Do not set address
7092         to 0 if section is a NOLOAD section.
7093         * output.h (Output_section::is_noload): New method.
7094         (Output_section::set_is_noload): Ditto.
7095         (Output_section::is_noload_): New data member.
7096         * script-c.h (Script_section_type): New enum type.
7097         (struct Parser_output_section_header): Add new file section_type.
7098         * script-sections.cc (Sections_element::output_section_name): Add
7099         parameter for returning script section type.
7100         (Output_section_definition::output_section_name): Ditto.
7101         (Output_section_definition::section_type)P; New method.
7102         (Output_section_definiton::script_section_type_name): Ditto.
7103         (Output_section_definition::script_section_type_): New data member.
7104         (Output_section_definition::Output_section_definition): Initialize
7105         data member Output_section_definition::script_section_type_.
7106         (Output_section_definition::create_sections): Pass script section type
7107         to Layout::make_output_section_for_script.
7108         (Output_section_definition::output_section_name): Return script
7109         section type to caller.
7110         (Output_section_definition::set_section_address): Do not advance
7111         dot value and load address if section type is NOLOAD.  Set address
7112         of NOLOAD sections regardless of section flags.
7113         (Output_section_definition::print): Print section type if it is
7114         not SCRIPT_SECTION_TYPE_NONE.
7115         (Output_section_definition::section_type): New method.
7116         (Output_section_definition::script_section_type_name): Ditto.
7117         (Script_sections::output_section_name): Add new parameter
7118         PSECTION_TYPE for returning script section type.  Pass it to
7119         section elements.  Handle discard sections.
7120         (Sort_output_sections::operator()): Handle NOLOAD sections.
7121         * script-sections.h (Script_sections::Section_type): New enum type.
7122         (Script_sections::output_section_name): Add a new parameter for
7123         returning script section type.
7124         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7125         INFO and NOLOAD.
7126         * yyscript.y (union): Add new field SECTION_TYPE.
7127         (COPY, DSECT, INFO, NOLOAD): New tokens.
7128         (opt_address_and_section_type): Change type to output_section_header.
7129         (section_type): New non-terminal
7130         (section_header): Handle section type.
7131         (opt_address_and_section_type): Return section type value.
7132
7133 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7134
7135         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7136         * testsuite/plugin_common_test_2.c (foo): Likewise.
7137
7138 2010-04-08  Doug Kwan  <dougkwan@google.com>
7139
7140         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7141         Output_merge_data.
7142         * output.cc (Output_section::add_merge_input_section): Simplify
7143         code and return status of Output_merge_base::add_input_section.
7144         Update merge section map only if Output_merge_base::add_input_section
7145         returns true.
7146
7147 2010-04-07  Doug Kwan  <dougkwan@google.com>
7148
7149         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7150         if section is marked as containing instructions but has no mapping
7151         symbols.
7152         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7153         correct section index.
7154         (Arm_relobj::find_linked_text_section): Ditto.
7155
7156 2010-04-07  Cary Coutant  <ccoutant@google.com>
7157
7158         * archive.cc (include_member): Destroy Read_symbols_data object before
7159         releasing file.
7160         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7161         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7162         (Read_symbols_data::~Read_symbols_data) New destructor.
7163         (Section_relocs::Section_relocs) New constructor.
7164         (Section_relocs::~Section_relocs) New destructor.
7165         (Read_relocs_data::Read_relocs_data) New constructor.
7166         (Read_relocs_data::~Read_relocs_data) New destructor.
7167         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7168         pointers to NULL after deleting.
7169
7170 2010-04-07  Doug Kwan  <dougkwan@google.com>
7171
7172         * arm.cc: Replace "endianity" with "endianness" in comments.
7173         (Arm_exidx_cantunwind): Ditto.
7174         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7175         (Arm_relobj::merge_flags_and_attributes): New method.
7176         (Arm_relobj::merge_flags_and_attributes_): New data member.
7177         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7178         (Arm_relobj::scan_sections_for_stubs): Ditto.
7179         (Arm_relobj::do_read_symbols): Check to see if we really want to
7180         merge processor-specific flags and attributes.  Exit early if
7181         an object is empty except for section names and the undefined symbol.
7182         (Target_arm::do_finalize_sections): Move check for ELF format to
7183         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7184         attributes from a regular object only when we have determined that
7185         it is aapropriate.  Do not create an .ARM.attributes section in
7186         output if there is no regular input object.
7187         (Target_arm::merge_processor_specific_flags): Check
7188         --warn-mismatch before printing any error.
7189         (Target_arm::merge_object_attributes): Ditto.
7190         * gold.cc (queue_middle_tasks): Handle the case in which there is
7191         no regular object in input.
7192         * options.cc (General_options::parse_EB): New method.
7193         (General_options::parse_EL): Same.
7194         (General_options::General_options): Initialize endianness_.
7195         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7196         New options.
7197         (General_options::Endianness): New enum.
7198         (General_options::endianness): New method.
7199         (General_options::endianness_): New data member.
7200         * parameters.cc (Parameters::set_options): Check target endianness.
7201         (Parameters::set_target_once): Ditto.
7202         (Parameters::check_target_endianness): New method.
7203         (parameters_force_valid_target): If either -EL or -EB is specified,
7204         use it to define endianness of default target.
7205         * parameters.h (Parameters::check_target_endianness): New method
7206         declaration.
7207         * target.h (class Target): Change "endianity" to "endianness"
7208         in comments.
7209
7210 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7211
7212         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7213         * configure: Regenerate.
7214         * Makefile.in: Regenerate.
7215         * testsuite/Makefile.in: Regenerate.
7216
7217 2010-04-06  Cary Coutant  <ccoutant@google.com>
7218
7219         gcc PR lto/42757
7220         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7221         prevailing definitions of common symbols.
7222         * testsuite/plugin_test_6.sh: New test case.
7223         * testsuite/plugin_common_test_1.c: New test case.
7224         * testsuite/plugin_common_test_2.c: New test case.
7225         * testsuite/Makefile.am (plugin_test_6): New test case.
7226         * testsuite/Makefile.in: Regenerate.
7227
7228 2010-04-06  Nick Clifton  <nickc@redhat.com>
7229
7230         * po/vi.po: New Vietnamese translation.
7231
7232 2010-03-30  Doug Kwan  <dougkwan@google.com>
7233
7234         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7235
7236 2010-03-25  Doug Kwan  <dougkwan@google.com>
7237
7238         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7239         to avoid a conversion warning on a 32-bit host.
7240
7241 2010-03-24  Ian Lance Taylor  <iant@google.com>
7242
7243         * testsuite/script_test_3.t: Add a TLS segment.
7244         * testsuite/Makefile.am (check_PROGRAMS): Add
7245         tls_phdrs_script_test.
7246         (tls_phdrs_script_test_SOURCES): Define.
7247         (tls_phdrs_script_test_DEPENDENCIES): Define.
7248         (tls_phdrs_script_test_LDFLAGS): Define.
7249         (tls_phdrs_script_test_LDADD): Define.
7250         * testsuite/Makefile.in: Rebuild.
7251
7252 2010-03-23  Cary Coutant  <ccoutant@google.com>
7253
7254         * fileread.cc (find_or_make_view): Fix comment.
7255
7256 2010-03-23  Ian Lance Taylor  <iant@google.com>
7257
7258         * script-sections.cc (class Orphan_section_placement): Define
7259         PLACE_TLS and PLACE_TLS_BSS.
7260         (Orphan_section_placement::Orphan_section_placement): Initialize
7261         new places.
7262         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7263         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7264         (tls_script_test_SOURCES): Define.
7265         (tls_script_test_DEPENDENCIES): Define.
7266         (tls_script_test_LDFLAGS): Define.
7267         (tls_script_test_LDADD): Define.
7268         * testsuite/Makefile.in: Rebuild.
7269
7270 2010-03-22  Doug Kwan  <dougkwan@google.com>
7271
7272         * arm.cc (Arm_relocate_functions::abs8,
7273         Arm_relocate_functions::abs16): Use correct check for overflow
7274         specified in the ARM ELF specs.
7275         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7276         target of a BLX instruction specially.
7277         (Reloc_stub::stub_type_for_reloc): Ditto.
7278         (Relocate::relocate): Use symbolic names instead of numeric relocation
7279         codes to report error.
7280         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7281         workaround.
7282         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7283         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7284         thumb2_blx_out_of_range.stdout
7285         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7286         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7287         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7288         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7289         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7290         thumb2_blx_in_range, thumb2_blx_in_range.o,
7291         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7292         thumb2_blx_out_of_range.o): New rules.
7293         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7294         thumb2_blx_in_range and thumb2_blx_out_of_range.
7295         * testsuite/Makefile.in: Regenerate.
7296         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7297         * testsuite/thumb_blx_in_range.s: New file.
7298         * testsuite/thumb_blx_out_of_range.s: New file.
7299
7300 2010-03-22  Rafael Espindola  <espindola@google.com>
7301
7302         * archive.cc (Should_include): Move to archive.h.
7303         (should_include_member): Make it a member of Archive.
7304         (Lib_group): New.
7305         (Add_lib_group_symbols): New.
7306         * archive.h: Include options.h.
7307         (Archive_member): Moved from Archive.
7308         (Should_include): Moved from archive.cc.
7309         (Lib_group): New.
7310         (Add_lib_group_symbols): New.
7311         * dynobj.cc (do_should_include_member): New.
7312         * dynobj.h (do_should_include_member): New.
7313         * gold.cc (queue_initial_tasks): Update call to queue.
7314         * main.cc (main): Print lib group stats.
7315         * object.cc (do_should_include_member): New.
7316         * object.h: Include archive.h.
7317         (Object::should_include_member): New.
7318         (Object::do_should_include_member): New.
7319         (Sized_relobj::do_should_include_member): New.
7320         * options.cc (General_options::parse_start_lib): New.
7321         (General_options::parse_end_lib): New.
7322         (Input_arguments::add_file): Handle lib groups.
7323         (Input_arguments::start_group): Check we are not in a lib.
7324         (Input_arguments::start_lib): New.
7325         (Input_arguments::end_lib): New.
7326         * options.h (General_options): Add start_lib and end_lib.
7327         (Input_argument::lib_): New.
7328         (Input_argument::lib): New.
7329         (Input_argument::is_lib): New.
7330         (Input_file_lib): New.
7331         (Input_arguments::in_lib_): New.
7332         (Input_arguments::in_lib): New.
7333         (Input_arguments::start_lib): New.
7334         (Input_arguments::end_lib_): New.
7335         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7336         in unused members as preempted.
7337         (Sized_pluginobj::do_should_include_member): New.
7338         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7339         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7340         return the blocker.
7341         (Read_symbols::do_whole_lib_group): New.
7342         (Read_symbols::do_lib_group): New.
7343         (Read_symbols::do_read_symbols): Handle lib groups.
7344         (Read_symbols::get_name): Handle lib groups.
7345         * readsyms.h (Read_symbols): Add an archive member pointer.
7346         (Read_symbols::do_whole_lib_group): New.
7347         (Read_symbols::do_lib_group): New.
7348         (Read_symbols::member_): New.
7349         * script.cc (read_input_script): Update call to queue_soon.
7350
7351 2010-03-19  Doug Kwan  <dougkwan@google.com>
7352
7353         * arm.cc (Stub_table::Stub_table): Initialize new data members
7354         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7355         (Stub_table::add_reloc_stub): Assign stub offset and update
7356         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7357         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7358         New data members.
7359         (Stub_table::update_data_size_and_addralign): Use
7360         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7361         instead of going over all reloc stubs.
7362         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7363         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7364         Stringpool_template::offset_ to size of Stringpool_char.
7365         (Stringpool_template::new_key_offset): Remove code to initialize
7366         Stringpool_template::offset_.
7367         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7368         Stringpool_template::offset_ to zero.
7369
7370 2010-03-15  Doug Kwan  <dougkwan@google.com>
7371
7372         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7373         offset_.
7374         (Stringpool_template::new_key_offset): New method.
7375         (Stringpool_template::add_string): Assign offsets when adding new
7376         strings.
7377         (Stringpool_template::set_string_offsets): Do not set string offsets
7378         when not optimizing.
7379         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7380         member size_.
7381         (Chunked_vector::clear): Clear size_.
7382         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7383         (Chunked_vector::size): Return size_.
7384         (Chunked_vector::push_back): Use size_ to find insert position.
7385         (Chunked_vector::size_): New data member.
7386         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7387         (Stringpool_template::new_key_offset): New method declaration.
7388         (Stringpool_template::offset_): New data member.
7389
7390 2010-03-15   Rafael Espindola  <espindola@google.com>
7391
7392         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7393         Add_symbols' constructor.
7394         * readsyms.h (Add_symbols): Remove the input_group member.
7395
7396 2010-03-10  Ian Lance Taylor  <iant@google.com>
7397
7398         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7399         target to ask whether a reference to a symbol requires a stack
7400         split.
7401         * target.h (Target::is_call_to_non_split): New function.
7402         (Target::do_is_call_to_non_split): Declare virtual function.
7403         * target.cc: Include "symtab.h".
7404         (Target::do_is_call_to_non_split): New function.
7405         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7406
7407 2010-03-10  Cary Coutant  <ccoutant@google.com>
7408
7409         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7410         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7411         (File_read::open[2]): Add whole_file_view_ to list of views.
7412         (File_read::make_view): Remove test of whole_file_view_.
7413         (File_read::find_or_make_view): Create whole_file_view_ if
7414         necessary.
7415         (File_read::clear_views): Replace bool parameter with enum;
7416         adjust all callers.  Don't delete views with permanent data;
7417         do delete cached views and views from archives if
7418         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7419         if clearing the corresponding view.
7420         * fileread.h (File_read::Clear_views_mode): New enum.
7421         (File_read::View::is_permanent_view): New method.
7422         (File_read::clear_views): Replace bool parameter
7423         with enum; adjust all callers.
7424         * options.h (General_options): Change keep_files_mapped option;
7425         add map_whole_files.
7426         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7427         releasing the file.
7428         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7429         the file.
7430
7431 2010-03-10  David S. Miller  <davem@davemloft.net>
7432
7433         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7434
7435 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7436
7437         * icf.cc (get_section_contents): Add '@' marker after processing the
7438         merge reloc.
7439
7440 2010-03-08  Doug Kwan  <dougkwan@google.com>
7441
7442         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7443         due to a conversion warning.
7444         (Arm_relobj::update_output_local_symbol_count): Check for local
7445         symbol with unset output index.
7446
7447 2010-03-05  Ian Lance Taylor  <iant@google.com>
7448
7449         * options.h (class General_options): Add --spare-dynamic-tags.
7450         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7451         --spare-dynamic-tags.
7452
7453 2010-03-05  Ian Lance Taylor  <iant@google.com>
7454
7455         * incremental.cc: Include "libiberty.h".
7456
7457 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7458
7459         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7460         function, is_info_ member.
7461         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7462         (Versions::Versions): Update caller.
7463         (Versions::define_base_version): Likewise.
7464         (Versions::add_def): Likewise.
7465
7466 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7467
7468         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7469         (Scan::possible_function_pointer_reloc): New function.
7470         (Scan::local_reloc_may_be_function_pointer): Change to call
7471         possible_function_pointer_reloc.
7472         (Scan::global_reloc_may_be_function_pointer): Ditto.
7473         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7474         relocations in ".data.rel.ro._ZTV" section.
7475         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7476         * testsuite/icf_safe_so_test.cc: Ditto.
7477         * testsuite/icf_safe_test.cc: Ditto.
7478         * testsuite/icf_safe_test.sh: Ditto.
7479
7480 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7481             Ian Lance Taylor  <iant@google.com>
7482
7483         * target-reloc.h (relocate_section): Check the symbol table index
7484         for -1U before setting the local symbol index.
7485         (scan_relocatable_relocs): If copying the relocation, record that
7486         the local symbol is required.
7487         * object.h (Symbol_value::is_output_symtab_index_set): New
7488         function.
7489         (Symbol_value::may_be_discarded_from_output_symtab): New
7490         function.
7491         (Symbol_value::has_output_symtab_entry): New function.
7492         (Symbol_value::needs_output_symtab_entry): Remove.
7493         (Symbol_value::output_symtab_index): Make sure the symbol index is
7494         set.
7495         (Symbol_value::set_output_symtab_index): Make sure the symbol
7496         index is not set.  Make sure the new index is valid.
7497         (Symbol_value::set_must_have_output_symtab_entry): New function.
7498         (Symbol_value::has_output_dynsym_entry): New function.
7499         (Symbol_value::set_output_dynsym_index): Make sure the new index
7500         is valid.
7501         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7502         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7503         local symbol if permitted.
7504         (Sized_relobj::do_finalize_local_symbols): Call
7505         is_output_symtab_index_set rather than needs_output_symtab_entry.
7506         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7507         rather than needs_output_symtab_entry.  Call
7508         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7509         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7510         is_output_symtab_index_set rather than needs_output_symtab_entry.
7511         * testsuite/discard_locals_relocatable_test.c: New file.
7512         * testsuite/discard_locals_test.sh: Test -r.
7513         * testsuite/Makefile.am (check_DATA): Add
7514         discard_locals_relocatable_test1.syms,
7515         discard_local_relocatable_test2.syms.
7516         (MOSTLYCLEANFILES): Likewise.  Also add
7517         discard_locals_relocatable_test1.lout and
7518         discard_locals_relocatable_test2.out.
7519         (discard_locals_relocatable_test1.syms): New target.
7520         (discard_locals_relocatable_test.o): New target.
7521         (discard_locals_relocatable_test1.out): New target.
7522         (discard_locals_relocatable_test2.syms): New target.
7523         (discard_locals_relocatable_test2.out): New target.
7524         (various): Add missing ../ld-new dependencies.
7525         * testsuite/Makefile.in: Rebuild.
7526
7527 2010-03-03  Nick Clifton  <nickc@redhat.com>
7528
7529         * po/fi.po: New Finnish translation.
7530
7531 2010-03-01  Doug Kwan  <dougkwan@google.com>
7532
7533         * layout.cc (Layout::Layout): Force section types of .init_array*,
7534         .preinit_array* and .fini_array* sections.
7535         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7536         Fix check of return value of std::string::find.().
7537         (Output_section::Input_section_sort_compare::operator()): Remove
7538         comment about .init_array.
7539         (Output_section::Input_section_sort_init_fini_compare::operator()):
7540         New method.
7541         (Output_section::sort_attached_input_sections): Handle .init_array
7542         and .fini_array specially.
7543         * output.h (Output_section::Inut_section_sort_compare): Update
7544         comment.
7545         (Output_section::Input_section_sort_init_fini_compare): New struct.
7546
7547 2010-02-26  Doug Kwan  <dougkwan@google.com>
7548
7549         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7550         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7551         * testsuite/debug_msg.sh: Avoid matching source line number for
7552         use of global variable undef_int.
7553
7554 2010-02-26  Doug Kwan  <dougkwan@google.com>
7555
7556         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7557         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7558         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7559         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7560         * options.cc (General_options::General_options): Initialize member
7561         fix_v4bx_.
7562         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7563         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7564         and rm_no_fix_v4bx.stdout
7565         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7566         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7567         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7568         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7569         and arm_no_fix_v4bx.
7570         * Makefile.in: Regenerate.
7571         * testsuite/arm_fix_v4bx.s: New file.
7572         * testsuite/arm_fix_v4bx.sh: Ditto.
7573
7574 2010-02-24  Doug Kwan  <dougkwan@google.com>
7575
7576         * arm.cc (Target_arm::got_section): Make the .got section the first
7577         non RELRO section in the data segment.
7578         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7579         suffixes of section names.
7580
7581 2010-02-24  Doug Kwan  <dougkwan@google.com>
7582
7583         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7584         flags and attributes merging if an input file is a binary file.
7585         * fileread.cc (Input_file::open): Record format of original file.
7586         * fileread.h (Input_file::Format): New enum type.
7587         (Input_file::Input_file): Initialize data member format_.
7588         (Input_file::format): New method definition.
7589         (Input_file::format_):: New data member.
7590
7591 2010-02-24  Doug Kwan  <dougkwan@google.com>
7592
7593         * arm.cc (Arm_output_data_got): New class.
7594         (ARM_TCB_SIZE): New constant
7595         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7596         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7597         If user uses a script with a SECTIONS clause, issue only a warning
7598         for a misplaced EXIDX input section.  Otherwise, issue an error.
7599         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7600         garbage collection.
7601         (Target_arm::got_mode_index_entry): Handle static linking.
7602         (Target_arm::Scan::local): Ditto.
7603         (Target_arm::Scan::global): Ditto.
7604         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7605         all incorrectly implemented relocations.
7606         (Target_arm::fix_exidx_coverage): Pass layout to
7607         Arm_output_section::fix_exidx_coverage.
7608         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7609         from ".ARM.exidx." and ".ARM.extab.".
7610
7611 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7612
7613         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7614         section if it does not already exist.
7615         * attributes.cc (Attributes_section_data::Attributes_section_data):
7616         Don't crash if size is zero.
7617
7618 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7619             Ian Lance Taylor  <iant@google.com>
7620
7621         * gold.cc (queue_middle_tasks): If no input files were opened,
7622         exit.
7623         * workqueue.h (Task_function::Task_function): Assert that there is
7624         a blocker.
7625
7626 2010-02-22  Doug Kwan  <dougkwan@google.com>
7627
7628         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7629         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7630         types to avoid warnings due to different uint64_t implementations
7631         on different hosts.
7632
7633 2010-02-21  Doug Kwan  <dougkwan@google.com>
7634
7635         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7636         handling of the maximum backward branch offset.
7637         (Arm_relocate_functions::thumb_branch_common): Ditto.
7638         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7639         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7640         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7641         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7642         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7643         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7644         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7645         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7646         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7647         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7648         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7649         thumb2_bl_out_of_range.o): New rules.
7650         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7651         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7652         thumb2_bl_out_of_range
7653         * testsuite/Makefile.in: Regenerate.
7654         * testsuite/arm_bl_in_range.s: New file.
7655         * testsuite/arm_bl_out_of_range.s: Ditto.
7656         * testsuite/arm_branch_in_range.sh: Ditto.
7657         * testsuite/arm_branch_range.t: Ditto.
7658         * testsuite/thumb2_branch_range.t: Ditto.
7659         * testsuite/thumb_bl_in_range.s: Ditto.
7660         * testsuite/thumb_bl_out_of_range.s: Ditto.
7661         * testsuite/thumb_branch_range.t: Ditto.
7662
7663 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7664
7665         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7666         Add reloc offset information.
7667         * icf.cc (get_section_contents): Change iterators to point to the new
7668         vectors. Add reloc offset information to the contents.
7669         * icf.h (Icf::Sections_reachable_info): New typedef.
7670         (Icf::Sections_reachable_list): New typedef.
7671         (Icf::Offset_info): New typedef.
7672         (Icf::Reloc_info): New struct typedef.
7673         (Icf::Reloc_info_list): New typedef.
7674         (Icf::symbol_reloc_list): Delete method.
7675         (Icf::addend_reloc_list): Delete method.
7676         (Icf::section_reloc_list): Delete method.
7677         (Icf::reloc_info_list): New method.
7678         (Icf::reloc_info_list_): New member.
7679
7680 2010-02-19  Doug Kwan  <dougkwan@google.com>
7681
7682         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7683         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7684         * arm.cc (Arm_relocation_functions): New forward declaration.
7685         (Target_arm::Target_arm): Initialize new data members
7686         got_mod_index_offset_ and tls_base_symbol_defined_.
7687         (Target_arm::Relocate::relocate_tls): New method.
7688         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7689          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7690         New methods.
7691         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7692         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7693         (Target_arm::got_mod_index_offset_,
7694         Target_arm::tls_base_symbol_defined_): New data members.
7695         (Target_arm::Scan::local, Target::Scan::global,
7696         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7697         relocations.
7698
7699 2010-02-18  Doug Kwan  <dougkwan@google.com>
7700
7701         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7702         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7703         text section as a parameter becuase some broken tools may not set
7704         the link in section header.
7705         (Target_arm::has_got_section): New method.
7706         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7707         without any mapping symbol as data only.  Remove warning.
7708         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7709         link in its section header, try to discover the link by inspecting the
7710         REL31 relocation at the beginning of the section.
7711         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7712         in error message.
7713         (Target_arm::Scan::global): Treat any reference to the symbol
7714         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7715
7716 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7717
7718         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7719         (Scan::global_reloc_may_be_function_pointer): New function.
7720         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7721         (Scan::global_reloc_may_be_function_pointer): New function.
7722         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7723         (Scan::global_reloc_may_be_function_pointer): New function.
7724         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7725         (Scan::global_reloc_may_be_function_pointer): New function.
7726         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7727         (Scan::global_reloc_may_be_function_pointer): New function.
7728         (Scan::possible_function_pointer_reloc): New function.
7729         (Target_x86_64::can_check_for_function_pointers): New function.
7730         * gc.h (gc_process_relocs): Scan relocation types to determine if
7731         function pointers were taken for targets that support it.
7732         * icf.cc (Icf::find_identical_sections): Include functions for
7733         folding in safe ICF whose pointer is not taken.
7734         * icf.h (Secn_fptr_taken_set): New typedef.
7735         (fptr_section_id_): New member.
7736         (section_has_function_pointers): New function.
7737         (set_section_has_function_pointers): New function.
7738         (check_section_for_function_pointers): New function.
7739         * options.h: Fix comment for safe ICF option.
7740         * target.h (can_check_for_function_pointers): New function.
7741         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7742         Modify icf_safe_test for X86-64.
7743         * testsuite/Makefile.in: Regenerate.
7744         * testsuite/icf_safe_so_test.cc: New file.
7745         * testsuite/icf_safe_so_test.sh: New file.
7746         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7747         (main): Change to take pointer to function kept_func_3.
7748         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7749         folding is done correctly for X86-64.
7750
7751 2010-02-12  David S. Miller  <davem@davemloft.net>
7752
7753         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7754         is_symbolless parameter.
7755         (Output_reloc<SHT_REL>::is_symbolless): New.
7756         (Output_reloc<SHT_REL>::is_symbolless_): New.
7757         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7758         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7759         (Output_reloc<SHT_RELA>::is_symbolless): New.
7760         (Output_data_reloc::add_global): Handle is_symbolless.
7761         (Output_data_reloc::add_global_relative): Likewise.
7762         (Output_data_reloc::add_local): Likewise.
7763         (Output_data_reloc::add_local_relative): Likewise.
7764         (Output_data_reloc::add_symbolless_global_addend): New.
7765         (Output_data_reloc::add_symbolless_local_addend): New.
7766         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7767         is_symbolless.
7768         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7769         instead of ->is_relative_
7770         (Output_reloc::write): Likewise.
7771         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7772         (Output_reloc::write_rel): Simplify.
7773
7774         * sparc.cc (Target_sparc::Scan::local): Use
7775         ->add_symbolless_local_addend as needed.
7776         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7777         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7778         based upon relocation offset.
7779
7780 2010-02-11  Doug Kwan  <dougkwan@google.com>
7781
7782         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7783         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7784         beginning of function.
7785         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7786         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7787         parameter is_32bit in calls to should_apply_static_reloc.
7788         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7789         (check_DATA): Add arm_abs_global.stdout.
7790         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7791         arm_abs_global.stdout): New rules.
7792         (MOSTLLYCLEANFILES): Add arm_abs_global
7793         * Makefile.in: Regenerate.
7794         * testsuite/arm_abs_global.s: New file.
7795         * testsuite/arm_abs_global.sh: Ditto.
7796         * testsuite/arm_abs_lib.s: Ditto.
7797
7798 2010-02-11  Ian Lance Taylor  <iant@google.com>
7799
7800         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7801         Read_relocs task.
7802         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7803         Allocate_commons_task first.
7804         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7805         task, rather than symtab_lock_.
7806         (Gc_process_relocs::~Gc_process_relocs): New function.
7807         (Gc_process_relocs::is_runnable): Check this_blocker_.
7808         (Gc_process_relocs::locks): Use next_blocker_ rather than
7809         blocker_.
7810         (Scan_relocs::~Scan_relocs): New function.
7811         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7812         symtab_lock_.
7813         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7814         next_blocker_.
7815         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7816         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7817         constructor accordingly.
7818         (class Gc_process_relocs): Likewise.
7819         (class Scan_relocs): Likewise.
7820         * common.h (class Allocate_commons_task): Remove symtab_lock_
7821         field, and corresponding constructor parameter.
7822         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7823         symtab_lock_.
7824         (Allocate_commons_task::locks): Likewise.
7825
7826 2010-02-11  Ian Lance Taylor  <iant@google.com>
7827
7828         * gold-threads.h (class Once): Define.
7829         (class Initialize_lock): Rewrite as child of Once.
7830         * gold-threads.cc (class Once_initialize): Define.
7831         (once_pointer_control): New static variable.
7832         (once_pointer, once_arg): New static variables.
7833         (c_run_once): New static function.
7834         (Once::Once, Once::run_once, Once::internal_run): New functions.
7835         (class Initialize_lock_once): Remove.
7836         (initialize_lock_control): Remove.
7837         (initialize_lock_pointer): Remove.
7838         (initialize_lock_once): Remove.
7839         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7840         (Initialize_lock::initialize): Rewrite.
7841         (Initialize_lock::do_run_once): New function.
7842         * archive.cc (Archive::interpret_header): Only clear name if it is
7843         not already empty.
7844         * fileread.cc: Include "gold-threads.h"
7845         (file_counts_lock): New static variable.
7846         (file_counts_initialize_lock): Likewise.
7847         (File_read::release): Only increment counts when using --stats.
7848         Use a lock around the increment.
7849         * parameters.cc (class Set_parameters_target_once): Define.
7850         (set_parameters_target_once): New static variable.
7851         (Parameters::Parameters): Move here from parameters.h.
7852         (Parameters::set_target): Rewrite.
7853         (Parameters::set_target_once): New function.
7854         (Parameters::clear_target): Move here and rewrite.
7855         * parameters.h (class Parameters): Update declarations.  Add
7856         set_parameters_target_once_ field.
7857         (Parameters::Parameters): Move to parameters.cc.
7858         (Parameters::clear_target): Likewise.
7859         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7860         task.
7861         (Start_group::~Start_group): New function.
7862         (Start_group::is_runnable): New function.
7863         (Start_group::locks, Start_group::run): New functions.
7864         (Finish_group::run): Change saw_undefined to size_t.
7865         * readsyms.h (class Start_group): Define.
7866         (class Finish_group): Change saw_undefined_ field to size_t.
7867         (Finish_group::Finish_group): Remove saw_undefined and
7868         this_blocker parameters.  Change all callers.
7869         (Finish_group::set_saw_undefined): New function.
7870         (Finish_group::set_blocker): New function.
7871         * symtab.h (class Symbol_table): Change saw_undefined to return
7872         size_t.  Change saw_undefined_ field to size_t.
7873         * target-select.cc (Set_target_once::do_run_once): New function.
7874         (Target_selector::Target_selector): Initialize set_target_once_
7875         field.  Don't initialize lock_ and initialize_lock_ fields.
7876         (Target_selector::instantiate_target): Rewrite.
7877         (Target_selector::set_target): New function.
7878         * target-select.h (class Set_target_once): Define.
7879         (class Target_selector): Update declarations.  Make
7880         Set_target_once a friend.  Remove lock_ and initialize_lock_
7881         fields.  Add set_target_once_ field.
7882
7883 2010-02-10  Ian Lance Taylor  <iant@google.com>
7884
7885         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7886         queueing any tasks.
7887         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7888         (queue_middle_tasks): Add all blockers before queueing any tasks.
7889         (queue_final_tasks): Likewise.
7890         * token.h (Task_token::add_blockers): New function.
7891         * object.h (Input_objects::number_of_relobjs): New function.
7892
7893 2010-02-10  Ian Lance Taylor  <iant@google.com>
7894
7895         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7896         shared, not if not position independent.
7897         * x86_64.cc (Relocate::relocate_tls): Likewise.
7898         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7899         (tls_pie_pic_test): New target.
7900         * testsuite/Makefile.in: Rebuild.
7901
7902         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7903         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7904         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7905         * testsuite/Makefile.in: Rebuild.
7906
7907 2010-02-09  David S. Miller  <davem@davemloft.net>
7908
7909         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7910         R_SPARC_RELATIVE using ->add_local_relative().
7911         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7912
7913         * output.h (Output_data_dynamic::add_section_size): New method
7914         that takes two Output_data objects.
7915         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7916         entry param.  Handle it in initializers.
7917         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7918         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7919         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7920         arg.
7921         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7922         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7923         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7924         for dynrel_includes_plt.
7925         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7926         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7927         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7928         before .rela.plt
7929         (Target_sparc::do_finalize_sections): Update to pass true for
7930         dynrel_includes_plt.
7931         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7932         output before .rela.plt
7933         (Target_powerpc::do_finalize_sections): Update to pass true for
7934         dynrel_includes_plt when 32-bit.
7935
7936 2010-02-08  Doug Kwan  <dougkwan@google.com>
7937
7938         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7939         method.
7940         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7941         Arm_relobj::scan_section_for_cortex_a8_stubs,
7942         Arm_relobj::do_relocation_section): Instead of calling
7943         Output_section::output_address, use faster
7944         Arm_relobj::simple_input_section_output_address.
7945
7946 2010-02-08  David S. Miller  <davem@davemloft.net>
7947
7948         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7949         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7950         relocation helper function.
7951
7952         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7953         just like R_SPARC_GOT{10,13,22}.
7954         (Target_sparc::Scan::local): Likewise.
7955         (Target_sparc::Relocate:relocate): Likewise.
7956
7957 2010-02-06  Ian Lance Taylor  <iant@google.com>
7958
7959         * configure.ac: Rewrite targetobjs duplicate removal code to use
7960         only shell constructs.
7961         * configure: Rebuild.
7962
7963 2010-02-05  Doug Kwan  <dougkwan@google.com>
7964
7965         PR 11247
7966         * arm.cc (Arm_relobj::section_is_scannable): New method.
7967         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7968         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7969
7970 2010-02-04  Doug Kwan  <dougkwan@google.com>
7971
7972         PR 11247
7973         * arm-reloc-property.cc (cstdio): Include.
7974         * configure.ac (targetobjs): Remove duplicates.
7975         * configure: Regenerate.
7976         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7977         big and little endian version for a given address size.
7978
7979 2010-02-03  Doug Kwan  <dougkwan@google.com>
7980
7981         * arm-reloc-property.cc
7982         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7983         definition.
7984         * arm-reloc-property.h
7985         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7986         New method definition.
7987         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7988         declaration.
7989         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7990         overflow to N.
7991         (GOT_PREL): Change implemented to Y.
7992         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7993         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7994         (Arm_relocate_functions::movw_abs_nc): Remove method.
7995         (Arm_relocate_functions::movt_abs): Ditto.
7996         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7997         (Arm_relocate_functions::thm_movt_abs): Ditto.
7998         (Arm_relocate_functions::movw_rel_nc): Ditto.
7999         (Arm_relocate_functions::movw_rel): Ditto.
8000         (Arm_relocate_functions::movt_rel): Ditto.
8001         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8002         (Arm_relocate_functions:thm_movw_rel): Ditto.
8003         (Arm_relocate_functions:thm_movt_rel): Ditto.
8004         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8005         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8006         New method definitions.
8007         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8008         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8009         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8010         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8011         (Target_arm::Relocate::relocate): Check for non-static or
8012         unimplemented relocation code and exit early.  Change calls to
8013         Target_arm::reloc_uses_thumb_bit and
8014         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8015         instead.  Refactor code to handle similar relocations to increase
8016         code sharing.  Remove check for unsupported relocation code in switch
8017         statement.
8018         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8019         relocation property table to find out size.  Change error message to
8020         print out the name of a relocation code instead of the numeric value.
8021         (Target_arm::scan_reloc_for_stub): Use relocation property table
8022         instead of calling Target_arm::reloc_uses_thumb_bit().
8023
8024 2010-02-02  Doug Kwan  <dougkwan@google.com>
8025
8026         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8027         types of relaxed input section.
8028
8029 2010-02-02  Doug Kwan  <dougkwan@google.com>
8030
8031         * Makefile.am (HFILES): Add arm-reloc-property.h.
8032         (DEFFILES): New.
8033         (TARGETSOURCES): Add arm-reloc-property.cc
8034         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8035         (libgold_a_SOURCES): $(DEFFILES)
8036         * Makefile.in: Regenerate.
8037         * arm-reloc-property.cc: New file.
8038         * arm-reloc-property.h: New file.
8039         * arm-reloc.def: New file.
8040         * arm.cc: Update comments.
8041         (arm-reloc-property.h): New included header.
8042         (arm_reloc_property_table): New global variable.
8043         (Target_arm::do_select_as_default_target): New method definition.
8044         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8045         arm-reloc-property to targ_extra_obj.
8046         * parameters.cc (set_parameters_target): Call
8047         Target::select_as_default_target().
8048         * target.h (Target::select_as_default_target): New method definition.
8049         (Target::do_select_as_default_target): Same.
8050
8051 2010-02-01  Doug Kwan  <dougkwan@google.com>
8052
8053         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8054         first_output_text_section_.
8055         (Arm_exidx_fixup::first_output_text_section): New method definition.
8056         (Arm_exidx_fixup::first_output_text_section_): New data member.
8057         (Arm_exidx_fixup::process_exidx_section): Record the first text
8058         output section seen.
8059         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8060         and entsize in output section header.
8061
8062 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8063
8064         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8065         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8066         (Arm_relocate_functions::thm_alu11): New Method.
8067         (Arm_relocate_functions::thm_pc8): New Method.
8068         (Arm_relocate_functions::thm_pc12): New Method.
8069         (Target_arm::Scan::local): Handle the relocations.
8070         (Target_arm::Scan::global): Likewise.
8071         (Target_arm::Relocate::relocate): Likewise.
8072         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8073
8074 2010-01-29  Doug Kwan  <dougkwan@google.com>
8075
8076         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8077         of relocation types as ld.
8078
8079 2010-01-29  Doug Kwan  <dougkwan@google.com>
8080
8081         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8082         to public.
8083         (Arm_relocate_functions::thumb_branch_common): Ditto.
8084         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8085         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8086         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8087         Arm_relocate_functions::jump24): Remove.
8088         (Target_arm::Relocate::relocate): Adjust code to call
8089         Arm_relocation_functions::arm_branch_common and
8090         Arm_relocation_functions::thumb_branch_common instead of their removed
8091         wrappers.  Merge switch-cases together to reduce source code size.
8092
8093 2010-01-29  Doug Kwan  <dougkwan@google.com>
8094
8095         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8096         output_local_symbol_count_needs_update_.
8097         (Arm_relobj::output_local_symbol_count_needs_update,
8098          Arm_relobj::set_output_local_symbol_count_needs_update,
8099          Arm_relobj::update_output_local_symbol_count): New methods.
8100         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8101         member.
8102         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8103         of pointed function as in a R_ARM_PREL31 relocation.
8104         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8105         for output local symbol count updating.
8106         (Target_arm::do_relax): Update output local symbol counts in objects
8107         if necessary.
8108         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8109
8110 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8111
8112         * arm.cc: Added support for the ARM relocations:
8113         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8114         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8115         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8116         movw_prel_nc).
8117         (Arm_relocate_functions::movw_rel): New method.
8118         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8119         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8120         thm_movw_prel_nc).
8121         (Arm_relocate_functions::thm_movw_rel): New method.
8122         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8123         thm_movt_prel).
8124         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8125         relocations.
8126         (Target_arm::Scan::global): Likewise.
8127         (Target_arm::Relocate::relocate): Likewise.
8128         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8129         Likewise.
8130
8131 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8132
8133         * arm.cc: Added support for ARM group relocations.
8134         (Target_arm::reloc_needs_sym_origin): New method.
8135         (Arm_relocate_functions::calc_grp_kn): New method.
8136         (Arm_relocate_functions::calc_grp_residual): New method.
8137         (Arm_relocate_functions::calc_grp_gn): New method.
8138         (Arm_relocate_functions::arm_grp_alu): New Method.
8139         (Arm_relocate_functions::arm_grp_ldr): New Method.
8140         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8141         (Arm_relocate_functions::arm_grp_ldc): New Method.
8142         (Target_arm::Scan::local): Handle the ARM group relocations.
8143         (Target_arm::Scan::global): Likewise.
8144         (Target_arm::Relocate::relocate): Likewise.
8145         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8146         Likewise.
8147
8148 2010-01-26  Doug Kwan  <dougkwan@google.com>
8149
8150         * arm.cc (set): Include.
8151         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8152         pointer type.
8153         (Arm_output_section::Text_section_list): New type.
8154         (Arm_output_section::append_text_sections_to_list): New method.
8155         (Arm_output_section::fix_exidx_coverage): Ditto.
8156         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8157         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8158         Relobj::set_section_offset() instead of
8159         Sized_relobj::invalidate_section_offset().
8160         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8161         parameter for section headers. Ignore relocation sections for
8162         unallocated sections and EXIDX sections.
8163         (Target_arm::fix_exidx_coverage): New method.
8164         (Target_arm::output_section_address_less_than): New type.
8165         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8166         linked text section instead of the EXIDX section.
8167         (Arm_output_section::create_stub_group): Add an assertion to check
8168         that this is not an EXIDX output section.
8169         (Arm_output_section::append_text_sections_to_list): New method.
8170         (Arm_output_section::fix_exidx_coverage): Ditto.
8171         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8172         Arm_relobj::section_needs_reloc_stub_scanning.
8173         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8174         first pass.
8175         (Target_arm::fix_exidx_coverage): New method.
8176         * object.h (Relobj::set_output_section): New method.
8177         (Sized_relobj::invalidate_section_offset): Remove method.
8178         (Sized_relobj::do_invalidate_section_offset): Remove method.
8179         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8180
8181 2010-01-25  Doug Kwan  <dougkwan@google.com>
8182
8183         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8184         Fix warning due to signed and unsigned comparison on a 32-bit host.
8185
8186 2010-01-22  Doug Kwan  <dougkwan@google.com>
8187
8188         * arm.cc (Target_arm::do_relax): Record an output section for section
8189         offset adjustment it contains any stub table that has changed.
8190         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8191         offsets in an output section if necessary.
8192         * output.cc (Output_section::Output_section): Initialize
8193         section_offsets_need_adjustments_.
8194         (Output_section::add_input_section_for_script): Renamed to
8195         Output_section::add_simple_input_section.
8196         (Output_section::save_states): Add a comment.
8197         (Output_section::discard_states): New method defintion.
8198         (Output_section::adjust_section_offsets): Same.
8199         * output.h (Output_section::add_input_section_for_script): Renamed to
8200         Output_section::add_simple_input_section.
8201         (Output_section::discard_states): New method declaration.
8202         (Output_section::adjust_section_offsets): Same.
8203         (Output_section::section_offsets_need_adjustment,
8204         Output_section::set_section_offsets_need_adjustment): New method
8205         definitions.
8206         (Output_section::section_offsets_need_adjustment_): New data member.
8207         * script-sections.cc
8208         (Output_section_element_input::set_section_address): Adjust code for
8209         renaming of Output_section::add_input_section_for_script.
8210         (Orphan_output_section::set_section_address): Same.
8211
8212 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8213
8214         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8215         Fix_v4bx enum values .
8216         * gold/options.h (General_options): New option definitions.
8217         (General_options::fix_v4bx): New method.
8218         (General_options::Fix_v4bx): New enum.
8219         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8220         (General_options::parse_fix_v4bx_interworking): New method.
8221
8222 2010-01-22  Doug Kwan  <dougkwan@google.com>
8223
8224         * arm.cc (Arm_exidx_fixup): New class.
8225
8226 2010-01-21  Doug Kwan  <dougkwan@google.com>
8227
8228         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8229         classes.
8230         (Arm_exidx_section_offset_map): New type.
8231
8232 2010-01-21  Doug Kwan  <dougkwan@google.com>
8233
8234         * arm.cc (Arm_exidx_input_section): New class.
8235         (Arm_relobj::exidx_input_section_by_link,
8236         Arm_relobj::exidx_input_section_by_shndx,
8237         Arm_relobj::make_exidx_input_section): New methods.
8238         (read_arm_attributes_section): Remove.
8239         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8240         information about them.
8241         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8242         to here.
8243
8244 2010-01-20  Doug Kwan  <dougkwan@google.com>
8245
8246         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8247         Input_section_specifier to Section_id.
8248         (Target_arm::new_arm_input_section: Adjust code for change of key
8249         type.
8250         (Target_arm::find_arm_input_section): Ditto.
8251         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8252         (Section_id): Remove.
8253         (Garbage_collection::Section_id_hash): Remove.
8254         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8255         (Section_id): Remove.
8256         (Icf::Section_id_hash): Remove.
8257         * object.h (Section_id, Const_section_id, Section_id_hash,
8258         Const_section_id_hash): New type definitions.
8259         * output.cc (Output_section::add_relaxed_input_section): Change to
8260         use Const_section_id instead of Input_section_specifier as key type.
8261         (Output_section::add_merge_input_section): Ditto.
8262         (Output_section::build_relaxation_map): Change to use Section_id
8263         instead of Input_section_specifier as key type.
8264         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8265         Ditto.
8266         (Output_section::convert_input_sections_to_relaxed_sections): Change
8267         to use Const_section_id instead of Input_section_specifier as key type.
8268         (Output_section::find_merge_section): Ditto.
8269         (Output_section::find_relaxed_input_section): Ditto.
8270         * output.h (Input_section_specifier): Remove class.
8271         (Output_section::Output_section_data_by_input_section_map): Change
8272         key type to Const_section_id.
8273         (Output_section::Output_relaxed_input_section_by_input_section_map):
8274         Ditto.
8275         (Output_section::Relaxation_map): Change key type to Section_id.
8276
8277 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8278
8279         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8280         (class Arm_v4bx_stub): New class.
8281         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8282         (Stub_factory::make_arm_v4bx_stub): New method.
8283         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8284         (Stub_table::empty): Handle v4bx stubs.
8285         (Stub_table::add_arm_v4bx_stub): New method.
8286         (Stub_table::find_arm_v4bx_stub): New method.
8287         (Arm_relocate_functions::v4bx): New method.
8288         (Target_arm::fix_v4bx): New method.
8289         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8290         (Stub_table::relocate_stubs): Likewise.
8291         (Stub_table::do_write): Likewise.
8292         (Stub_table::update_data_size_and_addralign): Likewise.
8293         (Stub_table::finalize_stubs):  Likewise.
8294         (Target_arm::Scan::local): Likewise.
8295         (Target_arm::Scan::global): Likewise.
8296         (Target_arm::do_finalize_sections): Likewise.
8297         (Target_arm::Relocate::relocate): Likewise.
8298         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8299         Likewise.
8300         (Target_arm::scan_reloc_for_stub): Likewise.
8301         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8302
8303 2010-01-19  Ian Lance Taylor  <iant@google.com>
8304
8305         * output.cc (Output_section_headers::do_sized_write): Write large
8306         segment count to sh_info field.
8307         (Output_file_header::do_sized_write): For large segment count,
8308         write PN_XNUM to e_phnum field.
8309
8310 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8311
8312         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8313         (Arm_relocate_functions::thm_jump8): New function.
8314         (Arm_relocate_functions::thm_jump11): New function.
8315         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8316         R_ARM_THM_JUMP11.
8317         (Target_arm::Scan::global): Likewise.
8318         (Target_arm::Relocate::relocate): Likewise.
8319         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8320         Likewise.
8321
8322 2010-01-14  Doug Kwan  <dougkwan@google.com>
8323
8324         * arm.cc (map, utility): Include headers.
8325         (Target_arm::apply_cortex_a8_workaround): New method.
8326         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8327         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8328         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8329         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8330         the --[no-]fix-cortex-a8 command line options.
8331         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8332         (Target_arm::relocate_stub): Use addend in instruction template.
8333         * options.h (DEFINE_bool): Set the user-set flag.
8334         (General_options): Add --[no-]-fix-cortex options.
8335         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8336         : Update fast look-up map after conversion.
8337
8338 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8339
8340         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8341         in the first pass of do_layout.
8342
8343 2010-01-13  Doug Kwan  <dougkwan@google.com>
8344
8345         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8346         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8347         apparent compiler problem of not folding static constant integral
8348         data members of elfcpp::Elf_sizes<32>.
8349
8350 2010-01-13  Doug Kwan  <dougkwan@google.com>
8351
8352         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8353         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8354         Arm_relobj::scan_section_for_cortex_a8_erratum,
8355         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8356         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8357         sections to scan for relocation stubs into a new method
8358         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8359         relocation and Cortex-A8 stub scanning.
8360         (Target_arm::do_relax): Force stubs to be after stubbed sections
8361         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8362         the beginning of a new relaxation pass.  Update a comment.
8363         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8364
8365 2010-01-12  Ian Lance Taylor  <iant@google.com>
8366
8367         * target-reloc.h (visibility_error): New inline function.
8368         (relocate_section): Call visibility_error.
8369         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8370         (MOSTLYCLEANFILES): Likewise.
8371         (protected_4_pic.o, protected_3.err): New targets.
8372         * testsuite/protected_4.cc: New file.
8373
8374 2010-01-12  Doug Kwan  <dougkwan@google.com>
8375
8376         * arm.cc (Cortex_a8_reloc): New class.
8377         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8378         and cortex_a8_relocs_info_.
8379         (Target_arm::fix_cortex_a8): New method definition.
8380         (Target_arm::Cortex_a8_relocs_info): New type.
8381         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8382         New data member declarations.
8383         (Target_arm::scan_reloc_for_stub): Record information about
8384         relocations for THUMB branches that might be exempted from the
8385         Cortex-A8 workaround.
8386         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8387         at the beginning of a relaxation pass.
8388
8389 2010-01-12  Doug Kwan  <dougkwan@google.com>
8390
8391         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8392         (Arm_relobj::Mapping_symbol_position,
8393          Arm_reloj::Mapping_symbol_position_less,
8394          Arm_relobj::Mapping_symbols_info): New types.
8395         (Target_arm::is_mapping_symbol_name): New method definition.
8396         (Arm_relobj::do_count_local_symbols): Save information about mapping
8397         symbols.
8398
8399 2010-01-11  Doug Kwan  <dougkwan@google.com>
8400
8401         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8402         Arm_relocate_functions::thumb32_branch_upper,
8403         Arm_relocate_functions::thumb32_branch_lower,
8404         Arm_relocate_functions::thumb32_cond_branch_offset,
8405         Arm_relocate_functions::thumb32_cond_branch_upper,
8406         Arm_relocate_functions::thumb32_cond_branch_lower,
8407         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8408         branch offset encoding.
8409         (Arm_relocate_functions::thumb_branch_common): Use new branch
8410         offset encoding methods to avoid code duplication.
8411         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8412         (Stub_addend_reader::operator()): Use new branch encoding method
8413         to avoid code duplication.
8414
8415 2010-01-11  Doug Kwan  <dougkwan@google.com>
8416
8417         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8418         (Target_arm::do_finalize_sections): Define special EXIDX section
8419         symbols only if referenced.
8420         * gc.h (Garbage_collection::add_reference): New method.
8421         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8422         code duplication.
8423
8424 2010-01-11  Ian Lance Taylor  <iant@google.com>
8425
8426         * script.cc (Version_script_info::build_expression_list_lookup):
8427         Change complaing about duplicate wildcard match from error to
8428         warning.
8429
8430         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8431         of 2009-12-30.
8432         (Version_script_info::Version_script_info): Initialize globs_,
8433         default_version_, default_is_global_, and exact_.  Don't
8434         initialize globals_ or locals_.
8435         (Version_script_info::build_lookup_tables): Build local symbols
8436         first.
8437         (Version_script_info::unquote): New function.
8438         (Version_script_info::add_exact_match): New function.
8439         (Version_script_info::build_expression_list_lookup): Remove lookup
8440         parameter.  Add is_global parameter.  Change all callers.  Handle
8441         wildcard pattern specially.  Unquote pattern.  Call
8442         add_exact_match.
8443         (Version_script_info::get_name_to_match): New function.
8444         (Version_script_info::get_symbol_version): New function.
8445         (Version_script_info::get_symbol_version_helper): Remove.
8446         (Version_script_info::check_unmatched_names): Call unquote.
8447         * script.h (class Version_script_info): Change get_symbol_version
8448         to be non-inline and add is_global parameter; change all callers.
8449         Rewrite symbol_is_local.  Update declarations.  Define struct
8450         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8451         Remove globals_ and locals_ members.  Add exact_, globs_,
8452         default_version_, is_global_.
8453         (Version_script_info::Glob): Remove pattern, add expression and
8454         is_global.  Update constructor.  Change all callers.
8455         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8456         default version.
8457         (Versions::symbol_section_contents): If a symbol is undefined, or
8458         defined in a dynamic object, set the version index to
8459         VER_NDX_LOCAL.
8460         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8461         symbol_is_local.
8462         (Symbol_table::add_from_pluginobj): Likewise.
8463         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8464
8465 2010-01-11  Doug Kwan  <dougkwan@google.com>
8466
8467         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8468         (incremental_dump_LDADD): Add linking option for libintl.
8469         * Makefile.in: Regenerate.
8470
8471 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8472
8473         PR gold/11144
8474         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8475         instead of -Ds.
8476         * testsuite/Makefile.in: Regenerated.
8477
8478 2010-01-10  Doug Kwan  <dougkwan@google.com>
8479
8480         * options.h (DEFINE_var): Use parentheses around argument varname__
8481         in macro body to avoid any unintended subsequent substitutions.
8482
8483 2010-01-10  Ian Lance Taylor  <iant@google.com>
8484
8485         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8486         candidates before doing symbol resolution.
8487
8488         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8489         ODR candidates if only one is weak.
8490
8491 2010-01-08  Ian Lance Taylor  <iant@google.com>
8492
8493         * script.cc (Version_script_info::build_expression_list_lookup):
8494         Don't warn about ambiguous version, just record the ambiguity.
8495         (Version_script_info::get_symbol_version_helper): Give error if
8496         version is ambiguous.
8497
8498 2010-01-08  Doug Kwan  <dougkwan@google.com>
8499
8500         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8501         prev_data_size_ and prev_addralign_.  Remove initializer for
8502         deleted data member has_been_changed_.
8503         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8504         to determine if the table is empty.
8505         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8506         Remove.
8507         (Stub_table::add_reloc_stub): Define method in class definition
8508         instead of just declaring it there.
8509         (Stub_table::add_cortex_a8_stub): New method definition.
8510         (Stub_table::update_data_size_and_addralign): Ditto.
8511         (Stub_table::finalize_stubs): Ditto.
8512         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8513         (Stub_table::do_addralign_): Return address alignment in the
8514         (Stub_table::do_reset_address_and_file_offset): Define method in
8515         class definition instead of declaring it there.  Set current data
8516         size to be the data size of the previous pass.
8517         (Stub_table::set_final_data_size): Use current data size as the
8518         final data size.
8519         (Stub_table::relocate_stub): Change parameter type of stub from
8520         Reloc_stub pointer to Stub pointer.
8521         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8522         (Stub_table::Cortex_a8_stub_list): New typedef.
8523         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8524          Stub_table::prev_addralign_): New data member.
8525         (Arm_relobj::Arm_relobj): Initialize data member
8526         section_has_cortex_a8_workaround_.
8527         (Arm_relobj::section_has_cortex_a8_workaround,
8528          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8529          definitions.
8530         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8531         declarations.
8532         (Target_arm::relocate_stub): Change parameter type of stub from
8533         Reloc_stub pointer to Stub pointer.
8534         (Insn_template::size, Insn_template::alignment): Handle
8535         THUMB16_SPECIAL_TYPE.
8536         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8537          Stub_table::update_data_size_and_addralign,
8538          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8539         definitions.
8540         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8541         (Stub_table::do_write): Ditto.
8542         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8543
8544 2010-01-08  Ian Lance Taylor  <iant@google.com>
8545
8546         PR 11108
8547         * symtab.h (class Symbol): Remove fields is_target_special_ and
8548         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8549         (Symbol::is_defined_in_discarded_section): New function.
8550         (Symbol::set_is_defined_in_discarded_section): New function.
8551         (Symbol::has_plt_offset): Rewrite.
8552         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8553         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8554         Don't initialize is_target_special_ or has_plt_offset_.
8555         Initialize is_defined_in_discarded_section_.
8556         (Symbol_table::add_from_relobj): If appropriate, set
8557         is_defined_in_discarded_section.
8558         * resolve.cc (Symbol::override_base_with_special): Don't test
8559         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8560         * target-reloc.h (relocate_section): Do special handling for
8561         symbols defined in discarded sections for global symbols as well
8562         as local symbols.
8563
8564 2010-01-08  Ian Lance Taylor  <iant@google.com>
8565
8566         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8567         the SHT_SYMTAB case.
8568
8569 2010-01-08  Ian Lance Taylor  <iant@google.com>
8570
8571         * object.cc (Sized_relobj::do_layout): Don't get confused if
8572         layout_eh_frame returns NULL.
8573
8574 2010-01-08  Ian Lance Taylor  <iant@google.com>
8575
8576         PR 11084
8577         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8578         dynamic symbol table, use the normal symbol table.
8579         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8580         symbol table.
8581
8582 2010-01-08  Ian Lance Taylor  <iant@google.com>
8583
8584         PR 11072
8585         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8586         sections.
8587
8588 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8589
8590         * version.cc (print_version): Change to "Copyright 2010".
8591
8592 2010-01-08  Ian Lance Taylor  <iant@google.com>
8593
8594         PR 10287
8595         PR 11063
8596         * i386.cc (class Target_i386): Change return type of plt_section
8597         to be non-const.
8598         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8599         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8600         tls_desc_rel_ field.
8601         (Output_data_plt_i386::rel_tls_desc): New function.
8602         (Target_i386::rel_tls_desc_section): New function.
8603         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8604         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8605         R_386_TLS_DESC reloc in rel_tls_desc_section.
8606         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8607         Define struct Tlsdesc_info.
8608         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8609         (Target_x86_64::do_reloc_symbol_index): New function.
8610         (Target_x86_64::add_tlsdesc_info): New function.
8611         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8612         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8613         tlsdesc_rel_ field.
8614         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8615         all callers.
8616         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8617         (Target_x86_64::rela_tlsdesc_section): New function.
8618         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8619         handling.
8620         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8621         (Target_x86_64::do_reloc_addend): New function.
8622         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8623         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8624         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8625         (Output_reloc::type): New function.
8626         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8627         (Output_reloc::is_target_specific): New function.
8628         (Output_reloc::target_arg): New function.
8629         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8630         absolute relocs and target specific relocs.
8631         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8632         add_target_specific.
8633         (class Output_data_reloc) [SHT_RELA]: Likewise.
8634         * output.cc (Output_reloc::Output_reloc): Add four new versions
8635         for absolute relocs and target specific relocs.
8636         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8637         (Output_reloc::get_symbol_index): Likewise.
8638         (Output_reloc::local_section_offset): Check that local_sym_index_
8639         is not TARGET_CODE or 0.
8640         (Output_reloc::symbol_value): Likewise.
8641         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8642         reloc.
8643         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8644         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8645         functions.
8646         * layout.cc (add_target_dynamic_tags): Use output section for
8647         DT_PLTRELSZ and DT_JMPREL.
8648
8649 2010-01-07  Ian Lance Taylor  <iant@google.com>
8650
8651         PR 11061
8652         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8653         function.
8654         (class Output_data_reloc_generic): Define.
8655         (class Output_data_reloc_base): Change base class to
8656         Output_data_reloc_generic.  Change add() method to call
8657         bump_relative_reloc_count for a relative reloc.  Remove
8658         sort_relocs_ field.
8659         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8660         to sort_relocs().
8661         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8662         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8663         appropriate.
8664         * layout.h (class Layout): Update declaration.
8665
8666 2010-01-07  Ian Lance Taylor  <iant@google.com>
8667
8668         * output.h (class Output_data): Add const version of
8669         output_section and do_output_section.
8670         (class Output_section_data): Add const version of
8671         do_output_section.
8672         (class Output_section): Likewise.
8673         * layout.cc (Layout::add_target_dynamic_tags): New function.
8674         * layout.h (class Layout): Update declarations.
8675         * arm.cc (Target_arm::do_finalize_sections): Use
8676         add_target_dynamic_tags.
8677         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8678         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8679         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8680         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8681
8682 2010-01-07  Ian Lance Taylor  <iant@google.com>
8683
8684         PR 11042
8685         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8686         object as needed.
8687
8688 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8689             Ian Lance Taylor  <iant@google.com>
8690
8691         PR 11019
8692         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8693         Xindex::read_symtab_xindex.
8694
8695 2010-01-07  Doug Kwan  <dougkwan@google.com>
8696
8697         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8698         (Insn_template::thumb16_bcond_insn): New method declaration.
8699         (Insn_template): Fix spelling.
8700         (Stub::thumb16_special): New method declaration.
8701         (Stub::do_write): Define virtual method which was previously pure
8702         virtual.
8703         (Stub::do_thumb16_special): New method declaration.
8704         (Stub::do_fixed_endian_write): New template member.
8705         (Reloc_stub::do_write): Remove.
8706         (Reloc_stub::do_fixed_endian_write): Remove.
8707         (Cortex_a8_stub): New class definition.
8708         (Stub_factory::make_cortex_a8_stub): New method definition.
8709         (Stub_factory::Stub_factory): Add missing static storage class
8710         qualifier for elf32_arm_stub_a8_veneer_blx.
8711
8712 2010-01-07  Ian Lance Taylor  <iant@google.com>
8713
8714         PR 10980
8715         * options.h (class General_options): Add --warn-unresolved-symbols
8716         and --error-unresolved-symbols.
8717         * errors.cc (Errors::undefined_symbol): Implement
8718         --warn-unresolved-symbols.
8719
8720         * options.h (class General_options): Add -z text and -z textoff.
8721         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8722
8723 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8724
8725         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8726         (Garbage_collection::cident_sections): New function.
8727         (Garbage_collection::add_cident_section): New function.
8728         (Garbage_collection::cident_sections_): New member.
8729         (gc_process_relocs): Add references to sections whose names are C
8730         identifiers.
8731         * gold.h (cident_section_start_prefix): New constant.
8732         (cident_section_stop_prefix): New constant.
8733         (is_cident): New function.
8734         * layout.cc (Layout::define_section_symbols): Replace string constants
8735         with the newly defined constants.
8736         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8737         C identifiers.
8738         * testsuite/Makefile.am: Add gc_orphan_section_test.
8739         * testsuite/Makefile.in: Regenerate.
8740         * testsuite/gc_orphan_section_test.cc: New file.
8741         * testsuite/gc_orphan_section_test.sh: New file.
8742
8743 2010-01-06  Ian Lance Taylor  <iant@google.com>
8744
8745         PR 10980
8746         * options.h (class General_options): Add --warn-shared-textrel.
8747         * layout.cc (Layout::finish_dynamic_section): Implement
8748         --warn-shared-textrel.
8749
8750         PR 10980
8751         * options.h (class General_options): Add --warn-multiple-gp.
8752
8753 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8754
8755         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8756         $(THREADSLIB) and $(LIBDL).
8757         * Makefile.in: Rebuild.
8758
8759 2010-01-06  Ian Lance Taylor  <iant@google.com>
8760
8761         PR 10980
8762         * options.cc (General_options::parse_section_start): New function.
8763         (General_options::section_start): New function.
8764         (General_options::General_options): Initialize all members.
8765         * options.h: Include <map>
8766         (class General_options): Add --section-start.  Add section_starts_
8767         member.
8768         * layout.cc (Layout::attach_allocated_section_to_segment): If
8769         --section-start was used, set the address of the segment.  Remove
8770         local sort_sections.
8771         (Layout::relaxation_loop_body): If the address of the load segment
8772         has been set by --section-start, don't use it.
8773         * output.h (Output_segment::update_flags_for_output_section): New
8774         function.
8775         * output.cc (Output_segment::add_output_section): Call
8776         update_flags_for_output_section.
8777
8778 2010-01-05  Ian Lance Taylor  <iant@google.com>
8779
8780         PR 10980
8781         * options.h (class General_options): Add --undefined-version.
8782         * script.cc (struct Version_expression): Add was_matched_by_symbol
8783         field.
8784         (Version_script_info::matched_symbol): New function.
8785         (Version_script_info::get_symbol_version_helper): Call
8786         matched_symbol.
8787         (Version_script_info::check_unmatched_names): New function.
8788         * script.h (class Version_script_info): Update declarations.
8789         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8790
8791         * options.h (class General_options): Use DEFINE_bool_alias for
8792         allow_multiple_definition.
8793         * resolve.cc (Symbol_table::should_override): Don't test
8794         allow_multiple_definition.
8795
8796         PR 10980
8797         * options.h (class General_options): Add --cref.
8798         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8799         until after printing cref table.
8800         * cref.cc: Include "symtab.h".
8801         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8802         (Cref_table_compare::operator()): New function.
8803         (Cref_inputs::gather_cref): New function.
8804         (filecol): New static const.
8805         (Cref_inputs::print_cref): New function.
8806         (Cref::print_cref): New function.
8807         * cref.h: Include <cstdio>.
8808         (class Cref): Update declarations.
8809         * mapfile.h (Mapfile::file): New function.
8810         * object.h (class Object): Define Symbols.  Declare virtual
8811         do_get_global_symbols.
8812         (Object::get_global_symbols): New function.
8813         * object.cc (Input_objects::add_object): Pass object to cref_ if
8814         --cref.
8815         (Input_objects::archive_start): Likewise.
8816         (Input_objects::archive_stop): Likewise.
8817         (Input_objects::print_cref): New function.
8818         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8819         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8820         --cref.
8821         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8822         function.
8823         * plugin.h (class Sized_pluginobj): Update declarations.
8824
8825 2010-01-05  Ian Lance Taylor  <iant@google.com>
8826
8827         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8828         to is_default_version.  Rename insdef to insdefault.
8829         (Symbol_table::add_from_relobj): Rename def to is_default_version
8830         and local to is_forced_local.
8831         (Symbol_table::add_from_pluginobj): Likewise.
8832         (Symbol_table::add_from_dynobj): Likewise.
8833         (Symbol_table::define_special_symbol): Rename insdef to
8834         insdefault.
8835
8836 2010-01-04  Ian Lance Taylor  <iant@google.com>
8837
8838         PR 10980
8839         * options.h (class General_options): Add
8840         --allow-multiple-definition and -z muldefs.
8841         * resolve.cc (Symbol_table::should_override): Don't warn about a
8842         multiple symbol definition if --allow-multiple-definition or -z
8843         muldefs.
8844
8845         PR 10980
8846         * options.h (class General_options): Add --add-needed and
8847         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8848         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8849         error if --copy-dt-needed-entries aka --add-needed is used and
8850         would cause a change in behaviour.
8851
8852         PR 10980
8853         * options.h (class General_options): Add -G as a short version of
8854         --shared.  Add no-op options -assert, -g, and -i.
8855
8856 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8857
8858         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8859         check for .text or .gnu.linkonce.t sections.
8860         * icf.cc (Icf::find_identical_sections): Ditto.
8861         Change the detection for mangled function name within the section
8862         name.
8863         * icf.h (is_section_foldable_candidate): New function.
8864
8865 2009-12-30  Ian Lance Taylor  <iant@google.com>
8866
8867         PR 10980
8868         * options.h (class General_options): Permit two dashes with
8869         --retain-symbols-file.
8870
8871 2009-12-30  Ian Lance Taylor  <iant@google.com>
8872
8873         PR 10979
8874         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8875         don't put the file header and segment headers in the text
8876         segment.
8877
8878         PR 10979
8879         * common.cc (Sort_commons::operator()): Stabilize sort when both
8880         entries are NULL.
8881         (Symbol_table::do_allocate_commons_list): When allocating common
8882         symbols, skip a symbol which is no longer common.
8883         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8884         an object before checking its type.
8885         * testsuite/common_test_2.c: New file.
8886         * testsuite/common_test_3.c: New file.
8887         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8888         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8889         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8890         (common_test_2_pic.o, common_test_2.so): New targets.
8891         (common_test_3_pic.o, common_test_3.so): New targets.
8892         * testsuite/Makefile.in: Rebuild.
8893
8894         PR 10979
8895         * script.cc (read_input_script): If we see a new SECTIONS clause,
8896         and we have added an input section, give an error.
8897         * layout.h (class Layout): Add have_added_input_section function.
8898         Add have_added_input_section_ field.
8899         * layout.cc (Layout::Layout): Initialize
8900         have_added_input_section_.
8901         (Layout::layout): Set have_added_input_section_.
8902         (Layout::layout_eh_frame): Likewise.
8903
8904 2009-12-30  Ian Lance Taylor  <iant@google.com>
8905
8906         PR 10931
8907         * options.h (class General_options): Add --sort-common option.
8908         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8909         * common.cc (Sort_common): Add sort_order parameter to
8910         constructor.  Add sort_order_ field.
8911         (Sort_commons::operator): Check sort_order_.
8912         (Symbol_table::allocate_commons): Determine the sort order.
8913         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8914         Change all callers.
8915         (Symbol_table::do_allocate_commons_list): Likewise.
8916
8917 2009-12-30  Ian Lance Taylor  <iant@google.com>
8918
8919         PR 10916
8920         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8921         symbols from this object, don't change the visibility of an
8922         undefined symbol.
8923         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8924
8925 2009-12-30  Ian Lance Taylor  <iant@google.com>
8926
8927         PR 10861
8928         * script.h (class Version_script_info): Define Language enum.
8929         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8930         new fields globals_, locals_, and is_finalized_.
8931         * script.cc: Various formatting fixes.
8932         (class Parser_closure): Change language_stack_ from a vector of
8933         std::string to one of Version_script_info::Language.  Adjust all
8934         uses accordingly.
8935         (class Lazy_demangler): Remove.
8936         (struct Version_expression): Change language from std::string to
8937         Version_script_info::Language.
8938         (Version_script_info::Version_script_info): New function.
8939         (Version_script_info::~Version_script_info): Don't call clear.
8940         (Version_script_info::finalize): New function.
8941         (Version_script_info::build_lookup_tables): New function.
8942         (Version_script_info::build_expression_list_lookup): New
8943         function.
8944         (Version_script_info::get_symbol_version_helper): Rewrite to use
8945         lookup tables.
8946         (Version_script_info::print_expression_list): Adjust to use
8947         Version_script_info::Language.
8948         (script_push_lex_into_version_mode): Check that the version script
8949         has not been finalized.
8950         (version_script_push_lang): Change language string to
8951         Version_script_info::Language.
8952         * options.cc (Command_line::version_script): New function.
8953         * options.h (class General_options): Add finalize_dynamic_list
8954         function.  Change version_script from declaration to definition.
8955         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8956         * testsuite/version_script.map: Remove duplicate def of foo.
8957         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8958         version_script.map.
8959         * testsuite/Makefile.in: Rebuild.
8960
8961 2009-12-30  Ian Lance Taylor  <iant@google.com>
8962
8963         PR 10843
8964         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8965         if the input symbol index is 0, make the output symbol index 0.
8966
8967 2009-12-30  Ian Lance Taylor  <iant@google.com>
8968
8969         PR 10670
8970         * options.h (class General_options): Add -x/--discard-all.
8971         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8972         --discard-all.  If the local symbol needs a dynamic entry, check
8973         that before handling --discard-locals.
8974
8975 2009-12-30  Ian Lance Taylor  <iant@google.com>
8976
8977         PR 10450
8978         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8979         flags to PF_R.
8980         (Output_segment::add_output_section): Don't change the flags if
8981         the type is PT_TLS.
8982
8983         PR 10450
8984         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8985         GNU hash table if they need a dynamic value.  Otherwise, don't add
8986         them if they are defined in a dynamic object or are forced local.
8987
8988 2009-12-29  Ian Lance Taylor  <iant@google.com>
8989
8990         PR 10450
8991         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8992         .gnu.hash table for a 32-bit target.
8993
8994         PR 10450
8995         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8996         regular and a dynamic object only needs a dynamic symbol table
8997         entry if it is externally visible.
8998
8999         PR 10450
9000         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9001         constructor.  Add global_offset_table_ field.
9002         (Target_i386::got_section): Set global_offset_table_.
9003         (Target_i386::do_finalize_sections): Set global_offset_table_
9004         size.
9005         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9006         in constructor.  Add global_offset_table_ field.
9007         (Target_x86_64::got_section): Set global_offset_table_.
9008         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9009         size.
9010
9011         * layout.cc (Layout::Layout): Initialize increase_relro_.
9012         (Layout::get_output_section): Add is_relro, is_last_relro, and
9013         is_first_non_relro parameters.  Change all callers.
9014         (Layout::choose_output_section): Likewise.
9015         (Layout::add_output_section_data): Likewise.
9016         (Layout::make_output_section): Likewise.
9017         (Layout::set_segment_offsets): Clear increase_relro when using a
9018         linker script.
9019         * layout.h (class Layout): Add increase_relro method.  Add
9020         increase_relro_ field.  Update declarations.
9021         * output.cc (Output_section::Output_section): Initialize
9022         is_last_relro_ and is_first_non_relro_.
9023         (Output_segment::add_output_section): Group relro sections is
9024         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9025         (Output_segment::maximum_alignment): Remove relro handling.
9026         (Output_segment::set_section_addresses): Add increase_relro
9027         parameter.  Change all callers.  Add initial alignment to align
9028         relro sections on separate page.  Remove old relro handling.
9029         (Output_segment::set_section_list_addresses): Remove in_relro
9030         parameter.  Change all callers.
9031         (Output_segment::set_offset): Add increase parameter.  Change all
9032         callers.  Remove old relro handling.
9033         * output.h (class Output_section): Add new methods: is_last_relro,
9034         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9035         Add is_last_relro_ and is_first_non_relro_ fields.
9036         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9037         Create separate .got.plt section.  Call increase_relro.
9038         * x86_64.cc (Target_x86_64::got_section): Likewise.
9039         * testsuite/relro_script_test.t: Add .got.plt.
9040
9041         PR 10450
9042         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9043         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9044         (Layout::finalize): Call set_dynamic_symbol_size.
9045         (Layout::set_dynamic_symbol_size): New function.
9046         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9047         set_dynamic_symbol_size.
9048
9049         PR 10450
9050         * output.h (class Output_section): Add is_entsize_zero_ field.
9051         * output.cc (Output_section::Output_section): Initialize
9052         is_entsize_zero_.
9053         (Output_section::set_entsize): If two different entsizes are
9054         requested, force it to zero.
9055         (Output_section::add_input_section): Set flags for .debug_str
9056         before updating section flags.  Set entsize.
9057         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9058         and SHF_STRING if all input sections have those flags.
9059
9060 2009-12-29   Rafael Espindola  <espindola@google.com>
9061
9062         * main.cc (main): Fix the sys time reporting.
9063         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9064         reporting.
9065
9066 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9067
9068         * options.cc (General_options::parse_version): Allow -v to exit
9069         without an error if there is nothing to link.
9070
9071 2009-12-29  Ian Lance Taylor  <iant@google.com>
9072
9073         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9074         using a version of gcc before 4.1.
9075         * configure: Rebuild.
9076
9077 2009-12-28  Chris Demetriou  <cgd@google.com>
9078
9079         * attributes.cc (Output_attributes_section_data::do_write): Use
9080         std::vector::front rather than std::vector::data.
9081
9082 2009-12-28  Ian Lance Taylor  <iant@google.com>
9083
9084         * symtab.h (class Symbol_table): Add enum Defined.
9085         * resolve.cc (Symbol_table::should_override): Add defined
9086         parameter.  Change all callers.  Test whether object is NULL
9087         before calling a method on it.
9088         (Symbol_table::report_resolve_problem): Add defined parameter.
9089         Change all callers.
9090         (Symbol_table::should_override_with_special): Likewise.
9091         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9092         parameter.  Change all callers.
9093         (Symbol_table::do_define_in_output_data): Likewise.
9094         (Symbol_table::define_in_output_segment): Likewise.
9095         (Symbol_table::do_define_in_output_segment): Likewise.
9096         (Symbol_table::define_as_constant): Likewise.
9097         (Symbol_table::do_define_as_constant): Likewise.
9098         * script.h (class Symbol_assignment): Add is_defsym parameter to
9099         constructor; change all callers.
9100         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9101         parameter.  Change all callers.  Add is_defsym_ field.
9102         (class Parser_closure): Add parsing_defsym parameter to
9103         constructor; change all callers.  Add parsing_defsym accessor
9104         function.  Add parsing_defsym_ field.
9105
9106 2009-12-28  Ian Lance Taylor  <iant@google.com>
9107
9108         * gold.cc (queue_middle_tasks): Fix formatting.
9109         * object.cc (Relobj::is_section_name_included): Likewise.
9110
9111 2009-12-23  Ian Lance Taylor  <iant@google.com>
9112
9113         * i386.cc (Target_i386::do_calls_non_split): Recognize
9114         -fsplit-stack prologue for a function with a static chain.
9115         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9116         -fsplit-stack prologue when using %r11.
9117
9118 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9119
9120         * options.cc (General_options::parse_version): Make -v continue and do
9121         the link like GNU ld does.
9122
9123 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9124
9125         * Makefile.am (CCFILES): Add timer.cc.
9126         (HFILES): Add timer.h.
9127         * configure.ac: Check for sysconf and times.
9128         * main.cc: include timer.h.
9129         (main): Use Timer instead of get_run_time.
9130         * timer.cc: New.
9131         * timer.h: New.
9132         * workqueue.cc: include timer.h.
9133         (Workqueue::find_and_run_task):
9134         Report user, sys and wall time.
9135         * Makefile.in: Regenerate.
9136         * config.in: Regenerate.
9137         * configure: Regenerate.
9138
9139 2009-12-16  Doug Kwan  <dougkwan@google.com>
9140
9141         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9142         sections.
9143         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9144         relaxed input sections.
9145         * output.cc (Output_section::find_relaxed_input_section): Change
9146         return type to Output_relaxed_input_section pointer.  Adjust code
9147         for new type of relaxed_input_section_map_.
9148         * output.h (Output_section::find_relaxed_input_section): Change
9149         return type to Output_relaxed_input_section pointer.
9150         (Output_section::Output_relaxed_input_section_by_input_section_map):
9151         New type.
9152         (Output_section::relaxed_input_section_map_): Change type to
9153         Output_section::Output_relaxed_input_section_by_input_section_map.
9154         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9155         input section.
9156
9157 2009-12-15  Ian Lance Taylor  <iant@google.com>
9158
9159         * layout.cc (Layout::create_shstrtab): Only write out after input
9160         sections if we are compressing debug sections.
9161
9162 2009-12-15  Ian Lance Taylor  <iant@google.com>
9163
9164         * archive.cc (Archive::add_symbols): Only look up a symbol without
9165         a version if there is, in fact, a version.
9166
9167 2009-12-14  Ian Lance Taylor  <iant@google.com>
9168
9169         Revert -Wshadow changes, all changes from:
9170         2009-12-11  Doug Kwan  <dougkwan@google.com>
9171         2009-12-11  Nick Clifton  <nickc@redhat.com>
9172         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9173
9174 2009-12-11  Doug Kwan  <dougkwan@google.com>
9175
9176         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9177         due to -Wshadow.
9178         * attributes.cc (Object_attribute::size): Ditto.
9179         (Attributes_section_data::size): Ditto.
9180         (Attributes_section_data::Attributes_section_data): Ditto.
9181         (Output_attributes_section_data::do_write): Ditto.
9182         * attributes.h (Object_attribute::set_type): Ditto.
9183         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9184
9185 2009-12-11  Nick Clifton  <nickc@redhat.com>
9186
9187         * archive.cc: Fix shadowed variable warnings.
9188         * arm.cc: Likewise.
9189         * compressed_output.cc: Likewise.
9190         * compressed_output.h: Likewise.
9191         * configure: Likewise.
9192         * dwarf_reader.cc: Likewise.
9193         * dynobj.cc: Likewise.
9194         * dynobj.h: Likewise.
9195         * ehframe.cc: Likewise.
9196         * ehframe.h: Likewise.
9197         * errors.cc: Likewise.
9198         * expression.cc: Likewise.
9199         * fileread.cc: Likewise.
9200         * fileread.h: Likewise.
9201         * freebsd.h: Likewise.
9202         * i386.cc: Likewise.
9203         * icf.cc: Likewise.
9204         * incremental.h: Likewise.
9205         * layout.cc: Likewise.
9206         * layout.h: Likewise.
9207         * mapfile.cc: Likewise.
9208         * merge.cc: Likewise.
9209         * merge.h: Likewise.
9210         * object.cc: Likewise.
9211         * object.h: Likewise.
9212         * options.h: Likewise.
9213         * output.cc: Likewise.
9214         * output.h: Likewise.
9215         * parameters.cc: Likewise.
9216         * plugin.cc: Likewise.
9217         * powerpc.cc: Likewise.
9218         * reduced_debug_output.cc: Likewise.
9219         * reduced_debug_output.h: Likewise.
9220         * reloc.cc: Likewise.
9221         * reloc.h: Likewise.
9222         * resolve.cc: Likewise.
9223         * script-sections.cc: Likewise.
9224         * script.cc: Likewise.
9225         * script.h: Likewise.
9226         * sparc.cc: Likewise.
9227         * symtab.cc: Likewise.
9228         * symtab.h: Likewise.
9229         * target-select.cc: Likewise.
9230         * target-select.h: Likewise.
9231         * token.h: Likewise.
9232         * workqueue.cc: Likewise.
9233         * workqueue.h: Likewise.
9234         * x86_64.cc: Likewise.
9235
9236 2009-12-10  Doug Kwan  <dougkwan@google.com>
9237
9238         * arm.cc (attributes.h): New include.
9239         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9240         (Arm_relobj::~Arm_relobj): Delete object pointed by
9241         attributes_section_data_.
9242         (Arm_relobj::attributes_section_data): New method definition.
9243         (Arm_relobj::attributes_section_data_): New data member declaration.
9244         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9245         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9246         attributes_section_data_.
9247         (Arm_dynobj::attributes_section_data): New method definition.
9248         (Arm_dynobj::attributes_section_data_): New data member declaration.
9249         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9250         initialization value of may_use_blx_ to false.
9251         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9252         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9253         object attributes to compute results instead of hard-coding.
9254         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9255         Target_arm::get_secondary_compatible_arch,
9256         Target_arm::set_secondary_compatible_arch
9257         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9258         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9259         New method declarations.
9260         (Target_arm::get_aeabi_object_attribute): New method definition.
9261         (Target_arm::attributes_section_data_): New data member declaration.
9262         (read_arm_attributes_section): New template definition.
9263         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9264         (Arm_dynobj::do_read_symbols): Ditto.
9265         (Target_arm::do_finalize_sections): Merge attributes sections from
9266         input.  Check for BLX use after attributes section merging.
9267         Fix __exidx_start and __exidx_end visibility.  Create an
9268         .ARM.attributes section if necessary.
9269         (Target_arm::get_secondary_compatible_arch,
9270         Target_arm::set_secondary_compatible_arch,
9271         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9272         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9273         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9274         New method definitions.
9275
9276 2009-12-09  Ian Lance Taylor  <iant@google.com>
9277
9278         * plugin.cc (Plugin::load): Don't cast from void* to a function
9279         pointer.
9280
9281 2009-12-09  Ian Lance Taylor  <iant@google.com>
9282
9283         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9284         information fields.
9285
9286 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9287
9288         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9289         Replace two_file_shared_1.so with two_file_shared_2.so.
9290         * testsuite/Makefile.in: Regenerated.
9291
9292 2009-12-08  Doug Kwan  <dougkwan@google.com>
9293
9294         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9295         (HFILES): Add attributes.h and int_encoding.h.
9296         * Makefile.in: Regenerate.
9297         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9298         function definitions to int_encoding.cc
9299         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9300         prototypes to int_encoding.h
9301         * reduced_debug_output.cc (int_encoding.h): New include.
9302         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9303         function definitions to int_encoding.cc
9304         (insert_into_vector, read_from_pointer): Move template definitions to
9305         int_encoding.h
9306         * attributes.cc: New file.
9307         * attributes.h: New file.
9308         * int_encoding.cc: New file.
9309         * int_encoding.h: New file.
9310
9311 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9312
9313         PR gold/11055
9314         * incremental-dump.cc (dump_incremental_inputs): New.
9315         (main): Use dump_incremental_inputs.
9316
9317 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9318
9319         PR gold/10893
9320         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9321         checking elfcpp::STT_FUNC.
9322         (Target_i386::Relocate::relocate): Likewise.
9323         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9324
9325         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9326         symbols from shared libraries into normal FUNC symbols.
9327
9328         * symtab.h (Symbol): Add is_func and use it.
9329
9330 2009-12-05  Doug Kwan  <dougkwan@google.com>
9331
9332         * arm.cc (Target_arm::arm_info): Initialize new fields
9333         attributes_section and attributes_vendor.
9334         * i386.cc (Target_i386::i386_info): Same.
9335         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9336         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9337         fields attributes_section and attributes_vendor.
9338         * sparc.cc (Target_sparc::sparc_info): Same.
9339         * target.h (Target::attributes_section, Target::attributes_vendor,
9340         Target::is_attributes_section, Target::attribute_arg_type,
9341         Target::attributes_order): New method definitions.
9342         (Target::Target_info::attributes_section,
9343         Target::Target_info::attributes_vendor): New fields.
9344         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9345         virtual method definitions.
9346         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9347         attributes_section and attributes_vendor.
9348         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9349
9350 2009-12-05  Doug Kwan  <dougkwan@google.com>
9351
9352         * arm.cc: Update comments about interworking and stub generation.
9353         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9354         considered as non-PIC.
9355         (Arm_relocate_functions::base_abs): Fix formatting.
9356         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9357         of function to use GOT entry address instead of offset.
9358         (Target_arm::Scan::global): Issue an error if a symbol would need a
9359         PLT does not get one because it is untyped.  Remove code to create
9360         dynamic symbols for relative branches.
9361         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9362         takes unsigned integer instead of boolean.
9363
9364 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9365
9366         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9367         (two_file_test_LDADD): Likewise.
9368         (common_test_1_LDADD): Likewise.
9369         (exception_test_LDADD) Likewise.
9370         (weak_test_LDADD): Likewise.
9371         (many_sections_test_LDADD): Likewise.
9372         (initpri1_LDADD): Likewise.
9373         (script_test_1_LDADD): Likewise.
9374         (script_test_2_LDADD): Likewise.
9375         (justsyms_LDADD): Likewise.
9376         (binary_test_LDADD): Likewise.
9377         (large_LDADD): Likewise.
9378         * testsuite/Makefile.in: Regenerated.
9379
9380 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9381
9382         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9383         (Symbol_table::override_with_special): Likewise.
9384         (Symbol_table::add_from_object): Likewise.
9385
9386 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9387
9388         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9389         Don't set the data_offset twice.
9390
9391 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9392
9393         * testsuite/Makefile.in: Regenerate.
9394
9395 2009-12-03  Doug Kwan  <dougkwan@google.com>
9396
9397         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9398         (Target_arm::do_finalize_sections): Add parameter for symbol table
9399         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9400         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9401         parameter for symbol table pointer.
9402         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9403         an additional parameter for a pointer to symbol table.
9404         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9405         parameter for a symbol table pointer.
9406         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9407         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9408         Ditto.
9409         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9410         parameter for a symbol table pointer.
9411
9412 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9413
9414         * incremental.cc (Incremental_inputs_header)
9415         (Incremental_inputs_header_write, Incremental_inputs_entry)
9416         (Incremental_inputs_entry_write): Move ...
9417         * incremental.h (Incremental_inputs_header)
9418         (Incremental_inputs_header_write, Incremental_inputs_entry)
9419         (Incremental_inputs_entry_write): here.
9420
9421 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9422
9423         * incremental.cc (make_sized_incremental_binary): Set the target.
9424         Error if it is incompatible.
9425         * output.h (Output_file): Add filename method.
9426
9427 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9428
9429         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9430         from the get_* methods.
9431
9432 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9433
9434         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9435         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9436         Write 0 for the data_offset of scripts.
9437
9438 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9439
9440         * testsuite/Makefile.am: Add the incremental_test.sh test.
9441         * testsuite/incremental_test.sh: New.
9442         * testsuite/incremental_test_1.c: New.
9443         * testsuite/incremental_test_2.c: New.
9444
9445 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9446
9447         * incremental-dump.cc (main): Fix typos.
9448
9449 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9450
9451         PR gold/11025
9452         * incremental-dump.cc (main): Use llu to print 64 bit values.
9453
9454 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9455             H.J. Lu  <hongjiu.lu@intel.com>
9456
9457         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9458         $(LIBDL).
9459         (incremental_dump_LDADD): Likewise.
9460         * Makefile.in: Regenerated.
9461
9462 2009-11-25  Doug Kwan  <dougkwan@google.com>
9463
9464         Revert:
9465
9466         2009-11-25  Doug Kwan  <dougkwan@google.com>
9467
9468                 * arm.cc (Target_arm::Target_arm): Move method definition
9469                 outside of class definition.  Add code to handle
9470                 --target1-rel, --target1-abs and --target2= options.
9471                 (Target_arm::get_reloc_reloc_type): Change method to be
9472                 non-static and const.
9473                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9474                 New data member declaration.
9475                 (Target_arm::Scan::local, Target_arm::Scan::global,
9476                 Target_arm::Relocate::relocate,
9477                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9478                 Adjust call to Target_arm::get_real_reloc_type.
9479                 (Target_arm::get_real_reloc_type): Use command line options
9480                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9481                 * options.h (--target1-rel, --target1-abs, --target2): New
9482                 ARM-only options.
9483
9484 2009-11-25  Doug Kwan  <dougkwan@google.com>
9485
9486         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9487         class definition.  Add code to handle --target1-rel, --target1-abs
9488         and --target2= options.
9489         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9490         and const.
9491         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9492         member declaration.
9493         (Target_arm::Scan::local, Target_arm::Scan::global,
9494         Target_arm::Relocate::relocate,
9495         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9496         call to Target_arm::get_real_reloc_type.
9497         (Target_arm::get_real_reloc_type): Use command line options to
9498         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9499         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9500         options.
9501
9502 2009-11-25  Doug Kwan  <dougkwan@google.com>
9503
9504         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9505         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9506         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9507         formatting.
9508         (Arm_relocate_functions::thm_call): Replace body with a call to
9509         Arm_relocate_functions::thumb_branch_common.
9510         (Arm_relocate_functions::thm_jump24,
9511         Arm_relocate_functions::thm_xpc22): New method definitions.
9512         (Arm_relocate_functions::thumb_branch_common): New method definition.
9513         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9514         operator.
9515         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9516         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9517
9518 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9519
9520         * Makefile.am: Build incremental-dump
9521         * Makefile.in: Regenerate.
9522         * incremental-dump.cc: New.
9523         * incremental.cc (Incremental_inputs_header_data,
9524         Incremental_inputs_entry_data): Move to incremental.h
9525         * incremental.h: (Incremental_inputs_header_data,
9526         Incremental_inputs_entry_data): Move from incremental.cc
9527
9528 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9529
9530         * incremental.cc (Incremental_inputs_header,
9531         Incremental_inputs_header_write, Incremental_inputs_entry,
9532         Incremental_inputs_entry_write): Add a typedef with the data type.
9533
9534 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9535
9536         * incremental.cc (Incremental_inputs_header,
9537         Incremental_inputs_header_write, Incremental_inputs_entry,
9538         Incremental_inputs_entry_write): Update comment about which
9539         type has the filed descriptions.
9540
9541 2009-11-15  Doug Kwan  <dougkwan@google.com>
9542
9543         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9544         (Arm_relocate_functions::arm_branch_common): Change method defintion
9545         in class definition to a method declaration and update list of formal
9546         parameters.
9547         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9548         Arm_relocation_functions::jump24): Adjust call to
9549         Arm_relocate_functions::arm_branch_common.  Update list of formal
9550         parameters.
9551         (Arm_relocate_functions::xpc25): New method definition.
9552         (Arm_relocate_functions::arm_branch_common): Move method defintion
9553         out from class definition.  Use stubs for mode-switching and extending
9554         branch ranges.
9555         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9556         specially.  Change code to enable use of stubs in ARM branches.
9557
9558 2009-11-10  Doug Kwan  <dougkwan@google.com>
9559
9560         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9561         in method declaration.
9562         (Target_arm::relocate_stub): New method declaration.
9563         (Target_arm::default_target): Change to return a pointer instead of
9564         a const reference.
9565         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9566         Target_arm::default_target.
9567         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9568         method definition.
9569         (Target_arm::relocate_section): Adjust view.
9570         (Target_arm::relocate_stub): New method definition.
9571
9572 2009-11-10  Doug Kwan  <dougkwan@google.com>
9573
9574         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9575         a format warning.
9576         * incremental.cc (open_incremental_binary): Initialized local
9577         variables to avoid warnings.
9578         * object.cc (make_elf_object): Ditto.
9579         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9580         a format warning.
9581
9582 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9583
9584         PR gold/10930
9585         * testsuite/plugin_test.c: Include "config.h".
9586
9587 2009-11-09  Doug Kwan  <dougkwan@google.com>
9588
9589         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9590         (arm_symbol_value): Remove.
9591         (Arm_relocate_functions::arm_branch_common,
9592         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9593         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9594         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9595         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9596         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9597         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9598         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9599         Arm_relocate_functions::thm_mobw_abs_nc,
9600         Arm_relocate_functions::thm_mov_abs,
9601         Arm_relocate_functions::movw_prel_nc,
9602         Arm_relocate_functions::thm_movt_abs,
9603         Arm_relocate_functions::movt_prel,
9604         Arm_relocate_functions::thm_movw_prel_nc,
9605         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9606         (Target_arm::Relocate::relocate): Only decompose address into two
9607         parts if relocation type uses the thumb-bit and pass the actual
9608         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9609         calls to methods in Arm_relocate_functions for this change.
9610
9611 2009-11-08  Ian Lance Taylor  <iant@google.com>
9612
9613         PR 10925
9614         * reloc.cc: Instantiate
9615         Sized_relobj::initialize_input_to_output_maps and
9616         Sized_relobj:free_input_to_output_maps.
9617
9618 2009-11-06  Ian Lance Taylor  <iant@google.com>
9619
9620         PR 10876
9621         * defstd.cc (in_segment): Set only_if_ref true for "end".
9622
9623 2009-11-06  Doug Kwan  <dougkwan@google.com>
9624
9625         * arm.cc (class Reloc_stub): Correct a comment.
9626         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9627         (Target_arm::scan_section_for_stubs): New method declaration.
9628         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9629         Change methods from private to protected.
9630         (Target_arm::do_may_relax): New method definition.
9631         (Target_arm::do_relax, Target_arm::group_sections,
9632         Target_arm::scan_reloc_for_stub,
9633         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9634         (Target_arm::arm_input_section_map_): New data member declaration.
9635         (Target_arm::scan_reloc_for_stub,
9636         Target_arm::scan_reloc_section_for_stubs,
9637         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9638         Target_arm::do_relax): New method definitions.
9639
9640 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9641
9642         * configure.ac: Check for (struct stat)::st_mtim
9643         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9644         * config.in: Regenerate.
9645         * configure: Regenerate.
9646
9647 2009-11-05  Ian Lance Taylor  <iant@google.com>
9648
9649         PR 10910
9650         * output.cc (Output_segment::add_output_section): Add missing
9651         return statement.
9652
9653 2009-11-04  Ian Lance Taylor  <iant@google.com>
9654
9655         PR 10880
9656         * object.h (class Object): Add is_needed and set_is_needed
9657         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9658         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9659         defined in a dynamic object and referenced by a regular object,
9660         set is_needed for the dynamic object.
9661         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9662         if the file is marked with as_needed and it is not needed.
9663
9664 2009-11-04  Ian Lance Taylor  <iant@google.com>
9665
9666         PR 10887
9667         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9668         tags if data is discarded by linker script.
9669         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9670         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9671         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9672         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9673
9674 2009-11-04  Ian Lance Taylor  <iant@google.com>
9675
9676         * layout.cc (Layout::get_output_section): Add is_interp and
9677         is_dynamic_linker_section parameters.  Change all callers.
9678         (Layout::choose_output_section): Likewise.
9679         (Layout::make_output_section): Likewise.
9680         (Layout::add_output_section_data): Add is_dynamic_linker_section
9681         parameter.  Change all callers.
9682         * layout.h (class Layout): Update declarations.
9683         * output.h (class Output_section): Add is_interp, set_is_interp,
9684         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9685         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9686         generate_code_fills_at_write_ to a bitfield.
9687         * output.cc (Output_section::Output_sections): Initialize new
9688         fields.
9689         (Output_segment::add_output_section): Add do_sort parameter.
9690         Change all callers.
9691
9692 2009-11-03  Ian Lance Taylor  <iant@google.com>
9693
9694         PR 10860
9695         * options.h (class General_options): Add --warn-common.
9696         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9697         merging two common symbols.
9698         (Symbol_table::should_override): Handle --warn-common when merging
9699         a common symbol with a defined symbol.  Use report_resolve_problem
9700         for multiple definitions.
9701         (Symbol_table::report_resolve_problem): New function.
9702         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9703
9704 2009-11-03  Doug Kwan  <dougkwan@google.com>
9705
9706         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9707         stub_factory_.
9708         (Target_arm::stub_factory): New method definition.
9709         (Target_arm::new_arm_input_section,
9710         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9711         Target_arm::reloc_uses_thumb_bit): New method declarations.
9712         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9713         New type definitions.
9714         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9715         member declarations.
9716         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9717         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9718         New method definitions.
9719
9720 2009-11-03  Ian Lance Taylor  <iant@google.com>
9721
9722         * options.h (class General_options): Add --warn_constructors.
9723
9724 2009-11-03  Ian Lance Taylor  <iant@google.com>
9725
9726         PR 10893
9727         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9728         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9729
9730 2009-11-03  Ian Lance Taylor  <iant@google.com>
9731
9732         PR 10895
9733         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9734         --msgid-bugs-address.
9735         (install-pdf): New target.
9736         (install-data_yes): Look up one directory to find mkinstalldirs.
9737
9738 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9739
9740         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9741         tree.
9742
9743 2009-10-30  Doug Kwan  <dougkwan@google.com>
9744
9745         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9746
9747 2009-10-30  Doug Kwan  <dougkwan@google.com>
9748
9749         * arm.cc (Stub_addend_reader): New struct template definition
9750         and partial specializations.
9751         (Stub_addend_reader::operator()): New method definition for a
9752         partially specialized template.
9753
9754 2009-10-30  Doug Kwan  <dougkwan@google.com>
9755
9756         * arm.cc (Arm_relobj::processor_specific_flags): New method
9757         definition.
9758         (Arm_relobj::do_read_symbols): New method declaration.
9759         (Arm_relobj::processor_specific_flags_): New data member declaration.
9760         (Arm_dynobj): New class definition.
9761         (Target_arm::do_finalize_sections): Add input_objects parameter.
9762         (Target_arm::do_adjust_elf_header): New method declaration.
9763         (Target_arm::are_eabi_versions_compatible,
9764         (Target_arm::merge_processor_specific_flags): New method declaration.
9765         (Target_arm::do_make_elf_object): New overloaded method definitions
9766         and declaration.
9767         (Arm_relobj::do_read_symbols): New method definition.
9768         (Arm_dynobj::do_read_symbols): Ditto.
9769         (Target_arm::do_finalize_sections): Add input_objects parameters.
9770         Merge processor-specific flags from all input objects.
9771         (Target_arm::are_eabi_versions_compatible,
9772         Target_arm::merge_processor_specific_flags,
9773         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9774         New method definitions.
9775         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9776         Input_objects pointer type parameter.
9777         * layout.cc (Layout::finalize): Pass input objects to target's.
9778         finalize_sections function.
9779         * output.cc (Output_file_header::do_sized_write): Set ELF file
9780         header's processor-specific flags.
9781         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9782         Input_objects pointer type parameter.
9783         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9784         * target.h (Input_objects): New forward class declaration.
9785         (Target::processor_specific_flags,
9786         Target::are_processor_specific_flags_sect): New method definitions.
9787         (Target::finalize_sections): Add input_objects parameter.
9788         (Target::Target): Initialize processor_specific_flags_ and
9789         are_processor_specific_flags_set_.
9790         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9791         parameter.
9792         (Target::set_processor_specific_flags): New method definition.
9793         (Target::processor_specific_flags_,
9794         Target::are_processor_specific_flags_set_): New data member
9795         declarations.
9796         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9797         Input_objects pointer type parameter.
9798
9799 2009-10-30  Doug Kwan  <dougkwan@google.com>
9800
9801         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9802
9803 2009-10-28  Ian Lance Taylor  <iant@google.com>
9804
9805         * object.h (class Relobj): Drop options parameter from
9806         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9807         do_scan_relocs, do_relocate.  Change all callers.
9808         (class Sized_relobj): Drop options parameters from
9809         do_gc_process_relocs, do_scan_relocs, do_relocate,
9810         do_relocate_sections, relocate_sections, emit_relocs_scan,
9811         emit_relocs_scan_reltype.  Change all callers.
9812         (struct Relocate_info): Remove options field and all references to
9813         it.
9814         * reloc.h (class Read_relocs): Remove options constructor
9815         parameter and options_ field.  Change all callers.
9816         (class Gc_process_relocs, class Scan_relocs): Likewise.
9817         (class Relocate_task): Likewise.
9818         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9819         all callers.
9820         (scan_relocatable_relocs): Likewise.
9821         * target.h (class Sized_target): Remove options parameter from
9822         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9823         all callers.
9824         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9825         callers.
9826         * arm.cc: Update functions to remove options parameters.
9827         * i386.cc: Likewise.
9828         * powerpc.cc: Likewise.
9829         * sparc.cc: Likewise.
9830         * x86_64.cc: Likewise.
9831         * testsuite/testfile.cc: Likewise.
9832
9833 2009-10-28  Doug Kwan  <dougkwan@google.com>
9834
9835         * arm.cc (Arm_relobj): New class definition.
9836         (Arm_relobj::scan_sections_for_stubs,
9837         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9838         New method definitions.
9839
9840 2009-10-28  Cary Coutant  <ccoutant@google.com>
9841
9842         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9843         (Plugin::cleanup_done_): New member.
9844         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9845         (Plugin_manager::cleanup_done_): Remove.
9846         (Plugin_manager::add_input_file): Edit error message.
9847         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9848         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9849
9850 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9851
9852         * fileread.cc: (File_read::View::~View): Use the new
9853         data_ownership_ filed.
9854         (File_read::~File_read): Dispose the new whole_file_view_.
9855         (File_read::open): Mmap the whole file if needed.
9856         (File_read::open): Use whole_file_view_ instead of contents_.
9857         (File_read::find_view): Use whole_file_view_ if applicable.
9858         (File_read::do_read): Use whole_file_view_ instead of contents_.
9859         (File_read::make_view): Use whole_file_view_ instead of contents_,
9860         update File_read::View::View call.
9861         (File_read::find_or_make_view): Update File_read::View::View
9862         call.
9863         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9864         remove contents_
9865         (File_read::View::Data_ownership): New enum.
9866         (File_read::View::View): Replace bool mapped_ with Data_ownership
9867         argument.
9868         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9869         (File_read::View::data_ownership_): New field.
9870         (File_read::contents_): Remove (replaced by whole_file_view_).
9871         (File_read::whole_file_view_): New field.
9872         * options.h (class General_options): Add --keep-files-mapped.
9873
9874 2009-10-27  Cary Coutant  <ccoutant@google.com>
9875
9876         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9877         * testsuite/Makefile.am (plugin_test_5): New test case.
9878         * testsuite/Makefile.in: Regenerate.
9879
9880 2009-10-25  Doug Kwan  <dougkwan@google.com>
9881
9882         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9883         from private to protected to allow access by child class.
9884         (Sized_relobj::do_relocate_sections): New method declaration.
9885         (Sized_relobj::relocate_sections): Virtualize.
9886         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9887         Sized_relobj::relocate_sections.  Instantiate template explicitly
9888         for different target sizes and endianity.
9889
9890 2009-10-24  Doug Kwan  <dougkwan@google.com>
9891
9892         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9893         (Arm_input_section::as_arm_input_section): New method.
9894         (Arm_output_section): New class definition.
9895         (Arm_output_section::create_stub_group,
9896         Arm_output_section::group_sections): New method definitions.
9897
9898 2009-10-22  Doug Kwan  <dougkwan@google.com>
9899
9900         * arm.cc (Arm_input_section): New class definition.
9901         (Arm_input_section::init, Arm_input_section:do_write,
9902         Arm_input_section::set_final_data_size,
9903         Arm_input_section::do_reset_address_and_file_offset): New method
9904         definitions.
9905
9906 2009-10-21  Doug Kwan  <dougkwan@google.com>
9907
9908         * arm.cc (Stub_table, Arm_input_section): New forward class
9909         declarations.
9910         (Stub_table): New class defintion.
9911         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9912         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9913         New method definition.
9914
9915 2009-10-21  Doug Kwan  <dougkwan@google.com>
9916
9917         * arm.cc: Update copyright comments.
9918         (Target_arm): New forward class template declaration.
9919         (Arm_address): New type.
9920         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9921         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9922         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9923         constants.
9924         (Insn_template): Same.
9925         (DEF_STUBS): New macro.
9926         (Stub_type): New enum type.
9927         (Stub_template): New class definition.
9928         (Stub): Same.
9929         (Reloc_stub): Same.
9930         (Stub_factory): Same.
9931         (Target_arm::Target_arm): Initialize may_use_blx_ and
9932         should_force_pic_veneer_.
9933         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9934         Target_arm::should_force_pic_veneer,
9935         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9936         Target_arm::using_thumb_only, Target_arm:;default_target): New
9937         method defintions.
9938         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9939         New data member declarations.
9940         (Insn_template::size, Insn_template::alignment): New method defintions.
9941         (Stub_template::Stub_template): New method definition.
9942         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9943         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9944         (Stub_factory::Stub_factory): New method definition.
9945         * gold.h (string_hash): New template.
9946         * output.h (Input_section_specifier::hash_value): Use
9947         gold::string_hash.
9948         (Input_section_specifier::string_hash): Remove.
9949         * stringpool.cc (Stringpool_template::string_hash): Use
9950         gold::string_hash.
9951
9952 2009-10-20  Doug Kwan  <dougkwan@google.com>
9953
9954         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9955         symbols of relaxed input sections.
9956         * output.h (Output_section::find_relaxed_input_section): Make
9957         method public.
9958
9959 2009-10-16  Doug Kwan  <dougkwan@google.com>
9960
9961         * dynobj.cc (Versions::Versions): Initialize version_script_.
9962         Only insert base version symbol definition for a shared object
9963         if version script defines any version versions.
9964         (Versions::define_base_version): New method definition.
9965         (Versions::add_def): Check that base version is not needed.
9966         (Versions::add_need): Define base version lazily.
9967         * dynobj.h (Versions::define_base_version): New method declaration.
9968         (Versions::needs_base_version_): New data member declaration.
9969         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9970         (check_DATA): Add no_version_test.stdout.
9971         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9972         New make rules.
9973         * testsuite/Makefile.in: Regenerate.
9974         * testsuite/no_version_test.c: New file.
9975         * testsuite/no_version_test.sh: Ditto.
9976
9977 2009-10-16  Doug Kwan  <dougkwan@google.com>
9978
9979         * expression.cc (class Segment_start_expression): New class definition.
9980         (Segment_start_expression::value): New method definition.
9981         (script_exp_function_segment_start): Return a new
9982         Segment_start_expression.
9983         * gold/script-c.h (script_saw_segment_start_expression): New function
9984         prototype.
9985         * script-sections.cc (Script_sections::Script_sections): Initialize
9986         SAW_SEGMENT_START_EXPRESSION_ to false.
9987         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9988         and -Tbbs options to specify section addresses if given in
9989         command line and no SEGMENT_START expression is seen in a script.
9990         * script-sections.h (Script_sections::saw_segment_start_expression,
9991         Script_sections::set_saw_segment_start_expression): New method
9992         definition.
9993         (Script_sections::saw_segment_start_expression_): New data member
9994         declaration.
9995         * script.cc (script_saw_segment_start_expression): New function.
9996         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9997         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9998         script_test_7.sh and script_test_8.sh.
9999         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10000         script_test_8.stdout.
10001         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10002         (script_test_6, script_test_6.stdout, script_test_7,
10003         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10004         * Makefile.in: Regenerate.
10005         * testsuite/script_test_6.sh: New file.
10006         * testsuite/script_test_6.t: Same.
10007         * testsuite/script_test_7.sh: Same.
10008         * testsuite/script_test_7.t: Same.
10009         * testsuite/script_test_8.sh: Same.
10010
10011 2009-10-16  Doug Kwan  <dougkwan@google.com>
10012
10013         * output.cc (Output_segment::set_section_list_address): Cast
10014         expressions to unsigned long long type to avoid format warnings.
10015
10016 2009-10-15  Ian Lance Taylor  <iant@google.com>
10017
10018         * script.cc (Script_options::add_symbol_assignment): Always add a
10019         dot assignment to script_sections_.
10020         * script-sections.cc (Script_sections::add_dot_assignment):
10021         Initialize if necessary.
10022
10023         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10024         program headers with no load segment if there is a linker script.
10025
10026         * layout.cc (Layout::set_segment_offsets): Align the file offset
10027         to the segment aligment for -N or -n with no load segment.
10028         * output.cc (Output_segment::add_output_section): Don't crash if
10029         the first section is a TLS section.
10030         (Output_segment::set_section_list_addresses): Print an error
10031         message if the address moves backward in a linker script.
10032         * script-sections.cc
10033         (Output_section_element_input::set_section_addresses): Don't
10034         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10035         (Orphan_output_section::set_section_addresses): Likewise.
10036
10037 2009-10-15  Doug Kwan  <dougkwan@google.com>
10038
10039         * layout.cc (Layout::finish_dynamic_section): Generate tags
10040         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10041         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10042         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10043
10044 2009-10-14  Ian Lance Taylor  <iant@google.com>
10045
10046         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10047         fields.
10048         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10049         data_shdr fields of relinfo.
10050         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10051         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10052         R_386_TLS_LDO_32, adjust based on section flags.
10053         (Target_i386::Relocate::fix_up_ldo): Remove.
10054
10055 2009-10-13  Ian Lance Taylor  <iant@google.com>
10056
10057         Add support for -pie.
10058         * options.h (class General_options): Add -pie and
10059         --pic-executable.
10060         (General_options::output_is_position_independent): Test -pie.
10061         (General_options::output_is_executable): Return true if not shared
10062         and not relocatable.
10063         (General_options::output_is_pie): Remove.
10064         * options.cc (General_options::finalize): Reject incompatible uses
10065         of -pie.
10066         * gold.cc (queue_middle_tasks): A -pie link is not static.
10067         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10068         * symtab.cc (Symbol::final_value_is_known): Return false if
10069         output_is_position_independent.
10070         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10071         output_is_position_independent.
10072         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10073         output_is_position_independent.
10074         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10075         output_is_position_independent.
10076         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10077         two_file_pie_test.
10078         (basic_pie_test.o, basic_pie_test): New targets.
10079         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10080         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10081         (two_file_pie_test): New target.
10082         * testsuite/Makefile.in: Rebuild.
10083         * README: Remove note saying that -pie is not supported.
10084
10085 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10086
10087         * options.h (class General_options): Add -init and -fini.
10088         * layout.cc (Layout::finish_dynamic_section): Emit
10089         given init and fini functions.
10090
10091 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10092
10093         * gc.h (gc_process_relocs): Check if icf is enabled using new
10094         function.
10095         * gold.cc (queue_initial_tasks): Likewise.
10096         (queue_middle_tasks): Likewise.
10097         * object.cc (do_layout): Likewise.
10098         * symtab.cc (is_section_folded): Likewise.
10099         * main.cc (main): Likewise.
10100         * reloc.cc (Read_relocs::run): Likewise.
10101         (Sized_relobj::do_scan_relocs): Likewise.
10102         * icf.cc (is_function_ctor_or_dtor): New function.
10103         (Icf::find_identical_sections): Check if function is ctor or dtor when
10104         safe icf is chosen.
10105         * options.h (General_options::icf): Change option to be an enum.
10106         (Icf_status): New enum.
10107         (icf_enabled): New method.
10108         (icf_safe_folding): New method.
10109         (set_icf_status): New method.
10110         (icf_status_): New variable.
10111         * (options.cc) (General_options::finalize): Set icf_status_.
10112         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10113         icf_test and icf_keep_unique_test to use the --icf enum flag.
10114         * testsuite/icf_safe_test.sh: New file.
10115         * testsuite/icf_safe_test.cc: New file.
10116
10117 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10118
10119         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10120         includes to gc.h and icf.h.
10121         * arm.cc: Include gc.h.
10122         * gold.cc: Likewise.
10123         * i386.cc: Likewise.
10124         * powerpc.cc: Likewise.
10125         * sparc.cc: Likewise.
10126         * x86_64.cc: Likewise.
10127         * gc.h: Include icf.h.
10128
10129 2009-10-11  Ian Lance Taylor  <iant@google.com>
10130
10131         * plugin.cc: Include "gold.h" before other header files.
10132
10133 2009-10-10  Chris Demetriou  <cgd@google.com>
10134
10135         * options.h (Input_file_argument::Input_file_type): New enum.
10136         (Input_file_argument::is_lib_): Replace with...
10137         (Input_file_argument::type_): New member.
10138         (Input_file_argument::Input_file_argument): Take Input_file_type
10139         'type' rather than boolean 'is_lib' as second argument.
10140         (Input_file_argument::is_lib): Use type_.
10141         (Input_file_argument::is_searched_file): New function.
10142         (Input_file_argument::may_need_search): Handle is_searched_file.
10143         * options.cc (General_options::parse_library): Support -l:filename.
10144         (General_options::parse_just_symbols): Update for Input_file_argument
10145         changes.
10146         (Command_line::process): Likewise.
10147         * archive.cc (Archive::get_file_and_offset): Likewise.
10148         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10149         * script.cc (read_script_file, script_add_file): Likewise.
10150         * fileread.cc (Input_file::Input_file): Likewise.
10151         (Input_file::will_search_for): Handle is_searched_file.
10152         (Input_file::open): Likewise.
10153         * readsyms.cc (Read_symbols::get_name): Likewise.
10154         * testsuite/Makefile.am (searched_file_test): New test.
10155         * testsuite/Makefile.in: Regenerate.
10156         * testsuite/searched_file_test.cc: New file.
10157         * testsuite/searched_file_test_lib.cc: New file.
10158
10159 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10160             Ian Lance Taylor  <iant@google.com>
10161
10162         * descriptor.cc: Include <cstdio> and "binary-io.h".
10163         (Descriptors::open): Open the files in binary mode always.
10164         * script.cc (Lex::get_token): Treat \r as whitespace.
10165
10166 2009-10-09  Ian Lance Taylor  <iant@google.com>
10167
10168         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10169
10170 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10171             Ian Lance Taylor  <iant@google.com>
10172
10173         * configure.ac: Check for readv function also.
10174         * fileread.cc (readv): Define if not HAVE_READV.
10175         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10176         does not exist.
10177         * config.in: Regenerate.
10178         * configure: Regenerate.
10179
10180 2009-10-09  Doug Kwan  <dougkwan@google.com>
10181
10182         * layout.cc (Layout::make_output_section): Call target hook to make
10183         ordinary output section.
10184         (Layout::finalize): Adjust parameter list of call the
10185         Target::may_relax().
10186         * layout.h (class Layout::section_list): New method.
10187         * merge.h (Output_merge_base::entsize): Change visibility to public.
10188         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10189         New methods.
10190         (Output_merge_string::do_is_string): New method.
10191         * object.cc (Sized_relobj::do_setup): renamed from
10192         Sized_relobj::set_up.
10193         * object.h (Sized_relobj::adjust_shndx,
10194         Sized_relobj::initializ_input_to_output_maps,
10195         Sized_relobj::free_input_to_output_maps): Change visibilities to
10196         protected.
10197         (Sized_relobj::setup): Virtualize.
10198         (Sized_relobj::do_setup): New method declaration.
10199         (Sized_relobj::invalidate_section_offset,
10200         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10201         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10202         * options.cc (parse_int): New function.
10203         * options.h (parse_int): New declaration.
10204         (DEFINE_int): New macro.
10205         (stub_group_size): New option.
10206         * output.cc (Output_section::Output_section): Initialize memebers
10207         merge_section_map_, merge_section_by_properties_map_,
10208         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10209         (Output_section::add_input_section): Handled deferred code-fill
10210         generation and remove an old comment.
10211         (Output_section::add_relaxed_input_section): New method definition.
10212         (Output_section::add_merge_input_section): Use merge section by
10213         properties map to speed to search.  Update merge section maps
10214         as appropriate.
10215         (Output_section::build_relaxation_map): New method definition.
10216         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10217         Same.
10218         (Output_section::relax_input_section): Renamed to
10219         Output_section::convert_input_sections_to_relaxed_sections and change
10220         interface to take a vector of pointers to relaxed sections.
10221         (Output_section::find_merge_section,
10222         Output_section::find_relaxed_input_section): New method definitions.
10223         (Output_section::is_input_address_mapped,
10224         Output_section::output_offset, Output_section::output_address):
10225         Use output section data maps to speed up searching.
10226         (Output_section::find_starting_output_address): Add comments.
10227         (Output_section::do_write,
10228         Output_section::write_to_postprocessing_buffer): Do code-fill
10229         generation as appropriate.
10230         (Output_section::get_input_sections): Invalidate relaxed input section
10231         map.
10232         (Output_section::restore_states): Adjust type of checkpoint .
10233         Invalidate relaxed input section map.
10234         * output.h (Output_merge_base): New class declaration.
10235         (Input_section_specifier): New class defintion.
10236         (class Output_relaxed_input_section) Change base class to
10237         Output_section_data_build.
10238         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10239         base class initializer.
10240         (Output_section::add_relaxed_input_section): New method declaration.
10241         (Output_section::Input_section): Change visibility to protected.
10242         (Output_section::Input_section::relobj,
10243         Output_section::Input_section::shndx): Handle relaxed input sections.
10244         Output_section::input_sections) Change visibility to protected.  Also
10245         define overload to return a non-const pointer.
10246         (Output_section::Merge_section_properties): New class defintion.
10247         (Output_section::Merge_section_by_properties_map,
10248         Output_section::Output_section_data_by_input_section_map,
10249         Output_section::Relaxation_map): New types.
10250         (Output_section::relax_input_section): Rename method to
10251         Output_section::convert_input_sections_to_relaxed_sections and change
10252         interface to take a vector of relaxed section pointers.
10253         (Output_section::find_merge_section,
10254         Output_section::find_relaxed_input_section,
10255         Output_section::build_relaxation_map,
10256         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10257         New method declarations.
10258         (Output_section::merge_section_map_
10259         Output_section::merge_section_by_properties_map_,
10260         Output_section::relaxed_input_section_map_,
10261         Output_section::is_relaxed_input_section_map_valid_,
10262         Output_section::generate_code_fills_at_write_): New data members.
10263         * script-sections.cc
10264         (Output_section_element_input::set_section_addresses): Call
10265         current_data_size and addralign methods of relaxed input sections.
10266         (Orphan_output_section::set_section_addresses): Call current_data_size
10267         and addralign methods of relaxed input sections.
10268         * symtab.cc (Symbol_table::compute_final_value): Extract template
10269         from the body of Symbol_table::sized_finalize_symbol.
10270         (Symbol_table::sized_finalized_symbol): Call
10271         Symbol_table::compute_final_value.
10272         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10273         (Symbol_table::compute_final_value): New templated method declaration.
10274         * target.cc (Target::do_make_output_section): New method defintion.
10275         * target.h (Target::make_output_section): New method declaration.
10276         (Target::relax): Add more parameters for input objects, symbol table
10277         and layout.  Adjust call to do_relax.
10278         (Target::do_make_output_section): New method declaration.
10279         (Target::do_relax): Add parameters for input objects, symbol table
10280         and layout.
10281
10282 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10283
10284         * pread.c: Include stdio.h.
10285
10286 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10287
10288         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10289         defined.
10290
10291 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10292
10293         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10294         Change read_shndx type to unsigned int.
10295         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10296         int.
10297         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10298         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10299         Change read_shndx type to unsigned int.
10300         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10301         int.
10302         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10303         * layout.cc (Layout::create_symtab_sections): Cast the result of
10304         local_symcount * symsize to off_t in the gold_assert.
10305
10306 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10307
10308         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10309         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10310         R_ARM_BASE_ABS.
10311         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10312         (Arm_relocate_functions::thm_abs5): New function.
10313         (Arm_relocate_functions::abs12): New function.
10314         (Arm_relocate_functions::abs16): New function.
10315         (Arm_relocate_functions::base_abs): New function.
10316         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10317         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10318         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10319         R_ARM_BASE_ABS.
10320         (Scan::global): Likewise.
10321         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10322         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10323         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10324         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10325         R_ARM_BASE_ABS.
10326
10327 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10328
10329         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10330         (Arm_relocate_functions::movt_prel): New function.
10331         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10332         (Arm_relocate_functions::thm_movt_prel): New function.
10333         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10334         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10335         (Scan::global, Relocate::relocate): Likewise.
10336         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10337
10338 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10339
10340         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10341         Incremental_checker.
10342         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10343         unsigned int.
10344         (class Incremental_inputs_header): New class.
10345         (Incremental_inputs_header_writer): Edit comment.
10346         (Incremental_inputs_entry): New class.
10347         (Incremental_inputs_entry_writer): Edit comment.
10348         (Sized_incremental_binary::do_find_incremental_inputs_section):
10349         Add *strtab_shndx parameter, fill it.
10350         (Sized_incremental_binary::do_check_inputs): New method.
10351         (Incremental_checker::can_incrementally_link_output_file): Use
10352         Sized_incremental_binary::check_inputs.
10353         (Incremental_inputs::report_command_line): Save command line in
10354         command_line_.
10355         * incremental.h:
10356         (Incremental_binary::find_incremental_inputs_section): New
10357         method.
10358         (Incremental_binary::do_find_incremental_inputs_section): Add
10359         strtab_shndx parameter.
10360         (Incremental_binary::do_check_inputs): New pure virtual method.
10361         (Sized_incremental_binary::do_check_inputs): Declare.
10362         (Incremental_checker::Incremental_checker): Add incremental_inputs
10363         parameter, use it to initialize incremental_inputs_.
10364         (Incremental_checker::incremental_inputs_): New field.
10365         (Incremental_checker::command_line): New method.
10366         (Incremental_checker::inputs): New method.
10367         (Incremental_checker::command_line_): New field.
10368
10369 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10370
10371         * incremental.cc: Include <cstdarg> and "target-select.h".
10372         (vexplain_no_incremental): New function.
10373         (explain_no_incremental): New function.
10374         (Incremental_binary::error): New method.
10375         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10376         method.
10377         (make_sized_incremental_binary): New function.
10378         (open_incremental_binary): New function.
10379         (can_incrementally_link_file): Add checks if output is ELF and has
10380         inputs section.
10381         * incremental.h: Include "elfcpp_file.h" and "output.h".
10382         (Incremental_binary): New class.
10383         (Sized_incremental_binary): New class.
10384         (open_incremental_binary): Declare.
10385         * object.cc (is_elf_object): Use
10386         elfcpp::Elf_recognizer::is_elf_file.
10387         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10388         * output.h (Output_file::filesize): New method.
10389
10390 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10391
10392         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10393         New function.
10394         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10395         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10396         function.
10397         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10398         function.
10399         (Arm_relocate_functions::movw_abs_nc): New function.
10400         (Arm_relocate_functions::movt_abs): New function.
10401         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10402         (Arm_relocate_functions::thm_movt_abs): New function.
10403         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10404         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10405         (Scan::global): Likewise.
10406         (Relocate::relocate): Likewise.
10407         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10408
10409 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10410
10411         * arm.cc (Arm_relocate_functions::got_prel) New function.
10412         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10413         (Relocate::relocate): Likewise.
10414         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10415
10416 2009-10-06  Ian Lance Taylor  <iant@google.com>
10417
10418         * options.h (class General_options): Define
10419         split_stack_adjust_size parameter.
10420         * object.h (class Object): Add uses_split_stack_ and
10421         has_no_split_stack_ fields.  Add uses_split_stack and
10422         has_no_split_stack accessor functions.  Declare
10423         handle_split_stack_section.
10424         (class Reloc_symbol_changes): Define.
10425         (class Sized_relobj): Define Function_offsets.  Declare
10426         split_stack_adjust, split_stack_adjust_reltype, and
10427         find_functions.
10428         * object.cc (Object::handle_split_stack_section): New function.
10429         (Sized_relobj::do_layout): Call handle_split_stack_section.
10430         * dynobj.cc (Sized_dynobj::do_layout): Call
10431         handle_split_stack_section.
10432         * reloc.cc (Sized_relobj::relocate_sections): Call
10433         split_stack_adjust for executable sections in split_stack
10434         objects.  Pass reloc_map to relocate_section.
10435         (Sized_relobj::split_stack_adjust): New function.
10436         (Sized_relobj::split_stack_adjust_reltype): New function.
10437         (Sized_relobj::find_functions): New function.
10438         * target-reloc.h: Include "object.h".
10439         (relocate_section): Add reloc_symbol_changes parameter.  Change
10440         all callers.
10441         * target.h (class Target): Add calls_non_split method.  Declare
10442         do_calls_non_split virtual method.  Declare match_view and
10443         set_view_to_nop.
10444         * target.cc: Include "elfcpp.h".
10445         (Target::do_calls_non_split): New function.
10446         (Target::match_view): New function.
10447         (Target::set_view_to_nop): New function.
10448         * gold.cc (queue_middle_tasks): Give an error if mixing
10449         split-stack and non-split-stack objects with -r.
10450         * i386.cc (Target_i386::relocate_section): Add
10451         reloc_symbol_changes parameter.
10452         (Target_i386::do_calls_non_split): New function.
10453         * x86_64.cc (Target_x86_64::relocate_section): Add
10454         reloc_symbol_changes parameter.
10455         (Target_x86_64::do_calls_non_split): New function.
10456         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10457         parameter.
10458         * powerpc.cc (Target_powerpc::relocate_section): Add
10459         reloc_symbol_changes parameter.
10460         * sparc.cc (Target_sparc::relocate_section): Add
10461         reloc_symbol_changes parameter.
10462         * configure.ac: Call AM_CONDITIONAL for the default target.
10463         * configure: Rebuild.
10464         * testsuite/Makefile.am (TEST_AS): New variable.
10465         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10466         (check_DATA): Add split_i386 and split_x86_64 files.
10467         (SPLIT_DEFSYMS): Define.
10468         (split_i386_[1234n].o): New targets.
10469         (split_i386_[124]): New targets.
10470         (split_i386_[1234r].stdout): New targets.
10471         (split_x86_64_[1234n].o): New targets.
10472         (split_x86_64_[124]): New targets.
10473         (split_x86_64_[1234r].stdout): New targets.
10474         (MOSTLYCLEANFILES): Add new executables.
10475         * testsuite/split_i386.sh: New file.
10476         * testsuite/split_x86_64.sh: New file.
10477         * testsuite/split_i386_1.s: New file.
10478         * testsuite/split_i386_2.s: New file.
10479         * testsuite/split_i386_3.s: New file.
10480         * testsuite/split_i386_4.s: New file.
10481         * testsuite/split_i386_n.s: New file.
10482         * testsuite/split_x86_64_1.s: New file.
10483         * testsuite/split_x86_64_2.s: New file.
10484         * testsuite/split_x86_64_3.s: New file.
10485         * testsuite/split_x86_64_4.s: New file.
10486         * testsuite/split_x86_64_n.s: New file.
10487         * testsuite/testfile.cc (Target_test): Update relocation_section
10488         function.
10489         * testsuite/Makefile.in: Rebuild.
10490
10491 2009-10-06  Ian Lance Taylor  <iant@google.com>
10492
10493         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10494         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10495         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10496         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10497         the address on ldo_addrs_.
10498         (Target_i386::Relocate::fix_up_ldo): New function.
10499
10500 2009-10-06   Rafael Espindola  <espindola@google.com>
10501
10502         * plugin.cc (add_input_library): New.
10503         (Plugin::load): Add add_input_library to tv.
10504         (Plugin_manager::add_input_file): Add the is_lib argument.
10505         (add_input_file): Update call to Plugin_manager::add_input_file.
10506         (add_input_library): New.
10507         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10508
10509 2009-09-30  Doug Kwan  <dougkwan@google.com>
10510
10511         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10512         symbol and call Symbol::may_need_copy_reloc to determine if
10513         a copy reloc is needed.
10514         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10515         nocopyreloc is given in command line.
10516         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10517         given in command line.
10518         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10519         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10520         of the removed Target_i386::may_need_copy_reloc.
10521         * options.h (copyreloc): New option with default value false.
10522         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10523         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10524         instead of the removed Target_powerpc::may_need_copy_reloc.
10525         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10526         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10527         instead of the removed Target_sparc::may_need_copy_reloc.
10528         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10529         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10530         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10531         instead of the removed Target_x86_64::may_need_copy_reloc.
10532
10533 2009-09-30  Ian Lance Taylor  <iant@google.com>
10534
10535         * object.h (class Object): Remove target_ field, and target,
10536         sized_target, and set_target methods.
10537         (Object::sized_target): Remove.
10538         (class Sized_relobj): Update declarations.  Remove sized_target.
10539         * object.cc (Sized_relobj::setup): Remove target parameter.
10540         Change all callers.
10541         (Input_objects::add_object): Don't do anything with the target.
10542         (make_elf_sized_object): Add punconfigured parameter.  Change all
10543         callers.  Set or test parameter target.
10544         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10545         Change all callers.
10546         * parameters.cc (Parameters::set_target): Change parameter type to
10547         be non-const.
10548         (Parameters::default_target): Remove.
10549         (set_parameters_target): Change parameter type to be non-const.
10550         (parameters_force_valid_target): New function.
10551         (parameters_clear_target): New function.
10552         * parameters.h (class Parameters): Update declarations.  Remove
10553         default_target method.  Add sized_target and clear_target
10554         methods.  Change target_ to be non-const.
10555         (set_parameters_target): Update declaration.
10556         (parameters_force_valid_target): Declare.
10557         (parameters_clear_target): Declare.
10558         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10559         as NULL if we aren't searching.
10560         (Add_symbols::run): Don't check for compatible target.
10561         * fileread.cc (Input_file::open_binary): Call
10562         parameters_force_valid_target.
10563         * gold.cc (queue_middle_tasks): Likewise.
10564         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10565         set_target on object.
10566         * dynobj.h (class Sized_dynobj): Update declarations.
10567         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10568         make_elf_object returns NULL.
10569         (Archive::include_member): Don't check whether object target is
10570         compatible.
10571         * output.cc (Output_section::add_input_section): Get target from
10572         parameters.
10573         (Output_section::relax_input_section): Likewise.
10574         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10575         parameters.
10576         (Sized_relobj::do_scan_relocs): Likewise.
10577         (Sized_relobj::relocate_sections): Likewise.
10578         * resolve.cc (Symbol_table::resolve): Likewise.
10579         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10580         parameter.  Change all callers.
10581         (Symbol_table::add_from_object): Get target from parameters.
10582         (Symbol_table::add_from_relobj): Don't check object target.
10583         (Symbol_table::add_from_dynobj): Likewise.
10584         (Symbol_table::define_special_symbol): Get target from
10585         parameters.
10586         * symtab.h (class Symbol_table): Update declaration.
10587         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10588         parameter.  Change all callers.  Clear parameter target.
10589         (Binary_test): Test target here.
10590         * testsuite/object_unittest.cc (gold_testsuite): Remove
10591         target_test_pointer parameter.  Change all callers.
10592         (Object_test): Test target here.
10593
10594 2009-09-26  Ian Lance Taylor  <iant@google.com>
10595
10596         * testsuite/initpri1.c: Don't try to use constructor priorities if
10597         compiling with gcc before 4.3.
10598
10599 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10600
10601         * testsuite/retain_symbols_file_test.sh (check_present): Change
10602         output file name to retain_symbols_file_test.stdout.
10603         (check_absent): Likewise.
10604
10605 2009-09-18  Craig Silverstein  <csilvers@google.com>
10606
10607         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10608         * options.cc: Include <cerrno> and <fstream>.
10609         (General_options::finalize): Parse -retain-symbols-file tag.
10610         * options.h: New flag.
10611         (General_options): New method should_retain_symbol, new
10612         variable symbols_to_retain.
10613         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10614         should_retain_symbol map.
10615         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10616         * testsuite/Makefile.in: Regenerate.
10617         * testsuite/retain_symbols_file_test.sh: New file.
10618
10619 2009-09-18  Nick Clifton  <nickc@redhat.com>
10620
10621         * po/es.po: Updated Spanish translation.
10622
10623 2009-09-17  Doug Kwan  <dougkwan@google.com>
10624
10625         * debug.h (DEBUG_RELAXATION): New constant.
10626         (DEBUG_ALL): Add DEBUG_RELAXATION.
10627         (debug_string_to_enum): Add relaxation debug option.
10628         * layout.cc
10629         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10630         Layout::Relaxation_debug_check::read_sections,
10631         Layout::Relaxation_debug_check::read_sections): New method definitions.
10632         (Layout::Layout): Initialize data members
10633         record_output_section_data_from_scrips_,
10634         script_output_section_data_list_ and relaxation_debug_check_.
10635         (Layout::save_segments, Layout::restore_segments,
10636         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10637         Layout::relaxation_loop_body): New method definitions.
10638         (Layout::finalize): Support relaxation.  Move section layout code to
10639         Layout::relaxation_loop_body.
10640         (Layout::set_asection_address_from_script): Move code for orphan
10641         section placement out.
10642         (Layout::place_orphan_sections_in_script): New method definition.
10643         * layout.h (Output_segment_headers, Output_file_header):
10644         New forward class declarations.
10645         (Layout::~Layout): Define.
10646         (Layout::new_output_section_data_from_script): New method definition.
10647         (Layout::place_orphan_sections_in_script): New method declaration.
10648         (Layout::Segment_states): New type declaration.
10649         (Layout::save_segments, Layout::restore_segments,
10650         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10651         Layout::relaxation_loop_body): New method declarations.
10652         (Layout::Output_section_data_list): New type declaration.
10653         (Layout::Relaxation_debug_check): New class definition.
10654         (Layout::record_output_section_data_from_script_,
10655         Layout::script_output_section_data_list_, Layout::segment_states_,
10656         Layout::relaxation_debug_check_): New data members.
10657         * output.cc: (Output_section_headers::do_size): New method definition.
10658         (Output_section_headers::Output_section_headers): Move size
10659         computation to Output_section_headers::do_size.
10660         (Output_segment_headers::do_size): New method definition.
10661         (Output_file_header::Output_file_header): Move size computation to
10662         Output_file_header::do_size and call it.
10663         (Output_file_header::do_size): New method definition.
10664         (Output_data_group::Output_data_group): Adjust call to
10665         Output_section_data.
10666         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10667         (Output_symtab_xindex::do_write): Add array bound check.
10668         (Output_section::Input_section::print_to_mapfile): Handle
10669         RELAXED_INPUT_SECTION_CODE.
10670         (Output_section::Output_section): Initialize data member checkpoint_.
10671         (Output_section::~Output_section): Delete checkpoint object pointed
10672         by checkpoint_.
10673         (Output_section::add_input_section): Always add an Input_section if
10674         relaxing.
10675         (Output_section::add_merge_input_section): Add assert.
10676         (Output_section::relax_input_section): New method definition.
10677         (Output_section::set_final_data_size): Set load address to zero for
10678         an unallocated section.
10679         (Output_section::do_address_and_file_offset_have_reset_values):
10680         New method definition.
10681         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10682         Handle relaxed input section.
10683         (Output_section::sort_attached_input_sections): Checkpoint input
10684         section list lazily.
10685         (Output_section::get_input_sections): Change type of input_sections to
10686         list of Simple_input_section pointers.  Checkpoint input section list
10687         lazily.  Also handle relaxed input sections.
10688         (Output_section::add_input_section_for_script): Take a reference to
10689         a Simple_input_section object instead of Relobj pointer and section
10690         index as parameter.  Handle relaxed input sections.
10691         (Output_section::save_states, Output_section::restore_states): New
10692         method definitions.
10693         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10694         (Output_data::is_data_size_fixed): New method definition.
10695         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10696         if it is fixed.
10697         (Output_data::address_and_file_offset_have_reset_values): New method
10698         definition.
10699         (Output_data::do_address_and_file_offset_have_reset_values): New method
10700         definition.
10701         (Output_data::set_data_size): Check that data size is not fixed.
10702         (Output_data::fix_data_size): New method definition.
10703         (Output_data::is_data_size_fixed_): New data member.
10704         (Output_section_headers::set_final_data_size): New method definition.
10705         (Output_section_headers::do_size): New method declaration.
10706         (Output_segment_headers::set_final_data_size): New method definition.
10707         (Output_segment_headers::do_size): New method declaration.
10708         (Output_file_header::set_final_data_size)::New method definition.
10709         (Output_file_header::do_size)::New method declaration.
10710         (Output_section_data::Output_section_data): Add new parameter
10711         is_data_size_fixed and use it to fix data size.
10712         (Output_data_const::Output_data_const): Adjust call to base class
10713         constructor and fix data size.
10714         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10715         base class constructor and fix data size.
10716         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10717         base class constructor and fix data size.
10718         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10719         class constructor and fix data size.
10720         (Output_data_group::set_final_data_size): New method definition.
10721         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10722         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10723         class constructor and fix data size.
10724         (Output_relaxed_input_section): New class definition.
10725         (Output_section::Simple_input_section): New class definition.
10726         (Output_section::get_input_sections): Adjust parameter list.
10727         (Output_section::add_input_section_for_script): Same.
10728         (Output_section::save_states, Output_section::restore_states,
10729         Output_section::do_address_and_file_offset_have_reset_values,
10730         (Output_section::Input_section::Input_section): Handle
10731         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10732         Output_relaxed_input_section.
10733         (Output_section::Input_section::is_input_section,
10734         Output_section::Input_section::set_output_section): Handle relaxed
10735         input section.
10736         (Output_section::Input_section::is_relaxed_input_section,
10737         Output_section::Input_section::output_section_data,
10738         Output_section::Input_section::relaxed_input_section): New method
10739         definitions.
10740         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10741         value.
10742         (Output_section::Input_section::u1_): Update comments.
10743         (Output_section::Input_section::u2_): Add new union member poris.
10744         (Output_section::Checkpoint_output_section): New classs definition.
10745         (Output_section::relax_input_section): New method declaration.
10746         (Output_section::checkpoint_): New data member.
10747         (Output_segment): Update comments.
10748         (Output_segment::Output_segment): Un-privatize copy constructor.
10749         (Output_segment::operator=): Un-privatize.
10750         * script-sections.cc (Output_section_element::Input_section_list):
10751         Change element type to Output_section::Simple_input_section.
10752         (Output_section_element_dot_assignment::set_section_addresses):
10753         Register output section data for relaxation clean up.
10754         (Output_data_exression::Output_data_expression): Adjust call to base
10755         constructor to fix data size.
10756         (Output_section_element_data::set_section_addresses): Register
10757         Output_data_expression object for relaxation clean up.
10758         (struct Input_section_info): Replace Relobj pointer and section index
10759         pair with Output_section::Simple_input_section and Convert struct to a
10760         class.
10761         (Input_section_sorter::operator()): Adjust access to
10762         Input_section_info data member to use accessors.
10763         (Output_section_element_input::set_section_addresses): Use layout
10764         parameter.  Adjust code to use Output_section::Simple_input_section
10765         and Input_secction_info classes.  Register filler for relaxation
10766         clean up.
10767         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10768         and section index pair with Output_section::Simple_input_section
10769         class.  Adjust code accordingly.
10770         (Phdrs_element::release_segment): New method definition.
10771         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10772         segment list.
10773         (Script_sections::release_segments): New method definition.
10774         * gold/script-sections.h (Script_sections::release_segments): New
10775         method declaration.
10776         * gold/target.h (Target::may_relax, Target::relax,
10777         Target::do_may_relax, Target::do_relax): New method definitions.
10778
10779 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10780
10781         * arm.cc (has_signed_unsigned_overflow): New function.
10782         (Arm_relocate_functions::abs8): New function.
10783         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10784         (Target_arm::Scan::global): Likewise.
10785         (Target_arm::relocate::relocate): Likewise.
10786         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10787         Likewise.
10788
10789 2009-09-16  Cary Coutant  <ccoutant@google.com>
10790
10791         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10792         * testsuite/Makefile.in: Regenerate.
10793
10794 2009-09-11  Nick Clifton  <nickc@redhat.com>
10795
10796         * po/gold.pot: Updated by the Translation project.
10797
10798 2009-09-08  Cary Coutant  <ccoutant@google.com>
10799
10800         * output.cc (Output_file::open): Add execute permission to empty file.
10801         * testsuite/Makefile.am (permission_test): New test.
10802         * testsuite/Makefile.in: Regenerate.
10803
10804 2009-09-02  Ian Lance Taylor  <iant@google.com>
10805
10806         * output.cc (Output_file::resize): Call map_no_anonymous rather
10807         than map.
10808
10809 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10810
10811         * gold.cc: Include "incremental.h".
10812         (queue_initial_tasks): Call Incremental_checker methods.
10813         * incremental.cc: Include "output.h".
10814         (Incremental_checker::can_incrementally_link_output_file): New
10815         method.
10816         * incremental.h (Incremental_checker): New class.
10817
10818         * output.cc (Output_file::open_for_modification): New method.
10819         (Output_file::map_anonymous): Changed return type to bool.  Record
10820         map in base_ field.
10821         (Output_file::map_no_anonymous): New method, broken out of map.
10822         (Output_file::map): Use map_no_anonymous and map_anonymous.
10823         * output.h (class Output_file): Update declarations.
10824
10825 2009-08-24  Cary Coutant  <ccoutant@google.com>
10826
10827         * options.h (Command_line::Pre_options): New class.
10828         (Command_line::pre_options): New member.
10829         * options.cc (gold::options::ready_to_register): New variable.
10830         (One_option::register_option): Do nothing if not registering options.
10831         Assert if same short option registered twice.
10832         (General_options::General_options): Turn off option registration when
10833         done constructing.
10834         (Command_line::Pre_options::Pre_options): New constructor.
10835
10836 2009-08-24  Cary Coutant  <ccoutant@google.com>
10837
10838         * options.h (General_options::no_keep_memory): Remove incorrect
10839         short option.
10840
10841 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10842
10843         * Makefile.am (am__skiplex, am__skipyacc): New.
10844         * Makefile.in: Regenerate.
10845
10846 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10847
10848         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10849         (INCLUDES): ... this.
10850         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10851         (AM_CPPFLAGS): Renamed from ...
10852         (INCLUDE): ... this.
10853         * Makefile.in, testsuite/Makefile.in: Regenerate.
10854
10855         * Makefile.in: Regenerate.
10856         * aclocal.m4: Likewise.
10857         * config.in: Likewise.
10858         * configure: Likewise.
10859         * testsuite/Makefile.in: Likewise.
10860
10861         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10862         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10863         * Makefile.in: Regenerate.
10864         * testsuite/Makefile.in: Regenerate.
10865
10866 2009-08-19  Cary Coutant  <ccoutant@google.com>
10867
10868         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10869         symbols in shared libraries overridden by hidden or internal symbols
10870         in the main program.
10871
10872 2009-08-19  Chris Demetriou  <cgd@google.com>
10873
10874         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10875         checking source file names in error messages.
10876
10877 2009-08-18  Doug Kwan  <dougkwan@google.com>
10878
10879         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10880         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10881         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10882         an elfcpp::Ehdr as parameter.
10883         * object.cc (Object::set_target): Remove the version that looks up
10884         a target and sets it.
10885         (Sized_relobj::setup): Take a Target object instead of
10886         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10887         (make_elf_sized_object): Find target and ask target to
10888         make an ELF object.
10889         * object.h: (Object::set_target): Remove the version that looks up
10890         a target and sets it.
10891         (Sized_relobj::setup): Take a Target object instead of
10892         an elfcpp:Ehdr as parameter.
10893         * target.cc: Include dynobj.h.
10894         (Target::do_make_elf_object_implementation): New.
10895         (Target::do_make_elf_object): New.
10896         * target.h (Target::make_elf_object): New template declaration.
10897         (Target::do_make_elf_object): New method declarations.
10898         (Target::do_make_elf_object_implementation): New template declaration.
10899
10900 2009-08-14  Ian Lance Taylor  <iant@google.com>
10901
10902         * gold.h (FUNCTION_NAME): Define.
10903         (gold_unreachable): Use FUNCTION_NAME.
10904
10905 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10906
10907         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10908         symbol in the --keep-unique list is not found.
10909
10910 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10911
10912         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10913         been maked as --keep-unique.
10914         (Icf::unfold_section): New function.
10915         * icf.h (Icf::unfold_section): New function.
10916         * options.h (General_options::keep_unique): New option.
10917         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10918         * testsuite/Makefile.in: Regenerate.
10919         * testsuite/icf_keep_unique_test.sh: New file.
10920         * testsuite/icf_keep_unique_test.cc: New file.
10921
10922 2009-08-12  Cary Coutant  <ccoutant@google.com>
10923
10924         PR 10471
10925         * resolve.cc (Symbol_table::resolve): Check for references from
10926         dynamic objects to hidden and internal symbols.
10927         * testsuite/Makefile.am (hidden_test.sh): New test.
10928         * testsuite/Makefile.in: Regenerate.
10929         * testsuite/hidden_test.sh: New script.
10930         * testsuite/hidden_test_1.c: New test source.
10931         * testsuite/hidden_test_main.c: New test source.
10932
10933 2009-08-11  Doug Kwan  <dougkwan@google.com>
10934
10935         * arm.cc: Update comments.
10936         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10937         segment to locate the .ARM.exidx section if present.
10938
10939 2009-08-09  Doug Kwan  <dougkwan@google.com>
10940
10941         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10942         patch.
10943
10944 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10945         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10946         compiler warnings.
10947
10948 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10949
10950         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10951         valid tls_segment only for non-debug-section relocations.
10952         * testsuite/Makefile.am: Add gc_tls_test.
10953         * testsuite/Makefile.in: Regenerate.
10954         * testsuite/gc_tls_test.cc: New file.
10955         * testsuite/gc_tls_test.sh: New file.
10956
10957 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10958
10959         * icf.cc: New file.
10960         * icf.h: New file.
10961         * Makefile.am (CCFILES): Add icf.cc.
10962         (HFILES): Add icf.h
10963         * Makefile.in: Regenerate.
10964         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10965         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10966         section, symbol and addend information for the relocs.
10967         * gold.cc (queue_middle_tasks): Call identical code folding.
10968         * gold.h: Add defines for multimap.
10969         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10970         to the call of finalize_local_symbols.
10971         * main.cc (main): Create object of class Icf.
10972         * object.cc (Sized_relobj::do_layout): Allow this function to be
10973         called twice during icf.
10974         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10975         to sections marked as identical by icf.
10976         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10977         when available.
10978         (Sized_relobj::do_section_entsize): New function.
10979         * object.h (Object::section_entsize): New function.
10980         (Object::do_section_entsize): New pure virtual function.
10981         (Relobj::finalize_local_symbols): Add new parameter.
10982         (Relobj::do_section_entsize): New function.
10983         * options.h (General_options::icf): New option.
10984         (General_options::icf_iterations): New option.
10985         (General_options::print_icf_sections): New option.
10986         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10987         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10988         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10989         icf.
10990         * symtab.cc (Symbol_table::is_section_folded): New function.
10991         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10992         to sections marked as identical by icf.
10993         * symtab.h (Symbol_table::set_icf): New function.
10994         (Symbol_table::icf): New function.
10995         (Symbol_table::is_section_folded): New function.
10996         (Symbol_table::icf_): New data member.
10997         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10998         * testsuite/Makefile.am: Add commands to build icf_test.
10999         * testsuite/Makefile.in: Regenerate.
11000         * testsuite/icf_test.sh: New file.
11001         * testsuite/icf_test.cc: New file.
11002
11003 2009-07-24  Chris Demetriou  <cgd@google.com>
11004
11005         * layout.cc (is_compressible_debug_section): Fix incorrect
11006         comment about compressed section names.
11007
11008 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11009
11010         PR 10419
11011         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11012
11013 2009-07-16  Ian Lance Taylor  <iant@google.com>
11014
11015         PR 10400
11016         * layout.h: #include <map>.
11017         (class Kept_section): Change from struct to class.  Add accessors
11018         and setters.  Add section size to Comdat_group mapping.  Change
11019         Comdat_group to std::map.  Add is_comdat_ field.  Add
11020         linkonce_size field in union.
11021         (class Layout): Update declaration of find_or_add_kept_section.
11022         Don't declare find_kept_object.
11023         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11024         parameter.  Add object, shndx, is_comdat, and is_group_name
11025         parameters.  Change all callers.  Adjust for new Kept_section.
11026         (Layout::find_kept_object): Remove.
11027         * object.cc (Sized_relobj::include_section_group): Update use of
11028         Kept_section.  Rename secnum to shndx.  Only record
11029         Kept_comdat_section if sections are the same size.
11030         (Sized_relobj::include_linkonce_section): Update use of
11031         Kept_section.  Only record Kept_comdat_section if sections are the
11032         same size.  Set size of linkonce section.
11033         (Sized_relobj::map_to_kept_section): Update call to
11034         get_kept_comdat_section.
11035         * object.h (class Sized_relobj): Rename fields in
11036         Kept_comdat_section to drop trailing underscores; change object
11037         field to Relobj*.  Change Kept_comdat_section_table to store
11038         struct rather than pointer.
11039         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11040         Add kept_object and kept_shndx parameters.  Change all callers.
11041         (Sized_relobj::get_kept_comdat_section): Change return type to
11042         bool.  Add kept_object and kept_shndx parameters.  Change all
11043         callers.
11044         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11045         Layout::find_or_add_kept_section.
11046
11047 2009-07-09  Ian Lance Taylor  <iant@google.com>
11048
11049         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11050         Reserve space in the hash table.
11051
11052 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11053
11054         * fileread.cc (File_read::get_mtime): New method.
11055         * fileread.h (Timespec): New structure.
11056         (File_read::get_mtime): New method.
11057         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11058         Renamed from timestamp_nsec.
11059         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11060         Elf_Xword.
11061         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11062         timestamp_nsec.
11063         (Incremental_inputs::report_archive): Save mtime; style fix.
11064         (Incremental_inputs::report_obejct): Save mtime; style fix.
11065         (Incremental_inputs::report_script): Save mtime; style fix.
11066         (Incremental_inputs::finalize_inputs): Style fix.
11067         (Incremental_inputs::finalize): Style fix.
11068         (Incremental_inputs::create_input_section_data): Store inputs
11069         mtime.
11070         * incremental.h (Incremental_inputs::report_script): Add mtime
11071         argument.
11072         (Incremental_inputs::Input_info::Input_info): Intialize only one
11073         union member.
11074         (Incremental_inputs::Input_info::archive): Move to nameless
11075         union.
11076         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11077         (Incremental_inputs::Input_info::script): Move to nameless union.
11078         (Incremental_inputs::mtime): New field.
11079         * script.cc (read_input_script): Pass file mtime to
11080         Incremental_input.
11081         * script.h (Script_info::inputs): Style fix.
11082
11083 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11084
11085         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11086         instead of 32.
11087
11088 2009-06-24  Ian Lance Taylor  <iant@google.com>
11089
11090         PR 10156
11091         * layout.cc (Layout::choose_output_section): If we find an
11092         existing section, update the flags.
11093         (Layout::create_notes): New function, broken out of
11094         Layout::finalize.
11095         (Layout::finalize): Don't create note sections.
11096         (Layout::create_note): Don't crash if linker script discards
11097         section.
11098         (Layout::create_gold_note): Likewise.
11099         (Layout::create_build_id): Likewise.  Don't set
11100         after_input_sections on the section.
11101         (Layout::create_executable_stack_info): Remove target parameter.
11102         Change caller.
11103         * layout.h (class Layout): Declare create_notes.  Update
11104         declaration of create_executable_stack_info.
11105         * gold.cc (queue_middle_tasks): Call create_notes.
11106         * output.cc (Output_section::update_flags_for_input_section): Move
11107         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11108         invalid.
11109         * output.h (Output_data::mark_address_invalid): New function.
11110         (class Output_section): Only declare, not define,
11111         update_flags_for_input_section.  Remove set_flags.
11112
11113 2009-06-24  Ian Lance Taylor  <iant@google.com>
11114
11115         * script-sections.cc (Output_section_definition::
11116         set_section_addresses): Rename shadowing local load_address to
11117         laddr.
11118
11119 2009-06-24  Ian Lance Taylor  <iant@google.com>
11120
11121         PR 10244
11122         * reloc.cc (relocate_sections): Skip empty relocation sections.
11123
11124 2009-06-23  Ian Lance Taylor  <iant@google.com>
11125
11126         PR 10156
11127         * layout.cc (Layout::create_note): Use choose_output_section
11128         rather than make_output_section.
11129
11130 2009-06-23  Ian Lance Taylor  <iant@google.com>
11131
11132         PR 10237
11133         * options.cc (General_options::parse_V): Set printed_version_.
11134         (General_options::General_options): Initialize printed_version_.
11135         * options.h (class General_options): Add printed_version_ field.
11136         * gold.cc (queue_initial_tasks): If there are no input files,
11137         don't give a fatal error if we printed the version information.
11138         (queue_middle_tasks): If using -r with a shared object, give a
11139         fatal error rather than an ordinary error.
11140
11141 2009-06-23  Ian Lance Taylor  <iant@google.com>
11142
11143         PR 10219
11144         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11145         (Layout::make_output_section): Set have_stabstr_section_ if we see
11146         a .stab*str section.
11147         (Layout::finalize): Call link_stabs_sections.
11148         (Layout::link_stabs_sections): New file.
11149         * layout.h (class Layout): Add have_stabstr_section_ field.
11150         Declare link_stabs_sections.
11151
11152 2009-06-23  Doug Kwan  <dougkwan@google.com>
11153
11154         * Makefile.am (libgold_a_LIBADD): New.
11155         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11156         * Makefile.in: Regenerate.
11157         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11158         * configure: Regenerate.
11159         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11160         * fileread.cc: Include sys/state.h
11161         * gold.h: Declare memmem and strndup if found missing.
11162         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11163
11164 2009-06-23  Ian Lance Taylor  <iant@google.com>
11165
11166         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11167         * configure: Rebuild.
11168
11169 2009-06-23  Ian Lance Taylor  <iant@google.com>
11170
11171         PR 10147
11172         * object.cc (Object::section_contents): Don't try to get a view if
11173         the section has length zero.
11174         (Object::handle_gnu_warning_section): If the section is empty, use
11175         the name of the section as the warning.
11176
11177 2009-06-23  Ian Lance Taylor  <iant@google.com>
11178
11179         PR 10133
11180         * stringpool.h (class Stringpool_template): Add optimize_ field.
11181         (Stringpool_template::set_optimize): New function.
11182         * stringpool.cc (Stringpool_template::Stringpool_template):
11183         Initialize optimize_ field.
11184         (Stringpool_template::set_string_offsets): Test local optimize
11185         fild rather than parameter.
11186         * layout.cc (Layout::Layout): Call set_optimize on the section
11187         name stringpool.
11188
11189 2009-06-22  Ian Lance Taylor  <iant@google.com>
11190
11191         PR 10030
11192         * yyscript.y: Parse TARGET.
11193         * script.cc (script_set_target): New function.
11194         * script-c.h (script_set_target): Declare.
11195         * options.cc (General_options::string_to_object_format): Rename
11196         from string_to_object_format in anonymous namespace.  Change
11197         callers.
11198         * options.h (class General_options): Declare
11199         string_to_object_format.
11200
11201 2009-06-22  Ian Lance Taylor  <iant@google.com>
11202
11203         * script-sections.cc (Script_sections::create_segments): Don't put
11204         program headers in a PT_LOAD segment if -n or -N.
11205
11206 2009-06-22  Ian Lance Taylor  <iant@google.com>
11207
11208         PR 10141
11209         * options.h (class General_options): Add -z lazy and -z now.  Sort
11210         -z options into alphabetical order.
11211         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11212
11213 2009-06-21  Ian Lance Taylor  <iant@google.com>
11214
11215         * layout.cc (Layout::make_output_section): Call
11216         Target::new_output_section.
11217         (Layout::attach_allocated_section_to_segment): Put large section
11218         sections in a separate load segment with the large segment flag
11219         set.
11220         (Layout::segment_precedes): Sort large data segments after other
11221         load segments.
11222         (align_file_offset): New static function.
11223         (Layout::set_segment_offsets): Use align_file_offset.
11224         * output.h (class Output_section): Add is_small_section_ and
11225         is_large_section_ fields.
11226         (Output_section::is_small_section): New function.
11227         (Output_section::set_is_small_section):  New function.
11228         (Output_section::is_large_section): New function.
11229         (Output_section::set_is_large_section): New function.
11230         (Output_section::is_large_data_section): New function.
11231         (class Output_segment): Add is_large_data_segment_ field.
11232         (Output_segment::is_large_data_segment): New function.
11233         (Output_segment::set_is_large_data_segment): New function.
11234         * output.cc (Output_section::Output_section): Initialize new
11235         fields.
11236         (Output_segment::Output_segment): Likewise.
11237         (Output_segment::add_output_section): Add assertion that large
11238         data sections always go in large data segments.  Force small data
11239         sections to the end of the list of data sections.  Force small BSS
11240         sections to the start of the list of BSS sections.  For large BSS
11241         sections to the end of the list of BSS sections.
11242         * symtab.h (class Symbol): Declare is_common_shndx.
11243         (Symbol::is_defined): Check Symbol::is_common_shndx.
11244         (Symbol::is_common): Likewise.
11245         (class Symbol_table): Define enum Commons_section_type.  Update
11246         declarations.  Add small_commons_ and large_commons_ fields.
11247         * symtab.cc (Symbol::is_common_shndx): New function.
11248         (Symbol_table::Symbol_table): Initialize new fields.
11249         (Symbol_table::add_from_object): Put small and large common
11250         symbols in the right list.
11251         (Symbol_table::sized_finalized_symbol): Check
11252         Symbol::is_common_shndx.
11253         (Symbol_table::sized_write_globals): Likewise.
11254         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11255         common symbol lists.  Don't call do_allocate_commons_list if the
11256         list is empty.
11257         (Symbol_table::do_allocate_commons_list): Remove is_tls
11258         parameter.  Add comons_section_type parameter.  Change all
11259         callers.  Handle small and large common symbols.
11260         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11261         Symbol::is_common_shndx.
11262         * resolve.cc (symbol_to_bits): Likewise.
11263         * target.h (Target::small_common_shndx): New function.
11264         (Target::small_common_section_flags): New function.
11265         (Target::large_common_shndx): New function.
11266         (Target::large_common_section_flags): New function.
11267         (Target::new_output_section): New function.
11268         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11269         small_common_section_flags, and large_common_section_flags
11270         fields.
11271         (Target::do_new_output_section): New virtual function.
11272         * arm.cc (Target_arm::arm_info): Initialize new fields.
11273         * i386.cc (Target_i386::i386_info): Likewise.
11274         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11275         Likewise.
11276         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11277         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11278         (Target_x86_64::do_new_output_section): New function.
11279         * configure.ac: Define conditional MCMODEL_MEDIUM.
11280         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11281         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11282         (large_LDFLAGS): Define.
11283         * testsuite/large.c: New file.
11284         * testsuite/testfile.cc (Target_test::test_target_info):
11285         Initialize new fields.
11286         * configure, testsuite/Makefile.in: Rebuild.
11287
11288 2009-06-05  Doug Kwan  <dougkwan@google.com>
11289
11290         * Makefile.am (CCFILES): Add target.cc.
11291         * Makefile.in: Regenerate.
11292         * i386.cc (class Target_i386): Define new virtual method to
11293         override do_is_local_label_name in parent.
11294         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11295         local symbols if --discard-locals or -X is given.
11296         * options.h (class General_options): Declare new options
11297         '--discard-locals' and '-X' for discarding locals.
11298         * target.h (class Target): Define new methods is_local_label_name.
11299         Declare new virtual method do_is_local_label_name.
11300         * target.cc: New file.
11301         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11302         (check_SCRIPTS): Add discard_locals_test.sh.
11303         (check_DATA): Add discard_local_tests.syms.
11304         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11305         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11306         * testsuite/Makefile.in: Regenerate.
11307         * testsuite/discard_locals_test.c: New file.
11308         * testsuite/discard_locals_test.sh: Same.
11309
11310 2009-06-05  Doug Kwan  <dougkwan@google.com>
11311
11312         * object.cc (Sized_relobj::Sized_relobj): Initialize
11313         discarded_eh_frame_shndx_ to -1U.
11314         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11315         section.
11316         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11317         a discarded .eh_frame section.
11318         (Sized_relobj::do_finalize_local_symbols): Ditto.
11319         * object.h (class Sized_relobj): Declare new member
11320         discarded_eh_frame_shndx_.
11321         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11322         (local_labels_test.o, local_labels_test): New rules.
11323         * testsuite/Makefile.in: Regenerate.
11324
11325 2009-06-04  Doug Kwan  <dougkwan@google.com>
11326
11327         * layout.cc (Layout::section_name_mapping): Add mapping for
11328         special ARM sections.
11329
11330 2009-06-03  Doug Kwan  <dougkwan@google.com>
11331
11332         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11333         (utils::has_overflow): Same.
11334
11335 2009-06-03  Ian Lance Taylor  <iant@google.com>
11336
11337         * layout.cc (Layout::section_name_mapping): New array, replacing
11338         Layout::linkonce_mapping.
11339         (Layout::section_name_mapping_count): New variable, replacing
11340         Layout::linkonce_mapping_count.
11341         (Layout::linkonce_output_name): Remove.
11342         (Layout::output_section_name): Rewrite.
11343         * layout.h (class Layout): Rename Linkonce_mapping to
11344         Section_name_mapping, linkonce_mapping to section_name_mapping,
11345         linkonce_mapping_count to section_name_mapping_count.  Don't
11346         declare linkonce_output_name.
11347
11348 2009-06-03  Doug Kwan  <dougkwan@google.com>
11349
11350         * gold/arm.cc (namespace utils): New.
11351         (Target_arm::reloc_is_non_pic): Define new method.
11352         (class Arm_relocate_functions): New.
11353         (Target_arm::Relocate::relocate): Handle relocation types used by
11354         Android.
11355
11356 2009-06-03  Ian Lance Taylor  <iant@google.com>
11357
11358         * arm.cc (Target_arm::scan::global): Use || instead of |.
11359
11360 2009-06-02  Doug Kwan  <dougkwan@google.com>
11361
11362         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11363         issued_non_pic_error_.
11364         (class Target_arm::Scan): Declare new method check_non_pic.
11365         Define new method symbol_needs_plt_entry.
11366         Declare new data member issued_non_pic_error_.
11367         (class Target_arm::Relocate): Declare new method
11368         should_apply_static_reloc.
11369         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11370         (Target_arm::Scan::check_non_pic): Define new method.
11371         (Target_arm::Scan::local): Handle a small subset of reloc types used
11372         by Android.
11373         (Target_arm::Scan::local): Same.
11374         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11375
11376 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11377
11378         * incremental.cc (Incremental_inputs::report_command_line): Filter
11379         out --incremental-* options.
11380
11381 2009-05-29  Doug Kwan  <dougkwan@google.com>
11382
11383         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11384         template class.
11385         (class Target_arm): Update comment.
11386         (Target_arm::Target_arm): Initialize new data members GOT_,
11387         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11388         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11389         and Target_arm::rel_dyn_section.
11390         Declare new_enum Target_arm::Got_type.
11391         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11392         and DYNBSS_.
11393         Update commments for member do_dynsym_value.
11394         (Target_arm::got_size, Target_arm::plt_section,
11395         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11396         new methods inside class defintion.
11397         (Target_arm::got_section): Define new method.
11398         (Target_arm::rel_dyn_section): Same.
11399         (Output_data_plt_arm): New template class.
11400         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11401         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11402         (Output_data_plt_arm::add_entry): Same.
11403         (Output_data_plt_arm::first_plt_entry): Define new
11404         static data member for PLT instruction template.
11405         (Output_data_plt_arm::plt_entry): Same.
11406         (Output_data_plt_arm::do_write): Define new method.
11407         (Target_arm::make_plt_entry): Same.
11408         (Target_arm::do_finalize_sections): Same.
11409         (Target_arm::do_dynsym_value): Same.
11410
11411 2009-05-28  Doug Kwan  <dougkwan@google.com>
11412
11413         * Makefile.am (TARGETSOURCES): Add arm.cc.
11414         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11415         * Makefile.in: Regenerate.
11416         * arm.cc: New file.
11417         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11418
11419 2009-05-26  Doug Kwan  <dougkwan@google.com>
11420
11421         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11422         (General_options::check_excluded_libs): Strip off directories in
11423         archive name before matching like GNU ld does.
11424         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11425         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11426         (exclude_libs_test_LDFLAGS): Add linker option
11427         -Wl,--exclude-libs,libexclude_libs_test_3
11428         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11429         an explicit archive without using -l.
11430         (alt/libexclude_libs_test_3.a): New make rule.
11431         * testsuite/Makefile.in: Regenerate.
11432         * testsuite/exclude_libs_test.c : Declare lib3_default().
11433         (main): Call it.
11434         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11435         * exclude_libs_test_3.c: New file.
11436
11437 2009-05-26  Nick Clifton  <nickc@redhat.com>
11438
11439         * po/id.po: New Indonesian translation.
11440         * po/gold.pot: Updated template file.
11441
11442 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11443
11444         * testsuite/Makefile.am: Add -ffunction-sections to compile
11445         gc_comdat_test files.  Add -Wl,--gc-sections to build
11446         gc_comdat_test.
11447         * testsuite/Makefile.in: Regenerate.
11448         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11449
11450 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11451
11452         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11453         kept comdat section was garbage collected.
11454         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11455         * testsuite/Makefile.in: Regenerate.
11456         * testsuite/gc_comdat_test.sh: New file.
11457         * testsuite/gc_comdat_test_1.cc: New file.
11458         * testsuite/gc_comdat_test_2.cc: New file.
11459
11460 2009-05-19  Doug Kwan  <dougkwan@google.com>
11461
11462         * archive.cc (Archive::Archive): Move constructor from archive.h
11463         to here.  Initialize no_export_.
11464         (Archive::get_elf_object_for_member): Set no_export flag of object.
11465         * archive.h (Archive::Archive): Move constructor body to
11466         archive.cc.
11467         (Archive::no_export): New method.
11468         (Archive::no_export_): New field.
11469         * object.h (Object::Object): Initialize no_export_ to false.
11470         (Object::no_export, Object::set_no_export): New methods.
11471         (Object::no_export_): New field.
11472         * options.cc (General_options::parse_exclude_libs): New method.
11473         (General_options::check_excluded_libs) Same.
11474         * options.h (exclude_libs): New option.
11475         (General_options::check_excluded_libs): New method declaration.
11476         (General_options::excluded_libs_): New field.
11477         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11478         default or protected visibility if an object has no-export flag set.
11479         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11480         (check_SCRIPTS): Add exclude_libs_test.sh.
11481         (check_DATA): Add exclude_libs_test.syms.
11482         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11483         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11484         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11485         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11486         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11487         libexclude_libs_test_2.a): New rules.
11488         * testsuite/Makefile.in: Regenerate.
11489         * testsuite/exclude_libs_test.c: New file.
11490         * testsuite/exclude_libs_test.sh: Ditto.
11491         * testsuite/exclude_libs_test_1.c: Ditto.
11492         * testsuite/exclude_libs_test_2.c: Ditto.
11493
11494 2009-05-15  Ian Lance Taylor  <iant@google.com>
11495
11496         * configure.ac: Check for declarations for cases where libiberty.h
11497         checks HAVE_DECL_xxx.
11498         * configure, config.in: Rebuild.
11499
11500 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11501
11502         * gold.h (Incremental_argument_list): Remove (invalid) forward
11503         declaration.
11504         * incremental.cc (Incremental_inputs::report_achive): New method.
11505         (Incremental_inputs::report_object): New method.
11506         (Incremental_inputs::report_script): New method.
11507         (Incremental_inputs::finalize_inputs): New method.
11508         (Incremental_inputs::finalize): Call finalize_inputs().
11509         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11510         Create inputs entries.
11511         * incremental.h (Incremental_input_type): New enum.
11512         (Incremental_inputs::Incremental_input): Initialize new fields.
11513         (Incremental_inputs::report_inputs): New method.
11514         (Incremental_inputs::report_achive): New method.
11515         (Incremental_inputs::report_object): New method.
11516         (Incremental_inputs::report_script): New method.
11517         (Incremental_inputs::finalize_inputs): New method.
11518         (Incremental_inputs::Input_info): New struct.
11519         (Incremental_inputs::Input_info_map): New typedef.
11520         (Incremental_inputs::lock_): New field.
11521         (Incremental_inputs::Inputs_): New field.
11522         (Incremental_inputs::Inputs_map): New field.
11523         * main.cc (main): Call Incremental_input::report_inputs.
11524         * options.h (Input_argument_list): Typedef moved from
11525         Input_arguments.
11526         (Input_file_group::Files): Remove, use ::Input_argument_list.
11527         (Input_file_group::Input_argument_list): Remove, use
11528         ::Input_argument_list.
11529         * plugin.cc (Plugin_manager::add_input_file): Add error in
11530         incremental build.
11531         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11532         functions.
11533         * script.cc (read_input_script): Call
11534         Incremental_input::report_script.
11535         * script.h (Script_info): New class.
11536
11537 2009-04-27  Ian Lance Taylor  <iant@google.com>
11538
11539         * x86_64.cc (do_adjust_output_section): Set entsize to
11540         plt_entry_size.
11541
11542 2009-04-23  Elliott Hughes  <enh@google.com>
11543
11544         * output.cc (Output_file::close): After short writes, continue
11545         writing from the correct offset in the buffer being written.
11546
11547 2009-04-23  Chris Demetriou  <cgd@google.com>
11548
11549         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11550         * configure: Regenerate.
11551         * config.in: Regenerate.
11552         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11553         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11554
11555 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11556
11557         * incremental.cc (Incremental_inputs_header_data): Renamed from
11558         Incremental_input_header_data.
11559         (Incremental_inputs_header_data::data_size): New field.
11560         (Incremental_inputs_header_data::put_input_file_count): Renamed
11561         from input_file_count.
11562         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11563         from command_line_offset.
11564         (Incremental_inputs_header_data::put_reserved): Renamed from
11565         put_reserved.
11566         (Incremental_inputs_entry_data): Renamed from
11567         Incremental_input_entry_data.
11568         (Incremental_inputs_entry_data::data_size): New field.
11569         (Incremental_inputs::report_command_line): New method.
11570         (Incremental_inputs::finalize): New method.
11571         (Incremental_inputs::create_incremental_inputs_data): New method.
11572         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11573         * incremental.h: New file.
11574         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11575         (Layout::finalize): Create incremental inputs section in
11576         incremental builds.
11577         (Layout::create_incremental_info_sections): New method.
11578         * layout.h (Layout::incremental_inputs): New method.
11579         (Layout::create_incremental_info_sections): New method.
11580         (Layout::incremental_inputs_): New field.
11581         * main.cc (main): Notify Incremental_input of the command line.
11582
11583 2009-04-01  Ian Lance Taylor  <iant@google.com>
11584             Mikolaj Zalewski  <mikolajz@google.com>
11585
11586         * gold.h (reserve_unordered_map): Define, three versions, one for
11587         each version of Unordered_map.
11588         * layout.cc (Layout::Layout): Remove options parameter.  Add
11589         number_of_input_files parameter.  Don't initialize options_.
11590         Initialize number_of_input_files_ and resized_signatures_.  Move
11591         sections_are_attached_.
11592         (Layout::layout_group): Reserve space for group_signatures_.
11593         (Layout::find_or_add_kept_section): Change name parameter to be a
11594         reference.  Resize signatures_ map when it gets large enough.
11595         (Layout::layout_eh_frame): Use parameters->options() instead of
11596         this->options_.
11597         (Layout::make_output_section): Likewise.
11598         (Layout::attach_allocated_section_to_segment): Likewise.
11599         (Layout::finalize, Layout::create_executable_stack): Likewise.
11600         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11601         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11602         * layout.h (class Layout): Update declarations.  Remove options_
11603         field.  Add number_of_input_files_ and resized_signatures_
11604         fields.  Move sections_are_attached_ field.
11605         * main.cc (main): Pass number of input files to Layout
11606         constructor.  Don't pass options.
11607
11608 2009-03-30  Ian Lance Taylor  <iant@google.com>
11609
11610         * ffsll.c (ffsll): Correct implementation.
11611
11612 2009-03-27  Ian Lance Taylor  <iant@google.com>
11613
11614         * ffsll.c: New file.
11615         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11616         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11617         * ftruncate.c (ftruncate): Declare before definition.
11618         * mremap.c (mremap): Likewise.
11619         * pread.c (pread): Likewise.
11620         * configure, Makefile.in, config.in: Rebuild.
11621
11622         * mremap.c: New file.
11623         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11624         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11625         (mremap): Declare if HAVE_MREMAP is not defined.
11626         * configure, Makefile.in, config.in: Rebuild.
11627
11628 2009-03-27  Cary Coutant  <ccoutant@google.com>
11629
11630         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11631         position independent.
11632         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11633         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11634
11635 2009-03-24  Cary Coutant  <ccoutant@google.com>
11636
11637         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11638         an executable.
11639         (needs_dynamic_reloc): Likewise.
11640
11641 2009-03-24  Ian Lance Taylor  <iant@google.com>
11642
11643         * yyscript.y (file_cmd): Recognize EXTERN.
11644         (extern_name_list, extern_name_list_body): New nonterminals.
11645         * script.cc (script_add_extern): Define.
11646         * script-c.h (script_add_extern): Declare.
11647
11648 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11649
11650         * object.cc (is_elf_object): Define.
11651         * object.h (is_elf_object): Declare.
11652         * archive.cc (Archive::get_elf_object_for_member): Call
11653         is_elf_object.
11654         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11655
11656 2009-03-24  Elliott Hughes  <enh@google.com>
11657
11658         * output.cc (Output_file::map_anonymous): Define.
11659         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11660         try an anonymous one.  Report the size if the mmap fails.
11661         * output.h (class Output_file): Declare map_anonymous.
11662
11663 2009-03-24  Ian Lance Taylor  <iant@google.com>
11664
11665         * target-select.cc (instantiate_target): Don't acquire the lock if
11666         the instantiated_target_ field has already been set.
11667
11668 2009-03-23  Ian Lance Taylor  <iant@google.com>
11669
11670         * gold-threads.h (class Initialize_lock): Define.
11671         * gold-threads.cc (class Initialize_lock_once): Define.
11672         (initialize_lock_control): New static variable.
11673         (initialize_lock_pointer): New static variable.
11674         (initialize_lock_once): New static function.
11675         (Initialize_lock::Initialize_lock): Define.
11676         (Initialize_lock::initialize): Define.
11677         * target-select.h: Include "gold-threads.h".
11678         (class Target_selector): Add lock_ and initialize_lock_ fields.
11679         Don't define instantiate_target, just declare it.
11680         * target-select.cc (Target_selector::Target_selector): Initialize
11681         new fields.
11682         (Target_selector::instantiate_target): Define.
11683         * descriptors.h: Include "gold-threads.h".
11684         (class Descriptors): Add initialize_lock_ field.
11685         * descriptors.cc (Descriptors::Descriptors): Initialize new
11686         field.
11687         (Descriptors::open): Use initialize_lock_ field
11688         * errors.h (class Errors): Add initialize_lock_ field.
11689         * errors.cc (Errors::Errors): Initialize new field.
11690         (Errors::initialize_lock): Use initialize_lock_ field.
11691         * powerpc.cc (class Target_selector_powerpc): Remove
11692         instantiated_target_ field.  In do_recognize call
11693         instantiate_target rather than do_instantiate_target.  In
11694         do_instantiate_target just allocate a new target.
11695         * sparc.cc (class Target_selector_sparc): Likewise.
11696
11697         * freebsd.h: New file.
11698         * i386.cc: Include "freebsd.h".
11699         (Target_i386): Derive from Target_freebsd rather than
11700         Sized_target.
11701         (Target_selector_i386): Derive from Target_selector_freebsd rather
11702         than Target_selector.
11703         * x86_64.cc: Include "freebsd.h".
11704         (Target_x86_64): Derive from Target_freebsd rather than
11705         Sized_target.
11706         (Target_selector_x86_64): Derive from Target_selector_freebsd
11707         rather than Target_selector.
11708         * target.h (class Target): Add adjust_elf_header and
11709         do_adjust_elf_header.
11710         * output.cc (Output_file_header:: do_sized_write): Call target
11711         adjust_elf_header routine.
11712         * configure.tgt: Set targ_osabi.
11713         * configure.ac: Define GOLD_DEFAULT_OSABI.
11714         * parameters.cc (Parameters::default_target): Pass
11715         GOLD_DEFAULT_OSABI to select_target.
11716         * target-select.h (class Target_selector): Make instantiate_target
11717         protected rather than private.
11718         * Makefile.am (HFILES): Add freebsd.h.
11719         * configure, Makefile.in, config.in: Rebuild.
11720
11721         * merge.cc (do_add_input_section): Correct pend value.  Change
11722         message about last entry not being null terminated from error to
11723         warning.
11724
11725 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11726
11727         * incremental.cc: New file.
11728         * Makefile.am (CCFILES): Add incremental.cc.
11729         * Makefile.in: Rebuild.
11730
11731 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11732
11733         * layout.cc (Layout::output_section_name): Preserve names
11734         of '.note.' sections.
11735
11736 2009-03-19  Ian Lance Taylor  <iant@google.com>
11737
11738         * descriptors.cc (Descriptors::open): Check that the options are
11739         valid before using them.
11740
11741 2009-03-18  Ian Lance Taylor  <iant@google.com>
11742
11743         * script-sections.h: Include <list>.
11744         (class Script_sections): Change Sections_elements from std::vector
11745         to std::list.  Typedef public Elements_iterator.  Add
11746         orphan_section_placement_, data_segment_align_start_, and
11747         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11748         field.
11749         * script-sections.cc (class Orphan_section_placement): New class.
11750         (class Sections_element): Add virtual functions is_relro and
11751         orphan_section_init.  Remove virtual function place_orphan_here.
11752         (class Output_section_definition): Add is_relro and
11753         orphan_section_init.  Remove place_orphan_here.
11754         (class Orphan_output_section): Likewise.
11755         (Script_sections::Script_sections): Update for field changes.
11756         (Script_sections::data_segment_align): Set saw_data_segment_align_
11757         and data_segment_align_start_, not data_segment_align_index.
11758         (Script_sections::data_segment_relro_end): Check
11759         saw_data_segment_align_.  Use data_segment_align_start_ rather
11760         than data_segment_align_index_.
11761         (Script_sections::place_orphan): Rewrite to use
11762         Orphan_section_placement.
11763
11764 2009-03-17  Ian Lance Taylor  <iant@google.com>
11765
11766         * archive.cc (Archive::add_symbols): Check for a version attached
11767         to the symbol name in the archive map.
11768         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11769         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11770         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11771         (ver_test_11.a): New target.
11772         * testsuite/Makefile.in: Rebuild.
11773
11774         * configure.ac: Check for chsize and posix_fallocate.  Replace
11775         ftruncate.
11776         * ftruncate.c: New file, from gnulib.
11777         * output.cc (posix_fallocate): Define dummy version if not
11778         HAVE_POSIX_FALLOCATE.
11779         (Output_file::map): Call posix_fallocate rather than lseek and
11780         write.
11781         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11782         * configure, Makefile.in, config.in: Rebuild.
11783
11784 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11785
11786         * layout.h (Layout::create_note): Add section_name parameter.
11787         * layout.cc (Layout::create_note): Likewise.
11788         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11789
11790 2009-03-17  Ian Lance Taylor  <iant@google.com>
11791
11792         * descriptors.cc: Include "options.h".
11793         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11794         (Descriptors::open): Always use O_CLOEXEC when opening a new
11795         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11796         then set FD_CLOEXEC.
11797
11798         * sparc.cc (class Target_sparc): Add has_got_section.
11799         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11800         make sure we have a GOT section.
11801
11802         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11803         (Target_sparc::Scan::local): Likewise.
11804         (Target_sparc::Scan::global): Likewise.
11805         (Target_sparc::Relocate::relocate): Likewise.
11806         (Target_sparc::Relocate::relocate_tls): Likewise.
11807
11808         * symtab.cc (Symbol_table::define_default_version): New function,
11809         broken out of add_from_object.
11810         (Symbol_table::add_from_object): Call define_default_version.
11811         (Symbol_table::define_special_symbol): Add resolve_oldsym
11812         parameter.  Change all callers.  If the version for a symbol comes
11813         from a version script, resolve it with the symbol with the same
11814         name with no version.  Also add the symbol without a version if
11815         appropriate.
11816         (do_define_in_output_data): If resolving with oldsym, don't delete
11817         sym.
11818         (do_define_in_output_segment): Likewise.
11819         (do_define_as_constant): Likewise.
11820         * symtab.h (class Symbol_table): Update declarations.
11821
11822 2009-03-13  Ian Lance Taylor  <iant@google.com>
11823
11824         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11825         (Read_symbols::requeue): New function.
11826         (Read_symbols::do_read_symbols): If make_elf_object fails because
11827         the target type is not configured, and the file was searched for,
11828         issue a warning and retry with the next directory.
11829         (Add_symbols::run): If the file has an incompatible format, and
11830         it was searched for, requeue the Read_symbols task.  On error,
11831         release the object.
11832         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11833         dirindex parameter to constructor.  Change all callers.  Declare
11834         incompatible_warning and requeue.
11835         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11836         input_argument_ and input_group_ fields.  Add them to
11837         constructor.  Change all callers.
11838         (class Read_script): Add dirindex_ field.  Add it to constructor.
11839         Change all callers.
11840         * archive.cc (Archive::setup): Remove input_objects parameter.
11841         Change all callers.
11842         (Archive::get_file_and_offset): Likewise.
11843         (Archive::read_all_symbols): Likewise.
11844         (Archive::read_symbols): Likewise.
11845         (Archive::get_elf_object_for_member): Remove input_objects
11846         parameter.  Add punconfigured parameter.  Change all callers.
11847         (Archive::add_symbols): Change return type to bool.  Check return
11848         value of include_member.
11849         (Archive::include_all_members): Likewise.
11850         (Archive::include_member): Change return type to bool.  Return
11851         false if first included object has incompatible target.  Set
11852         included_member_ field.
11853         (Add_archive_symbols::run): If add_symbols returns false, requeue
11854         Read_symbols task.
11855         * archive.h (class Archive): Add included_member_ field.
11856         Initialize it in constructor.  Add input_file and searched_for
11857         methods.  Update declarations.
11858         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11859         input_argument_ fields.  Add them to constructor.  Change all
11860         callers.
11861         * script.cc: Include "target-select.h".
11862         (class Parser_closure): Add skip_on_incompatible_target_ and
11863         found_incompatible_target_ fields.  Add
11864         skip_on_incompatible_target parameter to constructor.  Change all
11865         callers.  Add methods skip_on_incompatible_target,
11866         clear_skip_on_incompatible_target, found_incompatible_target, and
11867         set_found_incompatible_target.
11868         (read_input_script): Add dirindex parameter.  Change all callers.
11869         If parser finds an incompatible target, requeue Read_symbols
11870         task.
11871         (script_set_symbol): Clear skip_on_incompatible_target in
11872         closure.
11873         (script_add_assertion, script_parse_option): Likewise.
11874         (script_start_sections, script_add_phdr): Likewise.
11875         (script_check_output_format): New function.
11876         * script.h (read_input_script): Update declaration.
11877         * script-c.h (script_check_output_format): Declare.
11878         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11879         (ignore_cmd): Remove OUTPUT_FORMAT.
11880         * fileread.cc (Input_file::Input_file): Add explicit this.
11881         (Input_file::will_search_for): New function.
11882         (Input_file::open): Add pindex parameter.  Change all callers.
11883         * fileread.h (class Input_file): Add input_file_argument method.
11884         Declare will_search_for.  Update declarations.
11885         * object.cc (make_elf_object): Add punconfigured parameter.
11886         Change all callers.
11887         * object.h (class Object): Make input_file public.  Add
11888         searched_for method.
11889         (make_elf_object): Update declaration.
11890         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11891         restart search.
11892         * dirsearch.h (class Dirsearch): Update declaration.
11893         * options.h (class General_options): Add --warn-search-mismatch.
11894         * parameters.cc (Parameters::is_compatible_target): New function.
11895         * parameters.h (class Parameters): Declare is_compatible_target.
11896         * workqueue.cc (Workqueue::add_blocker): New function.
11897         * workqueue.h (class Workqueue): Declare add_blocker.
11898
11899         * fileread.cc (Input_file::open): Remove options parameter.
11900         Change all callers.
11901         (Input_file::open_binary): Likewise.
11902         * script.cc (read_input_script): Likewise.
11903         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11904         options parameter from constructor.  Change all callers.
11905         (class Read_script): Likewise.
11906         * fileread.h (class Input_file): Update declarations.
11907         * script.h (read_input_script): Update declaration.
11908
11909 2009-03-10  Nick Clifton  <nickc@redhat.com>
11910
11911         * po/es.po: New Spanish translation.
11912
11913 2009-03-06  Cary Coutant  <ccoutant@google.com>
11914
11915         * options.cc (parse_short_option): Keep dash_z from registering itself.
11916
11917 2009-03-03  Ian Lance Taylor  <iant@google.com>
11918
11919         PR 9918
11920         * target-reloc.h (relocate_section): Pass output_section to
11921         relocate.
11922         * i386.cc (Target_i386::should_apply_static_reloc): Add
11923         output_section parameter.  Change all callers.
11924         (Target_i386::Relocate::relocate): Add output_section parameter.
11925         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11926         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11927         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11928         * testsuite/two_file_shared.sh: New script.
11929         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11930         (check_DATA): Add two_file_shared.dbg.
11931         (two_file_shared.dbg): New target.
11932         * testsuite/Makefile.in: Rebuild.
11933
11934 2009-03-01  Ian Lance Taylor  <iant@google.com>
11935
11936         * configure.ac: Check for byteswap.h.
11937         * configure: Rebuild.
11938         * config.in: Rebuild.
11939
11940 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11941
11942         * layout.cc (Layout::find_or_add_kept_section): New function.
11943         (Layout::add_comdat): Removed.
11944         * layout.h (struct Kept_section): Move out of class Layout.
11945         Remove trailing underscores from field names.  Add group_sections
11946         field.  Rename group_ field to is_group.  Change all uses.
11947         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11948         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11949         comdat_groups_ field.
11950         (Sized_relobj::include_section_group): Use
11951         find_or_add_kept_section and Kept_section::group_sections.
11952         (Sized_relobj::include_linkonce_section): Likewise.
11953         * object.cc (class Sized_relobj): Don't define Comdat_group or
11954         Comdat_group_table.  Remove find_comdat_group and
11955         add_comdat_group.  Remove comdat_groups_ field.
11956         * plugin.cc (include_comdat_group): Use
11957         Layout::find_or_add_kept_section.
11958
11959 2009-02-28  Ian Lance Taylor  <iant@google.com>
11960
11961         * README: --gc-sections and map files are now supported.  Document
11962         some build requirements.
11963
11964         PR 6992
11965         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11966         relocatable link set the value of the section symbol to zero.
11967         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11968         relocatable link don't include the section address in the local
11969         symbol value.
11970
11971 2009-02-27  Ian Lance Taylor  <iant@google.com>
11972
11973         PR 6811
11974         * options.h (class Search_directory): Add is_system_directory.
11975         (class General_options): Declare is_in_system_directory.
11976         * options.cc (get_relative_sysroot): Make static.
11977         (get_default_sysroot): Make static.
11978         (General_optoins::is_in_system_directory): New function.
11979         * fileread.cc (Input_file::is_in_system_directory): New function.
11980         * fileread.h (class Input_file): Declare is_in_system_directory.
11981         * object.h (class Object): Add is_in_system_directory.
11982         (class Input_objects): Remove system_library_directory_ field.
11983         * object.cc (Input_objects::add_object): Don't set
11984         system_library_directory_.
11985         (input_objects::found_in_system_library_directory): Remove.
11986         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11987         parameter.  Change all callers.
11988         (Symbol_table::sized_write_globals): Likewise.
11989         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11990         Call Object::is_in_system_directory.
11991         * symtab.h (class Symbol_table): Update declarations.
11992
11993         PR 5990
11994         * descriptors.h (Open_descriptor): Add is_on_stack field.
11995         * descriptors.cc (Descriptors::open): If the descriptor is on the
11996         top of the stack, remove it.  Initialize is_on_stack field.
11997         (Descriptors::release): Only add pod to stack if it is not on the
11998         stack already.
11999         (Descriptors::close_some_descriptor): Clear stack_next and
12000         is_on_stack fields.
12001
12002         PR 7091
12003         * output.cc (Output_section::find_starting_output_address): Rename
12004         from starting_output_address; add PADDR parameter; change return
12005         type.
12006         * output.h (class Output_section): Declare
12007         find_starting_output_address instead of starting_output_address.
12008         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12009         section symbol for which we can't find a merge section.
12010
12011         PR 9836
12012         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12013         hidden or internal, force the symbol to be local.
12014         * resolve.cc (Symbol::override_visibility): Define.
12015         (Symbol::override_base): Use override_visibility.
12016         (Symbol_table::resolve): Likewise.
12017         (Symbol::override_base_with_special): Likewise.
12018         (Symbol_table::override_with_special): If the visibility is hidden
12019         or internal, force the symbol to be local.
12020         * symtab.h (class Symbol): Add set_visibility and
12021         override_visibility.
12022         * testsuite/ver_test_1.sh: New file.
12023         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12024         (check_DATA): Add ver_test_1.syms.
12025         (ver_test_1.syms): New target.
12026         * testsuite/Makefile.in: Rebuild.
12027
12028 2009-02-25  Cary Coutant  <ccoutant@google.com>
12029
12030         * layout.cc (Layout::choose_output_section): Don't rename sections
12031         when using a linker script that has a SECTIONS clause.
12032         * Makefile.in: Regenerate.
12033
12034         * testsuite/Makefile.am (script_test_5.sh): New test case.
12035         * testsuite/Makefile.in: Regenerate.
12036         * testsuite/script_test_5.cc: New file.
12037         * testsuite/script_test_5.sh: New file.
12038         * testsuite/script_test_5.t: New file.
12039
12040 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12041
12042         * archive.cc (Archive::include_member): Update calls to add_symbols.
12043         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12044         the Layout argument.
12045         * dynobj.h (do_add_symbols): Add the Layout argument.
12046         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12047         Layout argument.
12048         * object.h (Object::add_symbols): Add the Layout argument.
12049         (Object::do_add_symbols): Add the Layout argument.
12050         (Sized_relobj::do_add_symbols): Add the Layout argument.
12051         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12052         Unify the two versions.
12053         (Add_plugin_symbols): Remove.
12054         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12055         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12056         (Add_plugin_symbols): Remove.
12057         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12058         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12059         (Add_symbols::run): Make it work with Pulginobj.
12060
12061 2009-02-06  Ian Lance Taylor  <iant@google.com>
12062
12063         * object.cc (Sized_relobj::do_layout): Make info message start
12064         with lower case letter.
12065
12066 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12067
12068         * binary.cc: Fix file comment.
12069
12070         * options.h (enum Incremental_disposition): Define.
12071         (class General_options): Add new options: --incremental,
12072         --incremental_changed, --incremental_unchanged,
12073         --incremental_unknown.  Add incremental_disposition_ and
12074         implicit_incremental_ fields.
12075         (General_options::incremental_disposition): New function.
12076         (class Position_dependent_options): Add incremental_disposition
12077         option.
12078         (Position_dependent_options::copy_from_options): Set incremental
12079         dispositions.
12080         * options.cc (General_options::parse_incremental_changed): New
12081         function.
12082         (General_options::parse_incremental_unchanged): New function.
12083         (General_options::parse_incremental_unknown): New function.
12084         (General_options::General_options): Initialize new fields
12085         incremental_disposition_ and implicit_incremental_.
12086         (General_options::finalize): Check for uasge of --incremental-*
12087         without --incremental.
12088
12089 2009-02-06  Chris Demetriou  <cgd@google.com>
12090
12091         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12092         pointer and to report location as the file name associated with
12093         the symbol.
12094         (gold_undefined_symbol_at_location): New function to replace the
12095         old gold_undefined_symbol functionality.
12096         * target-reloc.h (relocate_section): Update to use
12097         gold_undefined_symbol_at_location.
12098         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12099         Call gold_undefined_symbol function rather than gold_error.
12100         * errors.h (Errors::undefined_symbol): Take location as a
12101         string, rather than calculating it from a relocation.
12102         * errors.cc (Errors::fatal): Print "fatal error:" before the
12103         formatted message.
12104         (Errors::error, Errors::error_at_location): Print "error: "
12105         before the formatted message.
12106         (Errors::undefined_symbol): Take location as a string, rather
12107         than calculating it from a relocation.
12108         (gold_undefined_symbol_at_location): New function akin to
12109         old gold_undefined_symbol, calculates location from relocation.
12110         (gold_undefined_symbol): Change to take only a Symbol pointer
12111         and to report location as the file name associated with the symbol.
12112         * testsuite/debug_msg.sh: Update for changed error messages.
12113         * testsuite/undef_symbol.sh: Likewise.
12114
12115 2009-02-04  Duncan Sands  <baldrick@free.fr>
12116
12117         PR 9812
12118         * reduced_debug_output.h
12119         (Output_reduced_debug_abbrev_section::failed): Use format for
12120         gold_warning.
12121         (Output_reduced_debug_info_section::faild): Likewise.
12122
12123 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12124
12125         * script.cc (Lazy_demangler): New class.
12126         (Version_script_info::get_symbol_version_helper): Demangle a
12127         symbol only once.
12128
12129 2009-01-29  Cary Coutant  <ccoutant@google.com>
12130
12131         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12132         to __tls_get_addr.
12133         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12134
12135 2009-01-28  Ian Lance Taylor  <iant@google.com>
12136
12137         * version.cc (version_string): Bump to 1.9.
12138
12139         * gold.h: Include <cstring> and <stdint.h>.
12140         * version.cc: Include <cstdio>.
12141         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12142         warning.
12143         * reduced_debug_output.cc (insert_into_vector): Rename from
12144         Insert_into_vector; change all callers.  Use Swap_unaligned to
12145         avoid aliasing issue; remove union since it is unnecessary.
12146
12147 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12148
12149         * Makefile.am (CCFILES): Add gc.cc.
12150         (HFILES): Add gc.h.
12151         * Makefile.in: Regenerate.
12152         * gold.cc (Gc_runner): New class.
12153         (queue_initial_tasks): Call garbage collection related tasks
12154         when corresponding options are invoked.
12155         (queue_middle_gc_tasks): New function.
12156         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12157         processed early before laying out sections during garbage collection.
12158         * gold.h (queue_middle_gc_tasks): New function.
12159         (is_prefix_of): Move from "layout.cc".
12160         * i386.cc (Target_i386::gc_process_relocs): New function.
12161         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12162         * main.cc (main): Create object of class "Garbage_collection".
12163         * object.cc (Relobj::copy_symbols_data): New function.
12164         (Relobj::is_section_name_included): New function.
12165         (Sized_relobj::do_layout): Allow this function to be called twice
12166         during garbage collection and defer layout of section during the
12167         first call.
12168         * object.h (Relobj::get_symbols_data): New function.
12169         (Relobj::is_section_name_included): New function.
12170         (Relobj::copy_symbols_data): New function.
12171         (Relobj::set_symbols_data): New function.
12172         (Relobj::get_relocs_data): New function.
12173         (Relobj::set_relocs_data): New function.
12174         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12175         (Relobj::gc_process_relocs): New function.
12176         (Relobj::do_gc_process_relocs): New pure virtual function.
12177         (Relobj::sd_): New data member.
12178         (Sized_relobj::is_output_section_offset_invalid): New function.
12179         (Sized_relobj::do_gc_process_relocs): New function.
12180         * options.h (General_options::gc_sections): Modify to not be a no-op.
12181         (General_options::print_gc_sections): New option.
12182         * plugin.cc (Plugin_finish::run): Remove function call to
12183         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12184         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12185         * reloc.cc (Read_relocs::run): Add task to process relocs and
12186         determine unreferenced sections when doing garbage collection.
12187         (Gc_process_relocs): New class.
12188         (Sized_relobj::do_gc_process_relocs): New function.
12189         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12190         sections that are garbage collected.
12191         * reloc.h (Gc_process_relocs): New class.
12192         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12193         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12194         symbols whose corresponding sections are garbage collected.
12195         (Symbol_table::Symbol_table): Add new parameter for the garbage
12196         collection object.
12197         (Symbol_table::gc_mark_undef_symbols): New function.
12198         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12199         (Symbol_table::gc_mark_dyn_syms): New function.
12200         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12201         as garbage.
12202         (Symbol_table::add_from_object): Likewise.
12203         (Symbol_table::add_from_relobj): When building shared objects, do not
12204         treat externally visible symbols as garbage.
12205         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12206         table information for static and relocatable links.
12207         * symtab.h (Symbol_table::set_gc): New function.
12208         (Symbol_table::gc): New function.
12209         (Symbol_table::gc_mark_undef_symbols): New function.
12210         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12211         (Symbol_table::gc_mark_dyn_syms): New function.
12212         (Symbol_table::gc_): New data member.
12213         * target.h (Sized_target::gc_process_relocs): New pure virtual
12214         function.
12215         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12216         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12217
12218 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12219
12220         * options.h (General_options::gc_sections): Define as a no-op for now.
12221         (General_options::no_keep_memory): Ditto.
12222         (General_options::Bshareable): Define.
12223         * options.cc (General_options::finalize): Honor -Bshareable.
12224
12225 2009-01-20  Andreas Schwab  <schwab@suse.de>
12226
12227         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12228         read the value in the contents, since we don't use it.  Use the
12229         template endianness when writing.
12230         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12231
12232 2009-01-19  Andreas Schwab  <schwab@suse.de>
12233
12234         * configure.tgt (powerpc64-*): Fix targ_obj.
12235
12236 2009-01-15  Ian Lance Taylor  <iant@google.com>
12237
12238         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12239         local symbols when stripping all symbols.
12240
12241 2009-01-14  Cary Coutant  <ccoutant@google.com>
12242
12243         * output.cc (Output_reloc): Add explicit instantiations.
12244
12245 2009-01-14  Cary Coutant  <ccoutant@google.com>
12246
12247         * archive.cc (Archive::get_elf_object_for_member): Remove call
12248         to File_read::claim_for_plugin.
12249         * descriptors.cc (Descriptors::open): Remove reference to
12250         is_claimed.
12251         (Descriptors::claim_for_plugin): Remove.
12252         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12253         (Descriptors::is_claimed): Remove.
12254         (claim_descriptor_for_plugin): Remove.
12255         * fileread.cc (File_read::claim_for_plugin): Remove.
12256         * fileread.h (File_read::claim_for_plugin): Remove.
12257         (File_read::descriptor): Reopen descriptor if necessary.
12258         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12259         (Plugin_manager::all_symbols_read): Add task parameter. Change
12260         all callers.
12261         (Plugin_manager::get_input_file): New function.
12262         (Plugin_manager::release_input_file): New function.
12263         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12264         corresponding data member.
12265         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12266         and pass to base constructor. Change all callers.
12267         (get_input_file, release_input_file): New functions.
12268         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12269         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12270         (Plugin_manager::all_symbols_read): Add task parameter.
12271         (Plugin_manager::get_input_file): New function.
12272         (Plugin_manager::release_input_file): New function.
12273         (Plugin_manager::task_): New data member.
12274         (Pluginobj::Pluginobj): Add filesize parameter.
12275         (Pluginobj::filename): New function.
12276         (Pluginobj::descriptor): New function.
12277         (Pluginobj::filesize): New function.
12278         (Pluginobj::filesize_): New data member.
12279         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12280         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12281         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12282
12283         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12284         with archive libraries.
12285         * testsuite/Makefile.in: Regenerate.
12286         * testsuite/plugin_test.c (struct sym_info): New type.
12287         (get_input_file, release_input_file): New static variables.
12288         (onload): Capture new transfer vector entries.
12289         (claim_file_hook): Stop reading at end of file according to filesize.
12290         Factor out parsing of readelf output into separate function.
12291         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12292         APIs and get the source file name from the symbol table.  Convert
12293         source file name to corresponding object file name.  Print info
12294         message when adding new input files.
12295         (parse_readelf_line): New function.
12296         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12297         * testsuite/plugin_test_2.sh: Likewise.
12298         * testsuite/plugin_test_3.sh: Likewise.
12299         * testsuite/plugin_test_4.sh: New test case.
12300
12301 2009-01-07  Ian Lance Taylor  <iant@google.com>
12302
12303         * version.cc (version_string): Bump to 1.8.
12304
12305 2008-12-23  Cary Coutant  <ccoutant@google.com>
12306
12307         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12308         * plugin.cc (Plugin_manager::finish): Rename as
12309         layout_deferred_objects.  Move cleanup to separate function.
12310         (Plugin_manager::cleanup): New function.
12311         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12312         separately.
12313         * plugin.h (Plugin_manager::finish): Rename as
12314         layout_deferred_objects.
12315         (Plugin_manager::cleanup): New function.
12316         (Plugin_manager::cleanup_done): New field.
12317
12318 2008-12-23  Cary Coutant  <ccoutant@google.com>
12319
12320         * plugin.cc (is_visible_from_outside): New function.
12321         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12322         so we don't return "IR only" status for exported symbols or -r links.
12323
12324         * testsuite/Makefile.am (plugin_test_3): New test case.
12325         * testsuite/Makefile.in: Regenerate.
12326         * testsuite/plugin_test_3.sh: New file.
12327
12328 2008-12-22  Cary Coutant  <ccoutant@google.com>
12329
12330         * object.cc (Sized_relobj::layout_section): New function.
12331         (Sized_relobj::do_layout): Defer layout of input sections until after
12332         plugin has provided replacement files.
12333         (Sized_relobj::do_layout_deferred_sections): New function.
12334         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12335         (Relobj::layout_deferred_sections): New function.
12336         (Relobj::do_layout_deferred_sections): New function.
12337         (Sized_relobj::do_layout_deferred_sections): New function.
12338         (Sized_relobj::layout_section): New function.
12339         (Sized_relobj::Deferred_layout): New structure.
12340         (Sized_relobj::deferred_layout_): New field.
12341         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12342         Change all callers.  Layout deferred sections.
12343         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12344         references.
12345         (Plugin_hook::run): Move code from do_plugin_hook inline.
12346         (Plugin_hook::do_plugin_hook): Remove.
12347         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12348         (Plugin_manager::finish): Renamed, was cleanup.
12349         (Plugin_manager::should_defer_layout): New function.
12350         (Plugin_manager::add_deferred_layout_object): New function.
12351         (Plugin_manager::Deferred_layout_list): New type.
12352         (Plugin_manager::deferred_layout_objects_): New field.
12353         (Plugin_hook::do_plugin_hook): Remove.
12354
12355 2008-12-17  Ian Lance Taylor  <iant@google.com>
12356
12357         * options.h (class General_options): Add --no case for
12358         --export-dynamic.
12359
12360 2008-12-16  Cary Coutant  <ccoutant@google.com>
12361
12362         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12363         vector.
12364         (Plugin_manager::claim_file): Create plugin object even if
12365         plugin did not call the add_symbols callback.
12366         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12367         asking for more symbols than were added.
12368         * testsuite/Makefile.am (plugin_test_1): Add test case with
12369         no global symbols.
12370         (empty.syms): New target.
12371         * testsuite/Makefile.in: Regenerate.
12372         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12373         message. Don't call add_symbols if no globals.
12374         (all_symbols_read_hook): Don't provide replacement for empty
12375         claimed file.
12376
12377 2008-12-12  Ian Lance Taylor  <iant@google.com>
12378
12379         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12380         r_type == 0 for a local symbol with r_sym == 0.
12381         (scan_relocatable_relocs): Pass r_sym to
12382         local_non_section_strategy.
12383         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12384         r_sym parameter.
12385
12386         * configure.ac: Update test for TLS descriptors: they are
12387         supported as of glibc 2.9.
12388         * configure: Rebuild.
12389
12390 2008-12-11  Ian Lance Taylor  <iant@google.com>
12391
12392         PR 7091
12393         * target-reloc.h (Default_scan_relocatable_relocs): For each
12394         function, map r_type == 0 to RELOC_DISCARD.
12395
12396 2008-12-10  Cary Coutant  <ccoutant@google.com>
12397
12398         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12399         object to override a kept COMDAT group from a plugin object.
12400
12401 2008-12-09  Ian Lance Taylor  <iant@google.com>
12402
12403         PR 7088
12404         * yyscript.y (file_cmd): Handle INPUT.
12405
12406         * testsuite/initpri1.c: Change all declarations to be full
12407         prototypes by adding void, to avoid compiler warnings.
12408
12409 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12410
12411         * options.cc (General_options::parse_plugin_opt): New.
12412         (General_options::add_plugin): The argument now is just the filename.
12413         (General_options::add_plugin_option): New.
12414         * options.h (plugin_opt): New.
12415         (add_plugin): Change argument name.
12416         (add_plugin_option): New.
12417         * plugin.cc (Plugin::load): Don't parse the plugin option.
12418         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12419         (Plugin::add_option): New.
12420         (Plugin::args_): Change type.
12421         (Plugin::filename_): New.
12422         (Plugin_manager::add_plugin_option): New.
12423         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12424         * testsuite/Makefile.in: Regenerate.
12425
12426 2008-12-05  Cary Coutant  <ccoutant@google.com>
12427
12428         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12429         Handle --strip-lto-sections option.
12430         * options.h (strip_lto_sections): New option.
12431
12432 2008-12-01  Cary Coutant  <ccoutant@google.com>
12433
12434         * plugin.cc (ld_plugin_message): Change format parameter to const.
12435         Fix mismatch between new[] and delete.
12436
12437 2008-11-14  Cary Coutant  <ccoutant@google.com>
12438
12439         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12440         instead of -1U.
12441
12442 2008-11-05  Craig Silverstein  <csilvers@google.com>
12443
12444         * options.cc (General_options::parse_dynamic_list): New function.
12445         * options.h (General_options): New flags dynamic_list,
12446         dynamic_list_data, dynamic_list_cpp_new, and
12447         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12448         (General_options::in_dynamic_list): New function.
12449         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12450         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12451         (Lex::can_continue_name): Likewise.
12452         (yylex): Likewise.
12453         (read_script_file): New parameter script_options.
12454         (read_dynamic_list): New function.
12455         (Script_options::define_dynamic_list): New function.
12456         (dynamic_list_keyword_parsecodes): New variable.
12457         (dynamic_list_keywords): New variable.
12458         * script.h (Script_options::define_dynamic_list): New function
12459         prototype.
12460         (read_dynamic_list): New function prototype.
12461         * symtab.cc (strprefix): New macro.
12462         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12463         dynamic_list_data, dynamic_list_cpp_new, and
12464         dynamic_list_cpp_typeinfo.
12465         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12466         (dynamic_list_expr): New rule.
12467         (dynamic_list_nodes): Likewise.
12468         (dynamic_list_node): Likewise.
12469         * testsuite/Makefile.am (dynamic_list): New test.
12470         * testsuite/Makefile.in: Regenerated.
12471         * testsuite/dynamic_list.t: New file.
12472         * testsuite/dynamic_list.sh: New file.
12473
12474 2008-11-05  Craig Silverstein  <csilvers@google.com>
12475
12476         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12477         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12478         (t11_last): Likewise.
12479         * testsuite/ver_test_6.c (main): Likewise.
12480
12481 2008-10-07  Cary Coutant  <ccoutant@google.com>
12482
12483         * options.c (General_options::finalize): Add check for -static and
12484         -shared.
12485         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12486         is not empty.
12487
12488 2008-10-02  Cary Coutant  <ccoutant@google.com>
12489
12490         * plugin.cc (make_sized_plugin_object): Fix conditional
12491         compilation to work when not all targets are enabled.
12492
12493 2008-09-29  Cary Coutant  <ccoutant@google.com>
12494
12495         * archive.cc (Archive::get_file_and_offset): Use filename instead
12496         of name to get library path.
12497         (Archive::include_member): Unlock external member of a thin archive.
12498
12499         * testsuite/Makefile.am (TEST_AR): New variable.
12500         (thin_archive_test_1): New test.
12501         (thin_archive_test_2): New test.
12502         * testsuite/Makefile.in: Regenerate.
12503         * testsuite/thin_archive_main.cc: New file.
12504         * testsuite/thin_archive_test_1.cc: New file.
12505         * testsuite/thin_archive_test_2.cc: New file.
12506         * testsuite/thin_archive_test_3.cc: New file.
12507         * testsuite/thin_archive_test_4.cc: New file.
12508
12509 2008-09-29  Cary Coutant  <ccoutant@google.com>
12510
12511         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12512         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12513         instead of -1U.
12514         (Sized_relobj::do_finalize_local_symbols): Likewise.
12515         (Sized_relobj::map_to_kept_section): Likewise.
12516         * object.h (Sized_relobj::invalid_address): New constant.
12517         (Sized_relobj::do_output_section_offset): Check for invalid_address
12518         and return -1ULL.
12519         * output.cc (Output_reloc::local_section_offset): Use constant
12520         invalid_address instead of -1U.
12521         (Output_reloc::get_address): Likewise.
12522         (Output_section::output_address): Change -1U to -1ULL.
12523         * output.h (Output_reloc::invalid_address): New constant.
12524         * reloc.cc (Sized_relobj::write_sections): Use constant
12525         invalid_address instead of -1U.
12526         (Sized_relobj::relocate_sections): Likewise.
12527         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12528         values for merge sections.
12529         * target-reloc.h (relocate_for_relocatable): Use constant
12530         invalid_address instead of -1U.
12531
12532 2008-09-19  Cary Coutant  <ccoutant@google.com>
12533
12534         Add plugin functionality for link-time optimization (LTO).
12535         * configure.ac (plugins): Add --enable-plugins option.
12536         * configure: Regenerate.
12537         * config.in: Regenerate.
12538         * Makefile.am (LIBDL): New variable.
12539         (CCFILES): Add plugin.cc.
12540         (HFILES): Add plugin.h.
12541         (ldadd_var): Add LIBDL.
12542         * Makefile.in: Regenerate.
12543
12544         * archive.cc: Include "plugin.h".
12545         (Archive::setup): Don't preread archive symbols when using a plugin.
12546         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12547         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12548         files.
12549         (Archive::include_member): Add symbols from plugin objects.
12550         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12551         * descriptors.cc (Descriptors::open): Check for file descriptors
12552         abandoned by plugins.
12553         (Descriptors::claim_for_plugin): New function.
12554         * descriptors.h (Descriptors::claim_for_plugin): New function.
12555         (Open_descriptor::is_claimed): New field.
12556         (claim_descriptor_for_plugin): New function.
12557         * fileread.cc (File_read::claim_for_plugin): New function.
12558         * fileread.h (File_read::claim_for_plugin): New function.
12559         (File_read::descriptor): New function.
12560         * gold.cc: Include "plugin.h".
12561         (queue_initial_tasks): Add task to call plugin hooks for generating
12562         new object files.
12563         * main.cc: Include "plugin.h".
12564         (main): Load plugin libraries.
12565         * object.h (Pluginobj): Declare.
12566         (Object::pluginobj): New function.
12567         (Object::do_pluginobj): New function.
12568         (Object::set_target): New function.
12569         * options.cc: Include "plugin.h".
12570         (General_options::parse_plugin): New function.
12571         (General_options::General_options): Initialize plugins_ field.
12572         (General_options::add_plugin): New function.
12573         * options.h (Plugin_manager): Declare.
12574         (General_options): Add --plugin option.
12575         (General_options::has_plugins): New function.
12576         (General_options::plugins): New function.
12577         (General_options::add_plugin): New function.
12578         (General_options::plugins_): New field.
12579         * plugin.cc: New file.
12580         * plugin.h: New file.
12581         * readsyms.cc: Include "plugin.h".
12582         (Read_symbols::do_read_symbols): Check for archive before checking
12583         for ELF file.  Call plugin hooks to claim files.
12584         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12585         from a real object file; force override when processing replacement
12586         files.
12587         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12588         (Symbol::init_base_object): Likewise.
12589         (Symbol::init_base_output_data): Likewise.
12590         (Symbol::init_base_output_segment): Likewise.
12591         (Symbol::init_base_constant): Likewise.
12592         (Symbol::init_base_undefined): Likewise.
12593         (Symbol::output_section): Assert that object is not a plugin.
12594         (Symbol_table::add_from_pluginobj): New function.
12595         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12596         undefined.
12597         (Symbol_table::sized_write_globals): Likewise.
12598         (Symbol_table::add_from_pluginobj): Instantiate template.
12599         * symtab.h (Sized_pluginobj): Declare.
12600         (Symbol::in_real_elf): New function.
12601         (Symbol::set_in_real_elf): New function.
12602         (Symbol::in_real_elf_): New field.
12603         (Symbol_table::add_from_pluginobj): New function.
12604
12605         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12606         (LIBDL): New variable.
12607         (LDADD): Add LIBDL.
12608         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12609         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12610         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12611         (MOSTLYCLEANFILES): Likewise.
12612         * testsuite/Makefile.in: Regenerate.
12613         * testsuite/plugin_test.c: New file.
12614         * testsuite/plugin_test_1.sh: New file.
12615         * testsuite/plugin_test_2.sh: New file.
12616
12617 2008-09-16  Ian Lance Taylor  <iant@google.com>
12618
12619         * target-reloc.h (relocate_section): Check whether a symbol is
12620         defined by the ABI before reporting an undefined symbol error.
12621         * target.h (Target::is_defined_by_abi): Make parameter const.
12622         (Target::do_is_defined_by_abi): Likewise.
12623         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12624         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12625         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12626         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12627         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12628         * testsuite/Makefile.in: Rebuild.
12629
12630         * fileread.cc (make_view): Add casts to avoid warning.
12631
12632 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12633
12634         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12635         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12636
12637 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12638
12639         * options.h (General_options::output_is_executable): New.
12640         (General_options::output_is_pie): New.
12641         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12642         for shared libraries.
12643         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12644
12645 2008-09-11  Chris Demetriou  <cgd@google.com>
12646
12647         * options.h (origin): New -z option.
12648         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12649         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12650         in DT_FLAGS_1.
12651
12652 2008-09-05  Cary Coutant  <ccoutant@google.com>
12653
12654         * fileread.cc (File_read::make_view): Add check for attempt to map
12655         beyond end of file.
12656
12657 2008-09-05  Cary Coutant  <ccoutant@google.com>
12658
12659         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12660         explicit instantiations.
12661
12662 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12663
12664         PR gold/6858
12665         * options.cc (General_options::finalize): Allow undefined symbols
12666         in shlibs if linking -shared.
12667
12668         PR gold/6859
12669         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12670         symbols as not needing a dynsym entry.
12671
12672 2008-08-20  Craig Silverstein  <csilvers@google.com>
12673
12674         * fileread.cc (File_read::open): Do not lock the file unless it
12675         was successfully opened.
12676
12677 2008-08-14  Cary Coutant  <ccoutant@google.com>
12678
12679         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12680         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12681         * testsuite/tls_test.cc (struct int128): 128-bit struct
12682         for testing TLS relocs with non-zero addend.
12683         (v12): New TLS variable.
12684         (t12): New test.
12685         (t_last): Add check for v12.
12686         * testsuite/tls_test.h (t12): New function.
12687         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12688
12689 2008-08-13  Ian Lance Taylor  <iant@google.com>
12690
12691         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12692         set tls_segment_ or relro_segment_.
12693         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12694         when appropriate.
12695         * output.h (Output_section::clear_is_relro): New function.
12696         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12697         sections specially even when output_data_ is empty.
12698         (Output_segment::maximum_alignment): When first section is relro,
12699         only force alignment for PT_LOAD segments.
12700         * script.cc (script_data_segment_align): New function.
12701         (script_data_segment_relro_end): New function.
12702         * script-c.h (script_data_segment_align): Declare.
12703         (script_data_segment_relro_end): Declare.
12704         * script-sections.h (class Script_sections): Declare
12705         data_segment_align and data_segment_relro_end.  Add fields
12706         segment_align_index_ and saw_relro_end_.
12707         * script-sections.cc (class Sections_element): Add set_is_relro
12708         virtual function.  Add new bool* parameter to place_orphan_here.
12709         Add get_output_section virtual function.
12710         (class Output_section_definition): Add set_is_relro.  Add new
12711         bool* parameter to place_orphan_here.  Add get_output_section.
12712         Add is_relro_ field.
12713         (Output_section_definition::Output_section_definition): Initialize
12714         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12715         and is_relro_ fields.
12716         (Output_section_definition::place_orphan_here): Add is_relro
12717         parameter.
12718         (Output_section_definition::set_section_addresses): Set relro for
12719         output section.
12720         (Output_section_definition::alternate_constraint): Likewise.
12721         (class Orphan_output_section): Add new bool* parameter to
12722         place_orphan_here.  Add get_output_section.
12723         (Orphan_output_section::place_orphan_here): Add is_relro
12724         parameter.
12725         (Script_sections::Script_sections): Initialize
12726         data_segment_align_index_ and saw_relro_end_.
12727         (Script_sections::data_segment_align): New function.
12728         (Script_sections::data_segment_relro_end): New function.
12729         (Script_sections::place_orphan): Set or clear is_relro.
12730         (Script_sections::set_section_addresses): Force alignment of first
12731         TLS section.
12732         * yyscript.y (exp): Call script_data_segment_align and
12733         script_data_segment_relro_end.
12734         * testsuite/relro_script_test.t: New file.
12735         * testsuite/relro_test.cc (using_script): Declare.
12736         (t1, t2): Test using_script.
12737         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12738         (relro_script_test_SOURCES): Define.
12739         (relro_script_test_DEPENDENCIES): Define.
12740         (relro_script_test_LDFLAGS): Define.
12741         (relro_script_test_LDADD): Define.
12742         (relro_script_test.so): New target.
12743         * testsuite/Makefile.in: Rebuild.
12744
12745 2008-08-06  Cary Coutant <ccoutant@google.com>
12746
12747         * archive.cc (Archive::total_archives, Archive::total_members)
12748         (Archive::total_members_loaded): New variables.
12749         (Archive::setup): Add parameter.  Add option to preread
12750         archive symbols.
12751         (Archive::read_armap): Add counter.
12752         (Archive::get_file_and_offset): New function.
12753         (Archive::get_elf_object_for_member): New function.
12754         (Archive::read_all_symbols): New function.
12755         (Archive::read_symbols): New function.
12756         (Archive::add_symbols): Add counters.
12757         (Archive::include_all_members): Use armap to find members if it's
12758         already built.
12759         (Archive::include_member): Skip reading symbols if already read.
12760         Factored code into Archive::get_file_and_offset and
12761         Archive::get_elf_object_for_member.  Changed call to
12762         Mapfile::report_include_archive_member.
12763         (Archive::print_stats): New function.
12764         * archive.h: Declare Object and Read_symbols_data classes.
12765         (Archive::Archive): Add initializers for new members.
12766         (Archive::setup): Add parameter.
12767         (Archive::print_stats): New function.
12768         (Archive::total_archives, Archive::total_members)
12769         (Archive::total_members_loaded): New variables.
12770         (Archive::get_file_and_offset): New function.
12771         (Archive::get_elf_object_for_member): New function.
12772         (Archive::read_all_symbols): New function.
12773         (Archive::read_symbols): New function.
12774         (Archive::Archive_member): New class.
12775         (Archive::members_): New member.
12776         (Archive::num_members_): New member.
12777         * main.cc: Include archive.h.
12778         (main): Call Archive::print_stats.
12779         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12780         archive parameter; member_name is now the fully-decorated name.
12781         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12782         * options.h: (General_options): Add --preread-archive-symbols option.
12783         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12784         Archive::setup.
12785
12786 2008-08-04  Ian Lance Taylor  <iant@google.com>
12787
12788         * symtab.h (Symbol::use_plt_offset): New function.
12789         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12790         * powerpc.cc (Relocate::relocate): Likewise.
12791         * sparc.cc (Relocate::relocate): Likewise.
12792         * x86_64.cc (Relocate::relocate): Likewise.
12793         * testsuite/weak_plt.sh: New test.
12794         * testsuite/weak_plt_main.cc: New test.
12795         * testsuite/weak_plt_shared.cc: New test.
12796         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12797         (check_PROGRAMS): Add weak_plt.
12798         (check_DATA): Add weak_plt_shared.so.
12799         (weak_plt_main_pic.o, weak_plt): New targets.
12800         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12801         * testsuite/Makefile.in: Rebuild.
12802
12803         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12804         gcctestdir/ld.
12805         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12806         * testsuite/Makefile.in: Rebuild.
12807
12808 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12809
12810         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12811         * Makefile.in: Regenerate.
12812         * po/POTFILES.in: Regenerate.
12813
12814 2008-07-29  Ian Lance Taylor  <iant@google.com>
12815
12816         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12817         symbols before other symbols.
12818         * testsuite/script_test_2.cc (test_addr): Declare.
12819         (test_addr_alias): Declare.
12820         (main): Check that test_addr and test_addr_alias have the right
12821         values.
12822         * testsuite/script_test_2.t: Define test_addr_alias and
12823         test_addr.
12824
12825 2008-07-24  Ian Lance Taylor  <iant@google.com>
12826
12827         PR 5990
12828         * descriptors.cc: New file.
12829         * descriptors.h: New file.
12830         * gold-threads.h (class Hold_optional_lock): New class.
12831         * fileread.cc: Include "descriptors.h".
12832         (File_read::~File_read): Release descriptor rather than closing
12833         it.
12834         (File_read::open) [file]: Call open_descriptor rather than open.
12835         Set is_descriptor_opened_.
12836         (File_read::open) [memory]: Assert that descriptor is not open.
12837         (File_read::reopen_descriptor): New function.
12838         (File_read::release): Release descriptor.
12839         (File_read::do_read): Make non-const.  Reopen descriptor.
12840         (File_read::read): Make non-const.
12841         (File_read::make_view): Reopen descriptor.
12842         (File_read::do_readv): Likewise.
12843         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12844         Update declarations.
12845         * layout.cc: Include "descriptors.h".
12846         (Layout::create_build_id): Use open_descriptor rather than open.
12847         * output.cc: Include "descriptors.h".
12848         (Output_file::open): Use open_descriptor rather than open.
12849         * archive.cc (Archive::const_iterator): Change Archive to be
12850         non-const.
12851         (Archive::begin, Archive::end): Make non-const.
12852         (Archive::count_members): Likewise.
12853         * archive.h (class Archive): Update declarations.
12854         * object.h (Object::read): Make non-const.
12855         * Makefile.am (CCFILES): Add descriptors.cc.
12856         (HFILES): Add descriptors.h.
12857         * Makefile.in: Rebuild.
12858
12859         PR 6716
12860         * gold.h: Always include <clocale>.  Add Solaris workarounds
12861         following code in binutils/sysdep.h.
12862
12863         PR 6048
12864         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12865         this->eh_frame_hdr_ is NULL before using it.
12866
12867         * dynobj.cc (Versions::Versions): Update comment.
12868
12869         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12870         the base version name.
12871
12872         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12873         array size plus one.
12874         (Stringpool_template::set_string_offsets): Subtract one from key
12875         before using it as an array index.
12876         (Stringpool_template::get_offset_with_length): Likewise.
12877         (Stringpool_template::write_to_buffer): Likewise.
12878         * stringpool.h (Stringpool_template::get_offset_from_key):
12879         Likewise.
12880
12881 2008-07-23  Ian Lance Taylor  <iant@google.com>
12882
12883         PR 6658
12884         * object.h (Merged_symbol_value::value): Do our best to handle a
12885         negative addend.
12886
12887         PR 6647
12888         * script.cc (Version_script_info::get_versions): Don't add empty
12889         version tag to return value.
12890         (Version_script_info::get_symbol_version_helper): Change return
12891         type to bool.  Add pversion parameter.  Change all callers.
12892         (script_register_vers_node): Don't require a non-NULL tag.
12893         * script.h (class Version_script_info): Update declarations.
12894         (Version_script_info::get_symbol_version): Change return type to
12895         bool.  Add version parameter.  Change all callers.
12896         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12897         handling.  Handle an empty version from a version script.
12898         (Symbol_table::define_special_symbol): Likewise.
12899         * testsuite/ver_test_10.script: New file.
12900         * testsuite/ver_test_10.sh: New file.
12901         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12902         (check_DATA): Add ver_test_10.syms.
12903         (ver_test_10.syms, ver_test_10.so): New target.
12904         * testsuite/Makefile.in: Rebuild.
12905
12906 2008-07-23  Simon Baldwin  <simonb@google.com>
12907
12908         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12909         to zero for undefined symbols from dynamic libraries.
12910
12911 2008-07-23  Ian Lance Taylor  <iant@google.com>
12912
12913         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12914         Change all callers.
12915         * symtab.h (class Symbol_table): Update declaration.
12916         * testsuite/ver_test_9.cc: New file.
12917         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12918         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12919         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12920         (ver_test_9.so, ver_test_9.o): New targets.
12921         * testsuite/Makefile.in: Rebuild.
12922
12923 2008-07-22  Ian Lance Taylor  <iant@google.com>
12924
12925         * options.h (class General_options): Define --check-sections.
12926         * layout.cc (Layout::set_segment_offsets): Handle
12927         --check-sections.
12928
12929         * options.h (class General_options): Define -n/--nmagic and
12930         -N/--omagic.
12931         * options.cc (General_options::finalize): For -n/--nmagic or
12932         -N/--omagic, set -static.
12933         * layout.cc (Layout::attach_allocated_section_to_segment): If
12934         -N/--omagic, don't put read-only and read-write sections in
12935         different segments.
12936         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12937         finding a read-only segment.
12938         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12939         don't set the minimum segment alignment to the common page size,
12940         and don't set the file offset to the address modulo the page size.
12941         * script-sections.cc (Script_sections::create_segments): If
12942         -n/--omagic, don't put read-only and read-write sections in
12943         different segments.
12944
12945         * cref.cc: New file.
12946         * cref.h: New file.
12947         * options.h (class General_options): Add --print-symbol-counts.
12948         * main.cc (main): Issue defined symbol report if requested.
12949         * archive.cc (Archive::interpret_header): Make into a const member
12950         function.
12951         (Archive::add_symbols): Call Input_objects::archive_start and
12952         archive_stop.
12953         (Archive::const_iterator): Define new class.
12954         (Archive::begin, Archive::end): New functions.
12955         (Archive::include_all_members): Rewrite to use iterator.
12956         (Archive::count_members): New function.
12957         * archive.h (class Archive): Update declarations.
12958         (Archive::filename): New function.
12959         * object.cc: Include "cref.h".
12960         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12961         (Sized_relobj::do_get_global_symbol_counts): New function.
12962         (Input_objects::add_object): Add object to cross-referencer.
12963         (Input_objects::archive_start): New function.
12964         (Input_objects::archive_stop): New function.
12965         (Input_objects::print_symbol_counts): New function.
12966         * object.h: Declare Cref and Archive.
12967         (Object::get_global_symbol_counts): New function.
12968         (Object::do_get_global_symbol_counts): New pure virtual function.
12969         (class Sized_relobj): Add defined_count_ field.  Update
12970         declarations.
12971         (class Input_objects): Add cref_ field.  Update constructor.
12972         Update declarations.
12973         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12974         defined_count_.
12975         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12976         symbol counts.
12977         (Sized_dynobj::do_get_global_symbol_counts): New function.
12978         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12979         defined_count_.  Update declarations.  Define Symbols typedef.
12980         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12981         parameter.  Change all callers.
12982         (Symbol_table::add_from_dynobj): Add sympointers and defined
12983         parameters.  Change all callers.
12984         * symtab.h (class Symbol_table): Update declarations.
12985         * Makefile.am (CCFILES): Add cref.cc.
12986         (HFILES): Add cref.h.
12987         * Makefile.in: Rebuild.
12988
12989 2008-07-22  Simon Baldwin  <simonb@google.com>
12990
12991         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12992         to zero when writing undefined symbols.
12993
12994 2008-07-22  Ian Lance Taylor  <iant@google.com>
12995
12996         * output.cc (Output_section::add_input_section): Don't try to
12997         merge empty merge sections.
12998
12999 2008-07-21  Craig Silverstein  <csilvers@google.com>
13000
13001         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13002         Include symbol version in error message.
13003
13004 2008-07-20  Chris Demetriou  <cgd@google.com>
13005
13006         * configure.ac (gold_cv_c_random_seed): New configured variable.
13007         (RANDOM_SEED_CFLAGS): New substituted variable.
13008         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13009         * configure: Rebuild.
13010         * Makefile.in: Likewise.
13011         * testsuite/Makefile.in: Likewise.
13012
13013 2008-07-18  Ian Lance Taylor  <iant@google.com>
13014
13015         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13016         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13017         * testsuite/ver_test_main.cc (main): Call t4.
13018         (t4, t4_2a): Define.
13019         * testsuite/ver_test_2.cc (t4_2): Define.
13020         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13021         * testsuite/ver_test_4.cc (t4_2a): Define.
13022         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13023         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13024
13025 2008-07-17  Ian Lance Taylor  <iant@google.com>
13026
13027         * dynobj.cc (Versions::add_def): If we give an error about a
13028         missing version, go ahead and create the version anyhow.
13029
13030 2008-07-10  Ian Lance Taylor  <iant@google.com>
13031
13032         Handle output sections with more than 0x7fffffff bytes.
13033         * object.h (class Relobj): Change map_to_output_ to
13034         output_sections_, and just keep a section pointer.  Change all
13035         uses.  Move comdat group support to Sized_relobj.
13036         (Relobj::is_section_specially_mapped): Remove.
13037         (Relobj::output_section): Remove poff parameter.  Change all
13038         callers.
13039         (Relobj::output_section_offset): New function.
13040         (Relobj::set_section_offset): Rewrite.
13041         (Relobj::map_to_output): Remove.
13042         (Relobj::output_sections): New function.
13043         (Relobj::do_output_section_offset): New pure virtual function.
13044         (Relobj::do_set_section_offset): Likewise.
13045         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13046         group support from Relobj.  Update declarations.
13047         (Sized_relobj::get_output_section_offset): New function.
13048         (Sized_relobj::do_output_section_offset): New function.
13049         (Sized_relobj::do_set_section_offset): New function.
13050         * object.cc (Relobj::output_section_address): Remove.
13051         (Sized_relobj::Sized_relobj): Initialize new fields.
13052         (Sized_relobj::include_section_group): Cast find_kept_object to
13053         Sized_relobj.
13054         (Sized_relobj::include_linkonce_section): Likewise.
13055         (Sized_relobj::do_layout): Use separate arrays for output section
13056         and output offset.
13057         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13058         output_sections.
13059         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13060         output_sections and section_offsets.
13061         (Sized_relobj::write_local_symbols): Likewise.
13062         (map_to_kept_section): Compute output address directly.
13063         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13064         output_sections and section_offsets.
13065         (Sized_relobj::write_sections): Likewise.
13066         (Sized_relobj::relocate_sections): Likewise.
13067         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13068         * output.h (class Output_reloc): Update declarations.  Change
13069         u2_.relobj to Sized_relobj*.
13070         (class Output_data_reloc): Change add functions to use
13071         Sized_relobj*.
13072         * output.cc (Output_reloc::Output_reloc): Change relobj to
13073         Sized_relobj*.
13074         (Output_reloc::local_section_offset): Change return type to
13075         Elf_Addr.  Use get_output_section_offset.
13076         (Output_reloc::get_address): Likewise.
13077         (Output_section::is_input_address_mapped): Don't call
13078         is_section_specially_mapped.
13079         (Output_section::output_offset): Likewise.
13080         (Output_section::output_address): Likewise.
13081         (Output_section::starting_output_address): Likewise.
13082         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13083         parameter to Sized_relobj*.
13084         (Copy_relocs::need_copy_reloc): Likewise.
13085         (Copy_relocs::save): Likewise.
13086         * copy-relocs.h (class Copy_relocs): Update declarations.
13087         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13088         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13089         * target-reloc.h (relocate_for_relocatable): Change
13090         offset_in_output_section type to Elf_Addr.  Change code that uses
13091         it as well.
13092         * layout.cc (Layout::layout): Always set *off.
13093         * mapfile.cc (Mapfile::print_input_section): Use
13094         output_section_offset.
13095         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13096         Sized_relobj*.
13097         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13098         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13099         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13100
13101 2008-07-03  Ian Lance Taylor  <iant@google.com>
13102
13103         * layout.cc (Layout::include_section): Do not discard unrecognized
13104         SHT_STRTAB sections.
13105
13106 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13107
13108         * script.cc (Lex::can_continue_name): Make '?' allowable in
13109         version-script names.
13110         * testsuite/version_script.map: Change glob pattern to use '?'
13111
13112 2008-06-30  Manish Singh  <yosh@gimp.org>
13113
13114         PR 6585
13115         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13116         Correct typo.
13117
13118 2008-06-30  Ian Lance Taylor  <iant@google.com>
13119
13120         PR 6660
13121         PR 6682
13122         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13123         versions]: Don't try to read the value in the contents, since we
13124         don't use it.  Use the template endianness when writing.
13125
13126 2008-06-25  Cary Coutant  <ccoutant@google.com>
13127
13128         * fileread.cc (File_read::make_view): Assert on zero-length view.
13129         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13130         symbol table when there are no symbols to read.
13131
13132 2008-06-23  Craig Silverstein  <csilvers@google.com>
13133
13134         * version.cc (version_string): Bump to 1.7
13135
13136 2008-06-18  Craig Silverstein  <csilvers@google.com>
13137
13138         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13139         constant 0xFFFF to type Valtype.
13140         (Powerpc_relocate_functions::rel16_ha): Likewise.
13141
13142 2008-06-17  Ian Lance Taylor  <iant@google.com>
13143
13144         * output.h (Output_section::Input_section): Initialize p2align_ to
13145         zero for Output_section_data constructors.
13146         (Output_section::Input_section::addralign): If not an input
13147         section, return the alignment of the Output_section_data.
13148         * testsuite/copy_test.cc: New file.
13149         * testsuite/copy_test_1.cc: New file.
13150         * testsuite/copy_test_2.cc: New file.
13151         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13152         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13153         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13154         (copy_test_1_pic.o, copy_test_1.so): New targets.
13155         (copy_test_2_pic.o, copy_test_2.so): New targets.
13156         * testsuite/Makefile.in: Rebuild.
13157
13158         * script-sections.cc (Script_sections::place_orphan): Initialize
13159         local variable exact.
13160
13161 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13162
13163         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13164
13165 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13166             David S. Miller  <davem@davemloft.net>
13167
13168         * powerpc.cc: New file.
13169         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13170         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13171         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13172         * Makefile.in: Rebuild.
13173
13174 2008-06-09  Ian Lance Taylor  <iant@google.com>
13175
13176         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13177         <exception>.
13178         (throwing, orig_terminate): New static variables.
13179         (terminate_handler): New static function.
13180         (t2): Set terminate handler.
13181
13182 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13183
13184         PR 6584
13185         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13186         alignment.
13187
13188 2008-05-30  Cary Coutant  <ccoutant@google.com>
13189
13190         * archive.cc (Archive::include_all_members) Correct to step
13191         over symbol table and extended name table in thin archives.
13192
13193 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13194
13195         PR 6407
13196         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13197         calculation.
13198
13199 2008-05-28  Caleb Howe  <cshowe@google.com>
13200
13201         * reduced_debug_output.cc: New file.
13202         * reduced_debug_output.h: New file.
13203         * options.h (class General_options): Add --strip-debug-non-line.
13204         * options.cc (General_options::finalize): Add strip_debug_non_line
13205         to the strip heirarchy.
13206         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13207         fields.
13208         * layout.cc: Include "reduced_debug_output.h".
13209         (Layout::Layout): Initialize new fields.
13210         (line_only_debug_sections): New static array.
13211         (is_lines_only_debug_sections): New static inline function.
13212         (Layout::include_section): Handle --strip-debug-non-line.
13213         (Layout::make_output_section): If --strip-debug-non-line, build
13214         new output sections for .debug_abbrev and .debug_info.
13215         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13216         gold.  Warn about possible overflow.
13217         (read_signed_LEB_128): Likewise.
13218         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13219         (read_signed_LEB_128): Declare.
13220         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13221         (HFILES): Add reduced_debug_output.h.
13222         * Makefile.in: Rebuild.
13223
13224 2008-05-21  Ian Lance Taylor  <iant@google.com>
13225
13226         * mapfile.cc: New file.
13227         * mapfile.h: New file.
13228         * options.h (class General_options): Add -M/--print-map and -Map.
13229         * options.cc (General_options::finalize): Make -M equivalent to
13230         -Map -.
13231         * main.cc: Include <cstdio> and "mapfile.h".
13232         (main): Open mapfile if requested.
13233         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13234         constructor.  Change caller.
13235         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13236         (queue_middle_tasks): Likewise.
13237         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13238         declarations.
13239         * archive.cc: Include "mapfile.h".
13240         (Archive::add_symbols): Add mapfile parameter.  Change all
13241         callers.  Pass mapfile, symbol, and reason to include_member.
13242         (Archive::include_all_members): Add mapfile parameter.  Change all
13243         callers.
13244         (Archive::include_member): Add mapfile, sym, and why parameters.
13245         Change all callers.  Report inclusion to map file.
13246         * archive.h: Include "fileread.h".
13247         (class Archive): Update declarations.
13248         (Archive::file): New const method.
13249         (class Add_archive_symbols): Add mapfile_ field.  Update
13250         constructor.  Change all callers.
13251         * readsyms.h (class Read_symbols): Likewise.
13252         (class Finish_group): Likewise.
13253         (class Read_script): Likewise.
13254         * common.cc: Include "mapfile.h".
13255         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13256         all callers.
13257         (Symbol_table::do_allocate_commons): Likewise.
13258         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13259         symbol allocation to mapfile.
13260         * common.h (class Allocate_commons_task): Add mapfile_ field.
13261         Update constructor.  Change all callers.
13262         * symtab.h (class Symbol_table): Update declarations.
13263         * layout.cc: Include "mapfile.h".
13264         (Layout_task_runner::run): Print information to mapfile.
13265         (Layout::create_gold_note): Change Output_data_fixed_space to
13266         Output_data_zero_fill.
13267         (Layout::create_build_id): Likewise.
13268         (Layout::print_to_mapfile): New function.
13269         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13270         constructor.  Change caller.
13271         (class Layout): Declare print_to_mapfile.
13272         * output.cc (Output_section::Input_section::print_to_mapfile): New
13273         function.
13274         (Output_section::add_input_section): If producing a map, always
13275         add to input_sections_ list.
13276         (Output_section::do_print_to_mapfile): New function.
13277         (Output_segment::print_sections_to_mapfile): New function.
13278         (Output_segment::print_section_list_to_mapfile): New function.
13279         * output.h: Include "mapfile.h".
13280         (Output_data::print_to_mapfile): New function.
13281         (Output_data::do_print_to_mapfile): New virtual function.
13282         (Output_segment_headers::do_print_to_mapfile): New function.
13283         (Output_file_header::do_print_to_mapfile): New function.
13284         (Output_data_const::do_print_to_mapfile): New function.
13285         (class Output_data_const_buffer): Add map_name_ field.  Update
13286         constructor.  Change all callers.  Add do_print_to_mapfile
13287         function.
13288         (class Output_data_fixed_space): Likewise.
13289         (class Output_data_space): Likewise.
13290         (class Output_data_zero_fill): New class.
13291         (Output_data_strtab::do_print_to_mapfile): New function.
13292         (Output_data_reloc_base::do_print_to_mapfile): New function.
13293         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13294         (Output_data_group::do_print_to_mapfile): New function.
13295         (Output_data_got::do_print_to_mapfile): New function.
13296         (Output_data_dynamic::do_print_to_mapfile): New function.
13297         (Output_symtab_xindex::do_print_to_mapfile): New function.
13298         (class Output_section): Declare do_print_to_mapflie.  Declare
13299         print_to_mapfile in Input_section.
13300         (class Output_segment): Declare new functions.
13301         * object.h (Sized_relobj::symbol_count): New function.
13302         * script-sections.cc
13303         (Output_section_element_dot_assignment::set_section_addresses):
13304         Change Output_data_fixed_space to Output_data_zero_fill.
13305         (Output_data_expression::do_print_to_mapfile): New function.
13306         * script.cc (read_input_script): Add mapfile parameter.  Change
13307         all callers.
13308         * script.h (read_input_script): Update declaration.
13309         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13310         (Eh_frame::do_print_to_mapfile): New function.
13311         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13312         (Output_merge_string::do_print_to_mapfile): New function.
13313         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13314         function.
13315         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13316         function.
13317         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13318         function.
13319         * Makefile.am (CCFILES): Add mapfile.cc.
13320         (HFILES): Add mapfile.h.
13321         * Makefile.in: Rebuild.
13322
13323 2008-05-19  Ian Lance Taylor  <iant@google.com>
13324
13325         * options.h (class General_options): Add -z relro.
13326         * layout.cc (Layout::Layout): Initialize relro_segment_.
13327         (Layout::add_output_section_data): Return the output section.
13328         (Layout::make_output_section): Rcognize relro sections and mark
13329         them appropriately.
13330         (Layout::attach_allocated_section_to_segment): Put relro sections
13331         in a PT_GNU_RELRO segment.
13332         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13333         section as relro.
13334         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13335         PT_TLS segments.
13336         (Layout::linkonce_mapping): Map d.rel.ro.local to
13337         .data.rel.ro.local.
13338         (Layout::output_section_name): Us .data.rel.ro.local for any
13339         section which begins with that.
13340         * layout.h (class Layout): Update add_output_section_data
13341         declaration.  Add relro_segment_ field.
13342         * output.cc (Output_section::Output_section): Initialize is_relro_
13343         and is_relro_local_ fields.
13344         (Output_segment::add_output_section): Group relro sections.
13345         (Output_segment::is_first_section_relro): New function.
13346         (Output_segment::maximum_alignment): If there is a relro section,
13347         align the segment to the common page size.
13348         (Output_segment::set_section_addresses): Track whether we are
13349         looking at relro sections.  If the last section is a relro
13350         section, align to the common page size.
13351         (Output_segment::set_section_list_addresses): Add in_relro
13352         parameter.  Change all callers.  Align to the page size when
13353         moving from relro to non-relro section.
13354         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13355         segment.
13356         * output.h (class Output_section): Add is_relro_ and
13357         is_relro_local_ fields.
13358         (Output_section::is_relro): New function.
13359         (Output_section::set_is_relro): New function.
13360         (Output_section::is_relro_local): New function.
13361         (Output_section::set_is_relro_local): New function.
13362         (class Output_segment): Update declarations.
13363         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13364         * sparc.cc (Target_sparc::got_section): Likewise.
13365         * x86_64.cc (Target_x86_64::got_section): Likewise.
13366         * testsuite/relro_test_main.cc: New file.
13367         * testsuite/relro_test.cc: New file.
13368         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13369         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13370         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13371         (relro_test.so, relro_test_pic.o): New targets.
13372         * testsuite/Makefile.in: Rebuild.
13373
13374 2008-05-16  Ian Lance Taylor  <iant@google.com>
13375
13376         * output.cc (Output_segment::add_output_section): Remove front
13377         parameter.
13378         * output.h (class Output_segment): Remove
13379         add_initial_output_section and overloaded add_output_section.
13380         Update declaration of remaining add_output_section.
13381         * layout.cc (Layout::create_interp): Call add_output_section
13382         rather than add_initial_output_section.
13383         (Layout::finish_dynamic_section): Likewise.
13384
13385         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13386         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13387         know the dynamic type.
13388         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13389         field.  Initialize it in constructor.
13390         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13391         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13392         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13393         reloc.
13394
13395         * output.cc (Output_reloc::get_address): Change return type to
13396         Elf_Addr.
13397         * output.h (class Output_reloc): Update get_address declaration.
13398         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13399         for section addresses.
13400
13401 2008-05-09  Ian Lance Taylor  <iant@google.com>
13402
13403         PR 6493
13404         * gold.cc (gold_nomem): Use return value of write.
13405
13406 2008-05-08  Ian Lance Taylor  <iant@google.com>
13407
13408         * symtab.c (Symbol::init_base_output_data): Add version
13409         parameter.  Change all callers.
13410         (Symbol::init_base_output_segment): Likewise.
13411         (Symbol::init_base_constant): Likewise.
13412         (Symbol::init_base_undefined): Likewise.
13413         (Sized_symbol::init_output_data): Likewise.
13414         (Sized_symbol::init_output_segment): Likewise.
13415         (Sized_symbol::init_constant): Likewise.
13416         (Sized_symbol::init_undefined): Likewise.
13417         (Symbol_table::do_define_in_output_data): If the new symbol has a
13418         version, mark it as the default.
13419         (Symbol_table::do_define_in_output_segment): Likewise.
13420         (Symbol_table::do_define_as_constant): Likewise.
13421         * symtab.h (class Symbol): Update declarations.
13422         (class Sized_symbol): Likewise.
13423         * resolve.cc (Symbol::override_version): New function.
13424         (Symbol::override_base): Call override_version.
13425         (Symbol::override_base_with_special): Likewise.
13426         * testsuite/ver_script_8.script: New file.
13427         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13428         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13429         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13430         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13431
13432 2008-05-06  Ian Lance Taylor  <iant@google.com>
13433
13434         PR 6049
13435         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13436         functions.
13437         (class General_options): Remove existing --undefined, and add
13438         --no-undefined instead.  Add new --undefined as synonym for -u.
13439         * archive.cc (Archive::add_symbols): Check whether symbol was
13440         named with -u.
13441         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13442         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13443         all uses.  Add IS_UNDEFINED.  Update declarations to split
13444         different versions of init_base.  Declare init_base_undefined.
13445         (Symbol::is_defined): Handle IS_UNDEFINED.
13446         (Symbol::is_undefined): Likewise.
13447         (Symbol::is_weak_undefined): Call is_undefined.
13448         (Symbol::is_absolute): Handle IS_CONSTANT.
13449         (class Sized_symbol): Update declarations to split different
13450         versions of init.  Declare init_undefined.
13451         (class Symbol_table): Declare new functions.
13452         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13453         Change all callers.
13454         (Symbol::init_base_output_data): Likewise.
13455         (Symbol::init_base_output_segment): Likewise.
13456         (Symbol::init_base_constant): Likewise.
13457         (Symbol::init_base_undefined): New function.
13458         (Sized_symbol::init_object): Rename from init.  Change all
13459         callers.
13460         (Sized_symbol::init_output_data): Likewise.
13461         (Sized_symbol::init_output_segment): Likewise.
13462         (Sized_symbol::init_constant): Likewise.
13463         (Sized_symbol::init_undefined): New function.
13464         (Symbol_table::add_undefined_symbols_from_command_line): New
13465         function.
13466         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13467         function.
13468         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13469         (Symbol::output_section): Likewise.
13470         (Symbol::set_output_section): Likewise.
13471         (Symbol_table::sized_finalize_symbol): Likewise.
13472         (Symbol_table::sized_write_globals): Likewise.
13473         * resolve.cc (Symbol_table::should_override): Likewise.
13474         (Symbol::override_base_with_special): Likewise.
13475
13476         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13477         symbol, change it to have default visibility.
13478         * testsuite/protected_1.cc: New file.
13479         * testsuite/protected_2.cc: New file.
13480         * testsuite/protected_3.cc: New file.
13481         * testsuite/protected_main_1.cc: New file.
13482         * testsuite/protected_main_2.cc: New file.
13483         * testsuite/protected_main_3.cc: New file.
13484         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13485         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13486         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13487         (protected_1.so): New target.
13488         (protected_1_pic.o, protected_2_pic.o): New targets.
13489         (protected_3_pic.o): New target.
13490         (check_PROGRAMS): Add protected_2.
13491         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13492         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13493         * testsuite/Makefile.in: Rebuild.
13494
13495         * options.h (DEFINE_var): Add set_user_set_##varname__.
13496         (DEFINE_bool_alias): New macro.
13497         (class General_options): Define -Bstatic using DEFINE_bool_alias
13498         rather than DEFINE_special.  Add --undefined as an alias for -z
13499         defs.
13500         * options.cc (General_options::parse_Bstatic): Remove.
13501
13502         * options.h (class General_options): Add --fatal-warnings.
13503         * main.cc (main): Implement --fatal-warnings.
13504         * errors.h (Errors::warning_count): New function.
13505
13506         * options.h (class General_options): Add -Bsymbolic-functions.
13507         * symtab.h (Symbol::is_preemptible): Check for
13508         -Bsymbolic-functions.
13509
13510 2008-05-05  Ian Lance Taylor  <iant@google.com>
13511
13512         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13513         as noVARNAME rather than no-VARNAME.
13514         (class General_options): Add option -z combreloc.
13515         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13516         get_address.
13517         (Output_reloc::sort_before) [SHT_REL]: New function.
13518         (Output_reloc::sort_before) [SHT_RELA]: New function.
13519         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13520         Sort_relocs_comparison.
13521         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13522         parameter.  Change all callers.
13523         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13524         sort_relocs parameter.  Change all callers.
13525         * output.cc (Output_reloc::get_address): New function, broken out
13526         of write_rel.
13527         (Output_reloc::write_rel): Call it.
13528         (Output_reloc::compare): New function.
13529         (Output_data_reloc_base::do_write): Optionally sort relocs.
13530
13531         * configure.ac: If targ_extra_obj is set, link it in.
13532         * configure.tgt: Initialize all variables.
13533         (x86_64*): Set targ_extra_obj and targ_extra_size.
13534         * configure: Rebuild.
13535
13536         * object.cc (Sized_relobj::include_section_group): Adjust section
13537         indexes read from group data.  Build vector to pass to
13538         layout_group.
13539         * layout.cc (Layout::layout_group): Add flags and shndxes
13540         parameters.  Remove contents parameter.  Change caller.  Update
13541         explicit instantiations.
13542         * layout.h (class Layout): Update layout_group declaration.
13543         * output.cc (Output_data_group::Output_data_group): Add flags and
13544         input_shndxes parameters.  Remove contents parameter.  Change
13545         caller.
13546         (Output_data_group::do_write): Change input_sections_ to
13547         input_shndxes_.
13548         * output.h (class Output_data_group): Update constructor
13549         declaration.  Rename input_sections_ to input_shndxes_.
13550         * testsuite/many_sections_test.cc: Add template.
13551
13552 2008-04-30  Cary Coutant  <ccoutant@google.com>
13553
13554         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13555
13556         * layout.cc (Layout::include_section): Refactored check for debug
13557         info section.
13558         (Layout::add_comdat): Add new parameters.  Change type
13559         of signature parameter.  Add object and shndx to signatures table.
13560         (Layout::find_kept_object): New function.
13561         * layout.h: Include <cstring>.
13562         (Layout::is_debug_info_section): New function.
13563         (Layout::add_comdat): Add new parameters.
13564         (Layout::find_kept_object): New function.
13565         (Layout::Kept_section): New struct.
13566         (Layout::Signatures): Change type of map range.
13567         * object.cc (Relobj::output_section_address): New function.
13568         (Sized_relobj::include_section_group): Add new parameters.  Change
13569         calls to Layout::add_comdat.  Change to build table of kept comdat
13570         groups and table mapping discarded sections to kept sections.
13571         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13572         (Sized_relobj::do_layout): Change calls to include_section_group and
13573         include_linkonce_section.
13574         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13575         value to zero when section is discarded.
13576         (Sized_relobj::map_to_kept_section): New function.
13577         * object.h (Relobj::output_section_address): New function.
13578         (Relobj::Comdat_group): New type.
13579         (Relobj::find_comdat_group): New function.
13580         (Relobj::Comdat_group_table): New type.
13581         (Relobj::Kept_comdat_section): New type.
13582         (Relobj::Kept_comdat_section_table): New type.
13583         (Relobj::add_comdat_group): New function.
13584         (Relobj::set_kept_comdat_section): New function.
13585         (Relobj::get_kept_comdat_section): New function.
13586         (Relobj::comdat_groups_): New field.
13587         (Relobj::kept_comdat_sections_): New field.
13588         (Symbol_value::input_value): Update comment.
13589         (Sized_relobj::map_to_kept_section) New function.
13590         (Sized_relobj::include_linkonce_section): Add new parameter.
13591         * target-reloc.h (Comdat_behavior): New type.
13592         (get_comdat_behavior): New function.
13593         (relocate_section): Add code to map a discarded section to the
13594         corresponding kept section when applying a relocation.
13595
13596 2008-04-30  Craig Silverstein  <csilvers@google.com>
13597
13598         * dwarf_reader.cc (next_generation_count): New static var.
13599         (Addr2line_cache_entry): New struct.
13600         (addr2line_cache): New static var.
13601         (Dwarf_line_info::one_addr2line): Added caching.
13602         (Dwarf_line_info::clear_addr2line_cache): New function.
13603         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13604         cache-size parameter.
13605         (Dwarf_line_info::one_addr2line_cache): New function.
13606         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13607         new cache-size argument to one_addr2line(), and clear cache.
13608
13609 2008-04-28  Cary Coutant  <ccoutant@google.com>
13610
13611         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13612         R_386_PC8 relocations.
13613
13614 2008-04-23  Ian Lance Taylor  <iant@google.com>
13615
13616         * object.cc (Sized_relobj::include_section_group): Check for
13617         invalid section group.
13618
13619         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13620         header size.
13621
13622         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13623         than read for file header.
13624         * archive.cc (Archive::include_member): Likewise.
13625
13626 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13627
13628         * aclocal.m4: Regenerate.
13629         * configure: Regenerate.
13630
13631 2008-04-19  Ian Lance Taylor  <iant@google.com>
13632
13633         * version.cc (version_string): Bump to 1.6.
13634
13635         * testsuite/Makefile.am (many_sections_r_test): New target.
13636         (many_sections_r_test_SOURCES): Remove.
13637         (many_sections_r_test_DEPENDENCIES): Remove.
13638         (many_sections_r_test_LDFLAGS): Remove.
13639         (many_sections_r_test_LDADD): Remove.
13640
13641         * object.cc (Sized_relobj::do_add_symbols): Always pass
13642         local_symbol_count_ to add_from_relobj.
13643
13644         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13645         every thousand variables.
13646         * testsuite/Makefile.in: Rebuild.
13647
13648         * object.cc (Xindex::initialize_symtab_xindex): New function.
13649         (Xindex::read_symtab_xindex): New function.
13650         (Xindex::sym_xindex_to_shndx): New function.
13651         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13652         available.
13653         (Sized_relobj::do_initialize_xindex): New function.
13654         (Sized_relobj::do_read_symbols): Adjust section links.
13655         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13656         parameter.  Change all callers.
13657         (Sized_relobj::include_section_group): Adjust section links and
13658         symbol section indexes.
13659         (Sized_relobj::do_layout): Adjust section links.
13660         (Sized_relobj::do_count_local_symbols): Adjust section links and
13661         symbol section indexes.
13662         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13663         ordinary and special symbols.
13664         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13665         dynsym_xindex parameters.  Change all callers.  Adjust section
13666         links.  Use SHN_XINDEX when needed.
13667         (Sized_relobj::get_symbol_location_info): Adjust section links.
13668         Don't get fooled by special symbols.
13669         * object.h (class Xindex): Define.
13670         (class Object): Add xindex_ parameter.  Declare virtual functoin
13671         do_initialize_xindex.
13672         (Object::adjust_sym_shndx): New function.
13673         (Object::set_xindex): New protected function.
13674         (class Symbol_value): Add is_ordinary_shndx_ field.
13675         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13676         (Symbol_value::value): Assert ordinary section.
13677         (Symbol_value::initialize_input_to_output_map): Likewise.
13678         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13679         Change all callers.
13680         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13681         all callers.
13682         (class Sized_relobj): Update declarations.
13683         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13684         parameter.  Change all callers.
13685         (Sized_relobj::adjust_shndx): New function.
13686         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13687         field.
13688         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13689         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13690         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13691         (Sized_dynobj::read_dynsym_section): Adjust section links.
13692         (Sized_dynobj::read_dynamic): Likewise.
13693         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13694         section links.
13695         (Sized_dynobj::do_initialize_xindex): New function.
13696         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13697         do_initialize_xindex.
13698         (Sized_dynobj::adjust_shndx): New function.
13699         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13700         dynsym_xindex_ fields.
13701         (Layout::finalize): Add a call to set_section_indexes before
13702         creating the symtab sections.
13703         (Layout::set_section_indexes): Don't do anything if the section
13704         already has a section index.
13705         (Layout::create_symtab_sections): Add shnum parameter.  Change
13706         caller.  Create .symtab_shndx section if needed.
13707         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13708         caller.
13709         (Layout::allocated_output_section_count): New function.
13710         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13711         needed.
13712         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13713         fields.  Update declarations.
13714         (Layout::symtab_xindex): New function.
13715         (Layout::dynsym_xindex): New function.
13716         (class Write_symbols_task): Add layout_ field.
13717         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13718         Change caller.
13719         * output.cc (Output_section_headers::Output_section_headers): Add
13720         shstrtab_section parameter.  Change all callers.
13721         (Output_section_headers::do_sized_write): Store overflow values
13722         for section count and section string table section index in
13723         section header zero.
13724         (Output_file_header::do_sized_write): Check for overflow of
13725         section count and section string table section index.
13726         (Output_symtab_xindex::do_write): New function.
13727         (Output_symtab_xindex::endian_do_write): New function.
13728         * output.h (class Output_section_headers): Add shstrtab_section_.
13729         Update declarations.
13730         (class Output_symtab_xindex): Define.
13731         (Output_section::has_out_shndx): New function.
13732         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13733         field.
13734         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13735         Change all callers.
13736         (Sized_symbol::init): Likewise.
13737         (Symbol::output_section): Check for ordinary symbol.
13738         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13739         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13740         callers.
13741         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13742         Change all callers.  Simplify handling of symbols from sections
13743         not included in the link.
13744         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13745         distinction.
13746         (Weak_alias_sorter::operator()): Assert that symbols are
13747         ordinary.
13748         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13749         distinction.
13750         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13751         parameters.  Change all callers.
13752         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13753         symbol distinction.  Use SHN_XINDEX when needed.
13754         (Symbol_table::write_section_symbol): Add symtab_xindex
13755         parameter.  Change all callers.
13756         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13757         SHN_XINDEX when needed.
13758         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13759         declarations.
13760         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13761         (Symbol::is_defined): Check is_ordinary.
13762         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13763         (Symbol::is_absolute, Symbol::is_common): Likewise.
13764         (class Sized_symbol): Update declarations.
13765         (class Symbol_table): Update declarations.
13766         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13767         parameters.  Change all callers.
13768         (Sized_symbol::override): Likewise.
13769         (Symbol_table::override): Likewise.
13770         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13771         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13772         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13773         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13774         to be in an ordinary section.
13775         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13776         object and is_ordinary parameters.  Change all callers.
13777         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13778         Change all callers.  Don't add undefined or non-ordinary symbols
13779         to reloc_map_.
13780         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13781         Change all callers.
13782         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13783         declarations.
13784         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13785         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13786         (Sized_relobj::relocate_sections): Likewise.
13787         * target-reloc.h (scan_relocs): Adjust section symbol index.
13788         (scan_relocatable_relocs): Likewise.
13789         * i386.cc (Scan::local): Check for ordinary symbols.
13790         * sparc.cc (Scan::local): Likewise.
13791         * x86_64.cc (Scan::local): Likewise.
13792         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13793         to symbol_section_and_value.
13794         * testsuite/many_sections_test.cc: New file.
13795         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13796         (check_PROGRAMS): Add many_sections_test.
13797         (many_sections_test_SOURCES): Define.
13798         (many_sections_test_DEPENDENCIES): Define.
13799         (many_sections_test_LDFLAGS): Define.
13800         (BUILT_SOURCES): Add many_sections_define.h.
13801         (many_sections_define.h): New target.
13802         (BUILT_SOURCES): Add many_sections_check.h.
13803         (many_sections_check.h): New target.
13804         (check_PROGRAMS): Add many_sections_r_test.
13805         (many_sections_r_test_SOURCES): Define.
13806         (many_sections_r_test_DEPENDENCIES): Define.
13807         (many_sections_r_test_LDFLAGS): Define.
13808         (many_sections_r_test_LDADD): Define.
13809         (many_sections_r_test.o): New target.
13810         * testsuite/Makefile.in: Rebuild.
13811
13812 2008-04-17  Cary Coutant  <ccoutant@google.com>
13813
13814         * errors.cc (Errors::info): New function.
13815         (gold_info): New function.
13816         * errors.h (Errors::info): New function.
13817         * gold.h (gold_info): New function.
13818         * object.cc (Input_objects::add_object): Print trace output.
13819         * options.cc (options::parse_set): New function.
13820         (General_options::parse_wrap): Deleted.
13821         (General_options::General_options): Deleted initializer.
13822         * options.h (options::String_set): New typedef.
13823         (options::parse_set): New function.
13824         (DEFINE_set): New macro.
13825         (General_options::wrap): Changed to use DEFINE_set. Changed
13826         callers of any_wrap_symbols and is_wrap_symbol.
13827         (General_options::trace, General_options::trace_symbol):
13828         New options.
13829         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13830         (General_options::wrap_symbols_): Deleted.
13831         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13832
13833 2008-04-17  David S. Miller  <davem@davemloft.net>
13834
13835         * options.cc (General_options::parse_V): New function.
13836         * options.h: Add entries for -V and -Qy.
13837
13838 2008-04-17  Ian Lance Taylor  <iant@google.com>
13839
13840         * common.cc (Symbol_table::allocate_commons): Remove options
13841         parameter.  Change caller.
13842         (Symbol_table::do_allocate_commons): Remove options parameter.
13843         Change caller.  Just call do_allocate_commons_list twice.
13844         (Symbol_table::do_allocate_commons_list): New function, broken out
13845         of do_allocate_commons.
13846         * common.h (class Allocate_commons_task): Remove options_ field.
13847         Update constructor.
13848         * symtab.cc (Symbol_table::Symbol_table): Initialize
13849         tls_commons_.
13850         (Symbol_table::add_from_object): Put TLS common symbols on
13851         tls_commons_ list.
13852         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13853         which are IN_OUTPUT_DATA.
13854         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13855         allocate_commons and do_allocate_commons declarations.  Declare
13856         do_allocate_commons_list.
13857         * gold.cc (queue_middle_tasks): Update creation of
13858         Allocate_commons_task to not pass options.
13859         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13860         (TLS_TEST_C_FLAGS): New variable.
13861         (tls_test_c_pic.o): New target.
13862         (tls_test_shared.so): Link in tls_test_c_pic.o.
13863         (tls_test_c_pic_ie.o): New target.
13864         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13865         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13866         (tls_test_c.o): New target.
13867         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13868         (tls_pic_test_LDADD): Likewise.
13869         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13870         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13871         (tls_test_c_gnu2.o): New target.
13872         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13873         tls_test_c_gnu2.o.
13874         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13875         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13876         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13877         * testsuite/tls_test.cc: Include "config.h".
13878         (t_last): Call t11_last.
13879         * testsuite/tls_test.h (t11, t11_last): Declare.
13880         * testsuite/tls_test_c.c: New file.
13881         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13882         * configure.ac: Check for OpenMP support.
13883         * configure, config.in, Makefile.in: Rebuild.
13884         * testsuite/Makefile.in: Rebuild.
13885
13886 2008-04-16  Cary Coutant  <ccoutant@google.com>
13887
13888         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13889         (Target_i386::tls_base_symbol_defined_): New field.
13890         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13891         (Target_i386::Scan::global): Likewise.
13892         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13893         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13894         (Target_x86_64::tls_base_symbol_defined_): New field.
13895         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13896         (Target_x86_64::Scan::global): Likewise.
13897
13898 2008-04-16  Cary Coutant  <ccoutant@google.com>
13899
13900         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13901         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13902         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13903         building shared libraries.
13904         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13905         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13906         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13907         * testsuite/Makefile.in: Rebuild.
13908         * testsuite/weak_undef.h: New file.
13909         * testsuite/weak_undef_file1.cc: Add extra test cases.
13910         * testsuite/weak_undef_file2.cc: Likewise.
13911         * testsuite/weak_undef_test.cc: Likewise.
13912
13913 2008-04-16  David S. Miller  <davem@davemloft.net>
13914
13915         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13916         Add issued_non_pic_error_ field.  Declare check_non_pic.
13917         (Target_sparc::Scan::check_non_pic): New function.
13918         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13919         (Target_sparc::Scan::global): Likewise.
13920
13921         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13922         * configure: Rebuild.
13923
13924         * options.h (DEFINE_enable): New macro.
13925         (new_dtags): New enable option.
13926         (initfirst, interpose, loadfltr, nodefaultlib,
13927         nodelete, nodlopen, nodump): New -z options.
13928         * layout.cc (Layout:finish_dynamic_section): If new
13929         dtags enabled, emit DT_RUNPATH.  Also, emit a
13930         DT_FLAGS_1 containing any specified -z flags.
13931
13932 2008-04-16  Ian Lance Taylor  <iant@google.com>
13933
13934         * copy-relocs.cc: New file.
13935         * copy-relocs.h: New file.
13936         * reloc.cc: Remove Copy_relocs code.
13937         * reloc.h: Likewise.
13938         * reloc-types.h (struct Reloc_types) [both versions]: Add
13939         get_reloc_addend_noerror.
13940         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13941         variants of add_global which take an addend which must be zero.
13942         * i386.cc: Include "copy-relocs.h".
13943         (class Target_i386): Change type of copy_relocs_ to variable,
13944         update initializer.
13945         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13946         Change all callers.
13947         (Target_i386::do_finalize_sections): Change handling of
13948         copy_relocs_.
13949         * sparc.cc: Include "copy-relocs.h".
13950         (class Target_sparc): Change type of copy_relocs_ to variable,
13951         update initializer.
13952         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13953         Change all callers.
13954         (Target_sparc::do_finalize_sections): Change handling of
13955         copy_relocs_.
13956         * x86_64.cc: Include "copy-relocs.h".
13957         (class Target_x86_64): Change type of copy_relocs_ to variable,
13958         update initializer.
13959         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13960         class.  Change all callers.
13961         (Target_x86_64::do_finalize_sections): Change handling of
13962         copy_relocs_.
13963         * Makefile.am (CCFILES): Add copy-relocs.cc.
13964         (HFILES): Add copy-relocs.h.
13965
13966         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13967
13968         * testsuite/script_test_4.sh: Permit leading zeroes.
13969
13970 2008-04-15  Ian Lance Taylor  <iant@google.com>
13971
13972         * script-sections.cc (Script_sections::create_segments): Use
13973         header_size_adjustment even when there is enough room for the
13974         headers.
13975         * testsuite/script_test_4.sh: New file.
13976         * testsuite/script_test_4.t: New file.
13977         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13978         (check_DATA): Add script_test_4.stdout.
13979         (MOSTLYCLEANFILES): Likewise.
13980         (script_test_4): New target.
13981         (script_test_4.stdout): New target.
13982         * testsuite/Makefile.in: Rebuild.
13983
13984         * sparc.cc: Add definitions for Output_data_plt_sparc class
13985         constants.
13986
13987 2008-04-14  David S. Miller  <davem@davemloft.net>
13988
13989         * sparc.cc: New file.
13990         * Makefile.am (TARGETSOURCES): Add sparc.cc
13991         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13992         * configure.tgt: Document targ_extra_size and
13993         targ_extra_big_endian.  Add entries for sparc-* and
13994         sparc64-*.
13995         * configure.ac: Handle targ_extra_size and
13996         targ_extra_big_endian.
13997         * Makefile.in: Rebuild.
13998         * configure: Likewise.
13999         * po/POTFILES.in: Likewise.
14000         * po/gold.pot: Likewise.
14001
14002 2008-04-14  Ian Lance Taylor  <iant@google.com>
14003
14004         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14005         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14006         in the name/type/flags to section mapping.  Don't call
14007         allocate_output_section.
14008         (Layout::choose_output_section): Change parameter from adjust_name
14009         to is_input_section.  Don't permit input sections after sections
14010         are attached to segments.  Don't call allocate_output_section.
14011         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14012         not write_enable_output_section.
14013         (Layout::make_output_section): Don't push to
14014         unattached_section_list_ nor call attach_to_segment.  Call
14015         attach_section_to_segment if sections are attached.
14016         (Layout::attach_sections_to_segments): New function.
14017         (Layout::attach_section_to_segment): New function.
14018         (Layout::attach_allocated_section_to_segment): Rename from
14019         attach_to_segment.  Remove flags parameter.
14020         (Layout::allocate_output_section): Remove function.
14021         (Layout::write_enable_output_section): Remove function.
14022         * layout.h (class Layout): Update for above changes.  Add new
14023         field sections_are_attached_.
14024         * output.h (Output_section::update_flags_for_input_section): New
14025         function.
14026         * output.cc (Output_section::add_input_section): Call
14027         update_flags_for_input_section.
14028         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14029
14030 2008-04-11  Cary Coutant  <ccoutant@google.com>
14031
14032         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14033         thought unnecessary.
14034         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14035
14036 2008-04-11  Ian Lance Taylor  <iant@google.com>
14037
14038         * output.h (class Output_section_data): Remove inline definition
14039         of set_addralign.
14040         * output.cc (Output_section_data::set_addralign): New function.
14041
14042 2008-04-11  Cary Coutant  <ccoutant@google.com>
14043
14044         Add support for TLS descriptors for i386 and x86_64.
14045         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14046         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14047         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14048         GOT_TYPE_TLS_DESC.
14049         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14050         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14051         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14052         relocations.
14053         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14054         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14055         Fix problem with initial-exec relocations.
14056         (Target_i386::Relocate::relocate_tls): Likewise.
14057         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14058         relaxation.
14059         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14060         support for section-plus-offset dynamic table entries.
14061         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14062         (Output_data_dynamic::Dynamic_entry): Add support for
14063         section-plus-offset dynamic table entries.
14064         (Output_data_dynamic::Classification): Likewise.
14065         (Output_data_dynamic::classification_): Renamed offset_.
14066         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14067         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14068         (Target_x86_64::make_plt_section): New function.
14069         (Target_x86_64::reserve_tlsdesc_entries): New function.
14070         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14071         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14072         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14073         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14074         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14075         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14076         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14077         add extra PLT entry for TLS descriptors.
14078         (Output_data_plt_x86_64::got_): New field.
14079         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14080         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14081         fields.
14082         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14083         descriptors.
14084         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14085         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14086         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14087         R_386_TLS_DESC_CALL relocations.
14088         (Target_x86_64::Scan::global): Likewise.
14089         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14090         for TLS descriptors.
14091         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14092         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14093         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14094         GD-to-IE relaxation.
14095         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14096         and TLS_DESCRIPTORS.
14097         * Makefile.in: Rebuild.
14098         * configure: Rebuild.
14099         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14100         (tls_test_shared2.so): New target.
14101         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14102         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14103         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14104         (tls_shared_gd_to_ie_test_LDADD): New variable.
14105         (tls_shared_gnu2_gd_to_ie_test): New target.
14106         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14107         New targets.
14108         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14109         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14110         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14111         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14112         (tls_shared_gnu2_test): New target.
14113         (tls_test_gnu2_shared.so): New target.
14114         (tls_shared_gnu2_test_SOURCES): New variable.
14115         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14116         (tls_shared_gnu2_test_LDFLAGS): New variable.
14117         (tls_shared_gnu2_test_LDADD): New variable.
14118         * testsuite/Makefile.in: Rebuild.
14119         * testsuite/Makefile.
14120
14121 2008-04-11  Ian Lance Taylor  <iant@google.com>
14122
14123         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14124         justsyms.t.
14125         * testsuite/Makefile.in: Rebuild.
14126
14127         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14128         long.
14129         * testsuite/script_test_2.cc (main): Adjust test.
14130
14131 2008-04-11  David S. Miller  <davem@davemloft.net>
14132             Ian Lance Taylor  <iant@google.com>
14133
14134         * options.h (General_options): Add entries for '-Y' and
14135         '-relax'.
14136         * options.cc (General_options:finalize): If -Y was used, add those
14137         entries to the library path instead of the default "/lib" and
14138         "/usr/lib".
14139
14140 2008-04-11  David S. Miller  <davem@davemloft.net>
14141
14142         * testsuite/justsyms.t: Start at 0x100.
14143         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14144         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14145         long.
14146         * testsuite/script_test_2.cc: Adjust string and section length
14147         checks.
14148
14149 2008-04-09  Ian Lance Taylor  <iant@google.com>
14150
14151         PR gold/5996
14152         * script-sections.cc (Sections_element::allocate_to_segment): Add
14153         orphan parameter.
14154         (Output_section_definition::allocate_to_segment): Likewise.
14155         (Orphan_output_section::allocate_to_segment): Likewise.
14156         (Script_sections::attach_sections_using_phdrs_clause): Don't
14157         propagate non-PT_LOAD segments to orphan sections.
14158         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14159         readelf rather than objdump.
14160         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14161         .interp section and PT_INTERP segment are the same size.
14162         * testsuite/Makefile.in: Rebuild.
14163
14164         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14165         aliases for symbols defined in the same object.
14166         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14167         (weak_alias_test_SOURCES): New variable.
14168         (weak_alias_test_DEPENDENCIES): New variable.
14169         (weak_alias_test_LDFLAGS): New variable.
14170         (weak_alias_test_LDADD): New variable.
14171         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14172         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14173         (weak_alias_test_3.o): New target.
14174         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14175         * testsuite/weak_alias_test_main.cc: New file.
14176         * testsuite/weak_alias_test_1.cc: New file.
14177         * testsuite/weak_alias_test_2.cc: New file.
14178         * testsuite/weak_alias_test_3.cc: New file.
14179
14180 2008-04-08  Ian Lance Taylor  <iant@google.com>
14181
14182         * options.h (class General_options): Add --noinhibit-exec option.
14183         * main.cc (main): Check --noinhibit-exec.
14184
14185         * options.h (class General_options): Define --wrap as a special
14186         option.  Add wrap_symbols_ field.
14187         (General_options::any_wrap_symbols): New function.
14188         (General_options::is_wrap_symbol): New function.
14189         * options.cc (General_options::parse_wrap): New function.
14190         (General_options::General_options): Initialize wrap_symbols_.
14191         * symtab.cc (Symbol_table::wrap_symbol): New function.
14192         (Symbol_table::add_from_object): Handle --wrap.
14193         * symtab.h (class Symbol_table): Declare wrap_symbol.
14194         * target.h (Target::wrap_char): New function.
14195         (Target::Target_info): Add wrap_char field.
14196         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14197         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14198         * testsuite/testfile.cc (Target_test::test_target_info):
14199         Likewise.
14200
14201         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14202         there is one.
14203
14204         * layout.h (class Layout): Add added_eh_frame_data_ field.
14205         * layout.cc (Layout::Layout): Initialize new field.
14206         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14207         output section until we find a section we merged successfully.
14208         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14209         that the size be non-zero.
14210
14211         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14212         qualifier.
14213
14214 2008-04-08  Craig Silverstein  <csilvers@google.com>
14215
14216         * configure.ac: Export new conditional variable HAVE_ZLIB.
14217         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14218         on HAVE_ZLIB.
14219         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14220         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14221
14222 2008-04-07  Ian Lance Taylor  <iant@google.com>
14223
14224         * version.cc (version_string): Set to "1.5".
14225
14226         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14227         Add issued_non_pic_error_ field.  Declare check_non_pic.
14228         (Target_x86_64::Scan::check_non_pic): New function.
14229         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14230         (Target_x86_64::Scan::global): Likewise.
14231
14232         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14233         addend parameter.  Change caller.  Handle merge sections.
14234         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14235         Address to Addend.  Don't add in the result of
14236         local_section_offset, pass down the addend and use the returned
14237         value.
14238         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14239         Update declarations of local_section_offset and symbol_value.
14240         * testsuite/two_file_test_1.cc (t18): New function.
14241         * testsuite/two_file_test_2.cc (f18): New function.
14242         * testsuite/two_file_test_main.cc (main): Call t18.
14243         * testsuite/two_file_test.h (t18, f18): Declare.
14244
14245         * configure.ac: Don't test for objdump, c++filt, or readelf.
14246         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14247         conditionals.
14248         (TEST_READELF): New variable.
14249         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14250         (check_PROGRAMS): Add two_file_strip_test.
14251         (two_file_strip_test): New target.
14252         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14253         (two_file_same_shared_strip_test_SOURCES): New variable.
14254         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14255         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14256         (two_file_same_shared_strip_test_LDADD): New variable.
14257         (two_file_shared_strip.so): New target.
14258         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14259         (ver_test_5.syms, ver_test_7.syms): Likewise.
14260         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14261         (strip_test_3.stdout): Use TEST_OBJDUMP.
14262         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14263
14264 2008-04-04  Cary Coutant  <ccoutant@google.com>
14265
14266         * symtab.h (Symbol::is_weak_undefined): New function.
14267         (Symbol::is_strong_undefined): New function.
14268         (Symbol::is_absolute): New function.
14269         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14270         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14271         absolute symbols.
14272         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14273         (weak_undef_test): New target.
14274         * testsuite/Makefile.in: Rebuild.
14275         * testsuite/weak_undef_file1.cc: New file.
14276         * testsuite/weak_undef_file2.cc: New file.
14277         * testsuite/weak_undef_test.cc: New file.
14278
14279 2008-04-03  Craig Silverstein  <csilvers@google.com>
14280
14281         * compressed_output.h (class Output_compressed_section): Use
14282         unsigned buffer.
14283         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14284         add zlib header.
14285         (zlib_compressed_suffix): Removed.
14286         (Output_compressed_section::set_final_data_size): Use unsigned
14287         buffers.
14288         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14289         Fix linker invocation.
14290         (flagstest_o_specialfile_and_compress_debug_sections):
14291         Likewise.
14292         * testsuite/Makefile.in: Regenerated.
14293
14294 2008-04-02  David S. Miller  <davem@davemloft.net>
14295
14296         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14297         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14298
14299 2008-04-02  Craig Silverstein  <csilvers@google.com>
14300
14301         * TODO: New file.
14302
14303 2008-04-02  Ian Lance Taylor  <iant@google.com>
14304
14305         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14306         parameters.  Update for new key type to views_.  Change all
14307         callers.
14308         (File_read::read): Adjust for byteshift in returned view.
14309         (File_read::add_view): New function, broken out of
14310         find_and_make_view.
14311         (File_read::make_view): New function, broken out of
14312         find_and_make_view.
14313         (File_read::find_or_make_view): Add offset and aligned
14314         parameters.  Rewrite accordingly.  Change all callers.
14315         (File_read::get_view): Add offset and aligned parameters.  Adjust
14316         for byteshift in return value.
14317         (File_read::get_lasting_view): Likewise.
14318         * fileread.h (class File_read): Update declarations.
14319         (class File_read::View): Add byteshift_ field.  Add byteshift to
14320         constructor.  Add byteshift method.
14321         * archive.h (Archive::clear_uncached_views): New function.
14322         (Archive::get_view): Add aligned parameter.  Change all callers.
14323         * object.h (Object::get_view): Add aligned parameter.  Change all
14324         callers.
14325         (Object::get_lasting_view): Likewise.
14326
14327         * fileread.cc (File_read::release): Don't call clear_views if
14328         there are multiple objects.
14329         * fileread.h (File_read::clear_uncached_views): New function.
14330         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14331         on the archive.
14332
14333 2008-03-31  Cary Coutant  <ccoutant@google.com>
14334
14335         Add thin archive support.
14336         * archive.cc (Archive::armagt): New const.
14337         (Archive::setup): Remove task parameter and calls to unlock.
14338         (Archive::unlock_nested_archives): New function.
14339         (Archive::read_header): Add nested_off parameter. Change
14340         all callers.
14341         (Archive::interpret_header): Likewise.
14342         (Archive::include_all_members): Change to handle thin
14343         archives.
14344         (Archive::include_member): Likewise.
14345         * archive.h (Archive::Archive): Add new parameters and
14346         initializers.
14347         (Archive::armagt): New const.
14348         (Archive::setup): Remove task parameter.
14349         (Archive::unlock_nested_archives): New function.
14350         (Archive::read_header): Add nested_off parameter.
14351         (Archive::interpret_header): Likewise.
14352         (Archive::Nested_archive_table): New typedef.
14353         (Archive::is_thin_archive_): New field.
14354         (Archive::nested_archives_): New field.
14355         (Archive::options_): New field.
14356         (Archive::dirpath_): New field.
14357         (Archive::task_): New field.
14358         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14359         for thin archives.  Pass additional parameters to
14360         Archive::Archive.  Unlock the archive file after calling
14361         Archive::setup.
14362
14363 2008-03-29  Ian Lance Taylor  <iant@google.com>
14364
14365         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14366         version symbol to be local.
14367         * testsuite/ver_test_4.sh: New file.
14368         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14369         (check_DATA): Add ver_test_4.syms.
14370         (ver_test_4.syms): New target.
14371         * testsuite/Makefile.in: Rebuild.
14372
14373         * output.cc
14374         (Output_section::Input_section_sort_entry::has_priority): New
14375         function.
14376         (Output_section::Input_section_sort_entry::match_file_name): New
14377         function.
14378         (Output_section::Input_section_sort_entry::match_section_name):
14379         Remove.
14380         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14381         Remove.
14382         (Output_section::Input_section_sort_entry::match_section_file):
14383         Remove.
14384         (Output_section::Input_section_sort_compare::operator()): Rewrite
14385         using new Input_section_sort_entry functions.  Sort crtbegin and
14386         crtend first.  Sort sections with no priority before sections with
14387         a priority.
14388         * testsuite/initpri1.c (d3): Check j != 4.
14389         (cd5): New constructor/destructor function.
14390         (main): Check j != 2.
14391
14392         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14393         new symbol when resolving, don't call set_is_default.
14394         * testsuite/ver_test_7.cc: New file.
14395         * testsuite/ver_test_7.sh: New file.
14396         * testsuite/Makefile.am (ver_test_7.so): New target.
14397         (ver_test_7.o): New target.
14398         (check_SCRIPTS): Add ver_test_7.sh.
14399         (check_DATA): Add ver_test_7.syms.
14400         (ver_test_7.syms): New target.
14401
14402 2008-03-28  Ian Lance Taylor  <iant@google.com>
14403
14404         * layout.cc (Layout::layout): If we see an input section with a
14405         name that needs sorting, set the must_sort flag for the output
14406         section.
14407         (Layout::make_output_section): If the name of the output section
14408         indicates that it might require sorting, set the may_sort flag.
14409         * output.h (Output_section::may_sort_attached_input_sections): New
14410         function.
14411         (Output_section::set_may_sort_attached_input_sections): New
14412         function.
14413         (Output_section::must_sort_attached_input_sections): New
14414         function.
14415         (Output_section::set_must_sort_attached_input_sections): New
14416         function.
14417         (class Output_section): Declare Input_section_sort_entry.  Define
14418         Input_section_sort_compare.  Declare
14419         sort_attached_input_sections.  Add new fields:
14420         may_sort_attached_input_sections_,
14421         must_sort_attached_input_sections_,
14422         attached_input_sections_are_sorted_.
14423         * output.cc (Output_section::Output_section): Initialize new
14424         fields.
14425         (Output_section::add_input_section): Add an entry to
14426         input_sections_ if may_sort or must_sort are true.
14427         (Output_section::set_final_data_size): Call
14428         sort_attached_input_sections if necessary.
14429         (Output_section::Input_section_sort_entry): Define new class.
14430         (Output_section::Input_section_sort_compare::operator()): New
14431         function.
14432         (Output_section::sort_attached_input_sections): New function.
14433         * configure.ac: Check whether the compiler supports constructor
14434         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14435         * testsuite/initpri1.c: New file.
14436         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14437         CONSTRUCTOR_PRIORITY.
14438         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14439         (initpri1_LDFLAGS): New variable.
14440         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14441
14442 2008-03-27  Ian Lance Taylor  <iant@google.com>
14443
14444         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14445         * testsuite/common_test_1.c: New file.
14446         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14447         (common_test_1_SOURCES): New variable.
14448         (common_test_1_DEPENDENCIES): New variable.
14449         (common_test_1_LDFLAGS): New variable.
14450
14451         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14452         and commons_ correctly when NAME/VERSION does not override
14453         NAME/NULL.
14454         * testsuite/ver_test_6.c: New file.
14455         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14456         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14457         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14458
14459 2008-03-26  Ian Lance Taylor  <iant@google.com>
14460
14461         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14462         of an undefined symbol from a version script.
14463         * testsuite/Makefile.am (ver_test_5.so): New target.
14464         (ver_test_5.o): New target.
14465         (check_SCRIPTS): Add ver_test_5.sh.
14466         (check_DATA): Add ver_test_5.syms.
14467         (ver_test_5.syms): New target.
14468         * testsuite/ver_test_5.cc: New file.
14469         * testsuite/ver_test_5.script: New file.
14470         * testsuite/ver_test_5.sh: New file.
14471         * Makefile.in, testsuite/Makefile.in: Rebuild.
14472
14473         PR gold/5986
14474         Fix problems building gold with gcc 4.3.0.
14475         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14476         (gold_error_at_location, gold_warning_at_location): Use it.
14477         * configure.ac: Check whether we can compile and use a template
14478         function with a printf attribute.
14479         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14480         when jumping over bytes.
14481         * object.cc: Instantiate Object::read_section_data.
14482         * debug.h: Include <cstring>
14483         * dwarf_reader.cc: Include <algorithm>
14484         * main.cc: Include <cstring>.
14485         * options.cc: Include <cstring>.
14486         * output.cc: Include <cstring>.
14487         * script.cc: Include <cstring>.
14488         * script.h: Include <string>.
14489         * symtab.cc: Include <cstring> and <algorithm>.
14490         * target-select.cc: Include <cstring>.
14491         * version.cc: Include <string>.
14492         * testsuite/testmain.cc: Include <cstdlib>.
14493         * configure, config.in: Rebuild.
14494
14495 2008-03-25  Ian Lance Taylor  <iant@google.com>
14496
14497         * options.cc: Include "../bfd/bfdver.h".
14498         (options::help): Print bug reporting address.
14499
14500         * version.cc (print_version): Adjust output for current value of
14501         BFD_VERSION_STRING.
14502
14503         * NEWS: New file.
14504
14505         * options.cc (options::help): Print list of supported targets.
14506         * target-select.h: Include <vector>.
14507         (class Target_selector): Make machine_, size_, and is_big_endian_
14508         fields const.  Add bfd_name_ and instantiated_target_ fields.
14509         (Target_selector::Target_selector): Add bfd_name parameter.
14510         (Target_selector::recognize): Make non-virtual, call
14511         do_recognize.
14512         (Target_selector::recognize_by_name): Make non-virtual, call
14513         do_recognize_by_name.
14514         (Target_selector::supported_names): New function.
14515         (Target_selector::bfd_name): New function.
14516         (Target_selector::do_instantiate_target): New pure virtual
14517         function.
14518         (Target_selector::do_recognize): New virtual function.
14519         (Target_selector::do_recognize_by_name): New virtual function.
14520         (Target_selector::instantiate_target): New private function.
14521         (supported_target_names): Declare.
14522         * target-select.cc (Target_selector::Target_selector): Update for
14523         new parameter and fields.
14524         (select_target_by_name): Check that the name matches before
14525         calling recognize_by_name.
14526         (supported_target_names): New function.
14527         * i386.cc (class Target_selector_i386): Update Target_selector
14528         constructor call.  Remove recognize and recognize_by_name.  Add
14529         do_instantiate_target.
14530         * x86_64.cc (class Target_selector_x86_64): Likewise.
14531         * testsuite/testfile.cc (class Target_selector_test): Update for
14532         changes to Target_selector.
14533
14534         * README: Rewrite, with some notes on unsupported features.
14535
14536 2008-03-24  Cary Coutant  <ccoutant@google.com>
14537
14538         * i386.cc (Target_i386::Got_type): New enum declaration.
14539         (Target_i386::Scan::local): Updated callers of Output_data_got
14540         member functions.
14541         (Target_i386::Scan::global): Likewise.
14542         (Target_i386::Relocate::relocate): Likewise.
14543         (Target_i386::Relocate::relocate_tls): Likewise.
14544         * object.h (Got_offset_list): New class.
14545         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14546         (Sized_relobj::local_got_offset): Likewise.
14547         (Sized_relobj::set_local_got_offset): Likewise.
14548         (Sized_relobj::local_has_tls_got_offset): Removed.
14549         (Sized_relobj::local_tls_got_offset): Removed.
14550         (Sized_relobj::set_local_tls_got_offset): Removed.
14551         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14552         * output.cc (Output_data_got::add_global): Added got_type parameter.
14553         (Output_data_got::add_global_with_rel): Likewise.
14554         (Output_data_got::add_global_with_rela): Likewise.
14555         (Output_data_got::add_global_pair_with_rel): New function.
14556         (Output_data_got::add_global_pair_with_rela): New function.
14557         (Output_data_got::add_local): Added got_type parameter.
14558         (Output_data_got::add_local_with_rel): Likewise.
14559         (Output_data_got::add_local_with_rela): Likewise.
14560         (Output_data_got::add_local_pair_with_rel): New function.
14561         (Output_data_got::add_local_pair_with_rela): New function.
14562         (Output_data_got::add_global_tls): Removed.
14563         (Output_data_got::add_global_tls_with_rel): Removed.
14564         (Output_data_got::add_global_tls_with_rela): Removed.
14565         (Output_data_got::add_local_tls): Removed.
14566         (Output_data_got::add_local_tls_with_rel): Removed.
14567         (Output_data_got::add_local_tls_with_rela): Removed.
14568         * output.h (Output_data_got::add_global): Added got_type parameter.
14569         (Output_data_got::add_global_with_rel): Likewise.
14570         (Output_data_got::add_global_with_rela): Likewise.
14571         (Output_data_got::add_global_pair_with_rel): New function.
14572         (Output_data_got::add_global_pair_with_rela): New function.
14573         (Output_data_got::add_local): Added got_type parameter.
14574         (Output_data_got::add_local_with_rel): Likewise.
14575         (Output_data_got::add_local_with_rela): Likewise.
14576         (Output_data_got::add_local_pair_with_rel): New function.
14577         (Output_data_got::add_local_pair_with_rela): New function.
14578         (Output_data_got::add_global_tls): Removed.
14579         (Output_data_got::add_global_tls_with_rel): Removed.
14580         (Output_data_got::add_global_tls_with_rela): Removed.
14581         (Output_data_got::add_local_tls): Removed.
14582         (Output_data_got::add_local_tls_with_rel): Removed.
14583         (Output_data_got::add_local_tls_with_rela): Removed.
14584         * resolve.cc (Symbol::override_base_with_special): Removed
14585         reference to has_got_offset_ field.
14586         * symtab.cc (Symbol::init_fields): Replaced initialization
14587         of got_offset_ with got_offsets_.  Removed initialization
14588         of has_got_offset_
14589         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14590         (Symbol::got_offset): Likewise.
14591         (Symbol::set_got_offset): Likewise.
14592         (Symbol::has_tls_got_offset): Removed.
14593         (Symbol::tls_got_offset): Removed.
14594         (Symbol::set_tls_got_offset): Removed.
14595         (Symbol::got_offset_): Removed.
14596         (Symbol::tls_mod_got_offset_): Removed.
14597         (Symbol::tls_pair_got_offset_): Removed.
14598         (Symbol::got_offsets_): New field.
14599         (Symbol::has_got_offset): Removed.
14600         (Symbol::has_tls_mod_got_offset): Removed.
14601         (Symbol::has_tls_pair_got_offset): Removed.
14602         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14603         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14604         member functions.
14605         (Target_x86_64::Scan::global): Likewise.
14606         (Target_x86_64::Relocate::relocate): Likewise.
14607         (Target_x86_64::Relocate::relocate_tls): Likewise.
14608
14609 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14610
14611         * yyscript.y: Fix spelling error in comment.
14612
14613 2008-03-24  Ian Lance Taylor  <iant@google.com>
14614
14615         * options.h (class General_options): Define build_id option.
14616         * layout.h (class Layout): Declare write_build_id, create_note,
14617         create_build_id.  Add build_id_note_ member.
14618         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14619         "libiberty.h", "md5.h", "sha1.h".
14620         (Layout::Layout): Initialize eh_frame_data_,
14621         eh_frame_hdr_section_, and build_id_note_.
14622         (Layout::finalize): Call create_build_id.
14623         (Layout::create_note): New function, broken out of
14624         Layout::create_gold_note.
14625         (Layout::create_gold_note): Call create_note.
14626         (Layout::create_build_id): New function.
14627         (Layout::write_build_id): New function.
14628         (Close_task_runner::run): Call write_build_id.
14629
14630         * x86_64.cc: Correct license to GPLv3.
14631
14632 2008-03-23  Ian Lance Taylor  <iant@google.com>
14633
14634         * options.cc: Include "demangle.h".
14635         (parse_optional_string): New function.
14636         (parse_long_option): Handle takes_optional_argument.
14637         (parse_short_option): Update dash_z initializer.  Handle
14638         takes_optional_argument.
14639         (General_options::General_options): Initialize do_demangle_.
14640         (General_options::finalize): Set do_demangle_.  Handle demangling
14641         style.
14642         * options.h (parse_optional_string): Declare.
14643         (struct One_option): Add optional_arg field.  Update constructor.
14644         Update call constructor calls.  Add takes_optional_argument
14645         function.
14646         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14647         (DEFINE_optional_string): Define.
14648         (General_options::demangle): Change from DEFINE_bool to
14649         DEFINE_optional_string.
14650         (General_options::no_demangle): New function.
14651         (General_options::do_demangle): New function.
14652         (General_options::set_do_demangle): New function.
14653         (General_options::execstack_status_): Move definition to end of
14654         class definition.
14655         (General_options::static_): Likewise.
14656         (General_options::do_demangle_): New field.
14657         * object.cc (big_endian>::get_symbol_location_info): Call
14658         Options::do_demangle, not Options::demangle.
14659         * symtab.cc (demangle): Likewise.
14660
14661 2008-03-22  Ian Lance Taylor  <iant@google.com>
14662
14663         * gold.h: Include <cstddef> and <sys/types.h>
14664         * options.h: Include <cstring>.
14665
14666 2008-03-21  Ian Lance Taylor  <iant@google.com>
14667
14668         * Added source code to GNU binutils.
14669 \f
14670 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14671
14672 Copying and distribution of this file, with or without modification,
14673 are permitted in any medium without royalty provided the copyright
14674 notice and this notice are preserved.
14675
14676 Local Variables:
14677 mode: change-log
14678 left-margin: 8
14679 fill-column: 74
14680 version-control: never
14681 End: